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.1KB

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