Saltstack Official IPTables Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.rst 9.2KB

9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. ================
  2. iptables formula
  3. ================
  4. iptables is a user-space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall and the chains and rules it stores.
  5. Sample pillars
  6. ==============
  7. Simple INPUT chain httpd ACCEPT rule on position 1
  8. .. code-block:: yaml
  9. iptables:
  10. service:
  11. enabled: false
  12. chain:
  13. INPUT:
  14. enabled: true
  15. policy: DROP
  16. rule:
  17. httpd:
  18. position: 1
  19. table: filter
  20. jump: ACCEPT
  21. family: ipv6
  22. match: state
  23. connection_state: NEW
  24. protocol: tcp
  25. source_port: 1025:65535
  26. destination_port: 80
  27. Read more
  28. =========
  29. * http://docs.saltstack.com/en/latest/ref/states/all/salt.states.iptables.html
  30. * https://help.ubuntu.com/community/IptablesHowTo
  31. * http://wiki.centos.org/HowTos/Network/IPTables
  32. .. code-block:: yaml
  33. chain:
  34. PREROUTING:
  35. enabled: true
  36. rule:
  37. dnat_ssh_185:
  38. table: filter
  39. jump: DNAT
  40. match: tcp
  41. protocol: tcp
  42. destination_network: 185.22.97.132/32
  43. destination_port: 20022
  44. to_destination:
  45. host: 10.0.110.38
  46. port: 22
  47. comment: Premapovani ssh zvenku na standardni port
  48. dnat_ssh_10:
  49. table: filter
  50. jump: DNAT
  51. match: tcp
  52. protocol: tcp
  53. destination_network: 10.0.110.38/32
  54. destination_port: 20022
  55. to_destination:
  56. host: 10.0.110.38
  57. port: 22
  58. comment: Premapovani ssh 20022-22
  59. redirect_vpn_185:
  60. table: filter
  61. jump: REDIRECT
  62. match: udp
  63. protocol: udp
  64. destination_network: 185.22.97.132/32
  65. destination_port: 3690
  66. to_port:
  67. port: 1194
  68. comment: Presmerovani VPN portu 3690 > 1194
  69. POSTROUTING:
  70. enabled: true
  71. rule:
  72. snat_vpn_185:
  73. table: filter
  74. jump: SNAT
  75. match: udp
  76. protocol: udp
  77. source_network: 10.8.0.0/24
  78. out_interface: eth1
  79. to_source:
  80. host: 185.22.97.132
  81. comment: NAT pro klienty administratorske VPNky
  82. INPUT:
  83. enabled: true
  84. rule:
  85. allow_conn_established:
  86. table: filter
  87. jump: ACCEPT
  88. match: state
  89. connection_state: RELATED,ESTABLISHED
  90. comment: Vsechen provoz souvisejici s povolenymi pravidly pustit
  91. allow_proto_icmp:
  92. table: filter
  93. jump: ACCEPT
  94. protocol: icmp
  95. comment: ICMP nechceme filtrovat
  96. allow_iface_lo:
  97. table: filter
  98. jump: ACCEPT
  99. in_interface: lo
  100. comment: Lokalni smycka muze vsechno
  101. allow_ssh_10.0.110.38:
  102. table: filter
  103. jump: ACCEPT
  104. match: tcp
  105. protocol: tcp
  106. destination_network: 10.0.110.38/32
  107. destination_port: 22
  108. comment: SSH z lokalni site
  109. allow_ssh_10.8.0.1:
  110. table: filter
  111. jump: ACCEPT
  112. match: tcp
  113. protocol: tcp
  114. destination_network: 10.8.0.1/32
  115. destination_port: 22
  116. comment: SSH z VPN site
  117. allow_ssh_private_10:
  118. table: filter
  119. jump: ACCEPT
  120. match: state
  121. connection_state: NEW
  122. source_network: 10.0.0.0/8
  123. destination_network: 185.22.97.132/32
  124. destination_port: 22
  125. comment: ssh z vnitrni site 10.0.0.0/8 povolit na obvykly protokol
  126. allow_ssh_private_192:
  127. table: filter
  128. jump: ACCEPT
  129. match: state
  130. connection_state: NEW
  131. source_network: 192.0.0.0/8
  132. destination_network: 185.22.97.132/32
  133. destination_port: 22
  134. comment: ssh z vnitrni site 192.0.0.0/8 povolit na obvykly protokol
  135. allow_ssh_private_172:
  136. table: filter
  137. jump: ACCEPT
  138. match: state
  139. connection_state: NEW
  140. source_network: 172.16.162.0/24
  141. destination_network: 185.22.97.132/32
  142. destination_port: 22
  143. comment: ssh z vnitrni site 10.0.0.0/8 povolit na obvykly protokol
  144. allow_ssh_private_185:
  145. table: filter
  146. jump: ACCEPT
  147. match: state
  148. connection_state: NEW
  149. source_network: 185.22.97.0/24
  150. destination_network: 185.22.97.132/32
  151. destination_port: 22
  152. comment: ssh z vnitrni site 192.0.0.0/8 povolit na obvykly protokol
  153. deny_ssh_public:
  154. table: filter
  155. jump: DROP
  156. match: tpc
  157. protocol: tcp
  158. destination_network: 185.22.97.132/32
  159. destination_port: 22
  160. comment: ssh z vnejsi site na obvykly port ZAKAZAT, budeme ho presmerovavat
  161. allow_ssh_public_redirect:
  162. table: filter
  163. jump: ACCEPT
  164. match: tpc
  165. protocol: tcp
  166. destination_port: 22022
  167. comment: nahradni ssh port bude presmerovan na 22 pokud se prijde z vnejsi site
  168. allow_zabbix_server:
  169. table: filter
  170. jump: ACCEPT
  171. match: tpc
  172. protocol: tcp
  173. source_network: 10.0.110.36/32
  174. destination_port: 10050
  175. comment: zabbix monitoring
  176. allow_tsmc_web_10:
  177. table: filter
  178. jump: ACCEPT
  179. match: tpc
  180. protocol: tcp
  181. source_network: 10.0.0.0/8
  182. destination_port: 1581
  183. comment: tsm client web gui
  184. allow_tsmc_37010_10:
  185. table: filter
  186. jump: ACCEPT
  187. match: state
  188. protocol: tcp
  189. source_network: 10.0.0.0/8
  190. destination_port: 37010
  191. comment: tsmc web
  192. allow_tsmc_39876_10:
  193. table: filter
  194. jump: ACCEPT
  195. match: state
  196. protocol: tcp
  197. source_network: 10.0.0.0/8
  198. destination_port: 39876
  199. comment: tsmc web
  200. allow_tsm_web_172:
  201. table: filter
  202. jump: ACCEPT
  203. match: tpc
  204. protocol: tcp
  205. source_network: 172.16.162.0/24
  206. destination_port: 1581
  207. comment: tsm client web gui
  208. allow_tsmc_37010_172:
  209. table: filter
  210. jump: ACCEPT
  211. match: state
  212. protocol: tcp
  213. source_network: 172.16.162.0/24
  214. destination_port: 37010
  215. comment: tsmc web
  216. allow_tsmc_39876_172:
  217. table: filter
  218. jump: ACCEPT
  219. match: state
  220. protocol: tcp
  221. source_network: 172.16.162.0/24
  222. destination_port: 39876
  223. comment: tsmc web
  224. allow_vpn_public:
  225. table: filter
  226. jump: ACCEPT
  227. match: state
  228. connection_state: NEW
  229. destination_port: 1194
  230. comment: Povolime VPN odkudkoli
  231. reject_rest:
  232. table: filter
  233. jump: REJECT
  234. comment: Zdvorile odmitame ostatni komunikaci; --reject-with icmp-host-prohibited neni
  235. FORWARD:
  236. enabled: true
  237. rule:
  238. allow_conn_established:
  239. table: filter
  240. jump: ACCEPT
  241. match: state
  242. connection_state: RELATED,ESTABLISHED
  243. comment: Vsechen provoz souvisejici s povolenymi pravidly pustit
  244. snat_vpn_185:
  245. table: filter
  246. jump: SNAT
  247. match: udp
  248. protocol: udp
  249. source_network: 10.8.0.0/24
  250. out_interface: eth1
  251. to_source:
  252. host: 185.22.97.132
  253. comment: NAT pro klienty administratorske VPNky
  254. accept_net_10.0.110.0_vpn:
  255. table: filter
  256. jump: ACCEPT
  257. source_network: 10.0.110.0/24
  258. destionation_network: 10.8.0.0/24
  259. comment: vnitrni komunikace management
  260. accept_net_10.10.0.0_vpn:
  261. table: filter
  262. jump: ACCEPT
  263. source_network: 10.10.0.0/16
  264. destionation_network: 10.8.0.0/24
  265. comment: vnitrni komunikace management
  266. accept_net_10.0.101.0_vpn:
  267. table: filter
  268. jump: ACCEPT
  269. source_network: 10.0.101.0/24
  270. destionation_network: 10.8.0.0/24
  271. comment: vnitrni komunikace VLAN1501
  272. accept_net_10.0.102.0_vpn:
  273. table: filter
  274. jump: ACCEPT
  275. source_network: 10.0.102.0/24
  276. destionation_network: 10.8.0.0/24
  277. comment: vnitrni komunikace VLAN1502
  278. accept_net_10.0.103.0_vpn:
  279. table: filter
  280. jump: ACCEPT
  281. source_network: 10.0.103.0/24
  282. destionation_network: 10.8.0.0/24
  283. comment: vnitrni komunikace VLAN1503
  284. accept_net_10.0.106.0_vpn:
  285. table: filter
  286. jump: ACCEPT
  287. source_network: 10.0.106.0/24
  288. destionation_network: 10.8.0.0/24
  289. comment: vnitrni komunikace VLAN1506
  290. accept_net_10.0.110.0:
  291. table: filter
  292. jump: ACCEPT
  293. source_network: 10.0.110.0/24
  294. comment: Vse ze site 10.0.110.0
  295. accept_net_10.8.0.0:
  296. table: filter
  297. jump: ACCEPT
  298. source_network: 10.8.0.0/24
  299. comment: Z teto VPN se smi skoro vsechno