Saltstack Official IPTables Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

_rule.sls 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. iptables_{{ chain_name }}_{{ rule_name }}:
  2. {%- if rule.position is defined %}
  3. iptables.insert:
  4. - position: {{ rule.position }}
  5. {%- else %}
  6. iptables.append:
  7. {%- if loop.index != 1 %}
  8. - require:
  9. - iptables: iptables_{{ chain_name }}_{% if service_name is defined %}{{ service_name }}_{% endif %}{{ loop.index - 1 }}
  10. {%- endif %}
  11. {%- endif %}
  12. - table: {{ rule.get('table', 'filter') }}
  13. - chain: {{ chain_name }}
  14. {%- if rule.family is defined %}
  15. - family: {{ rule.family }}
  16. {%- endif %}
  17. {%- if rule.jump is defined %}
  18. - jump: {{ rule.jump }}
  19. {%- endif %}
  20. {%- if rule.match is defined %}
  21. - match: {{ rule.match }}
  22. {%- endif %}
  23. {%- if rule.connection_state is defined %}
  24. - connstate: {{ rule.connection_state }}
  25. {%- endif %}
  26. {%- if rule.protocol is defined %}
  27. - proto: {{ rule.protocol }}
  28. {%- endif %}
  29. {%- if rule.destination_port is defined %}
  30. - dport: {{ rule.destination_port }}
  31. {%- endif %}
  32. {%- if rule.source_port is defined %}
  33. - sport: {{ rule.source_port }}
  34. {%- endif %}
  35. {%- if rule.in_interface is defined %}
  36. - in-interface: {{ rule.in_interface }}
  37. {%- endif %}
  38. {%- if rule.out_interface is defined %}
  39. - out-interface: {{ rule.out_interface }}
  40. {%- endif %}
  41. {%- if rule.to_destination is defined %}
  42. - to-destination: {{ rule.to_destination }}
  43. {%- endif %}
  44. {%- if rule.to_port is defined %}
  45. - to-port: {{ rule.to_port }}
  46. {%- endif %}
  47. {%- if rule.to_source is defined %}
  48. - to-source: {{ rule.to_source }}
  49. {%- endif %}
  50. {%- if rule.source_network is defined %}
  51. - source: {{ rule.source_network }}
  52. {%- endif %}
  53. {%- if rule.destination_network is defined %}
  54. - destination: {{ rule.destination_network }}
  55. {%- endif %}
  56. {%- if chain.policy is defined %}
  57. - require_in:
  58. - iptables: iptables_{{ chain_name }}_policy
  59. {%- endif %}
  60. - require:
  61. - iptables: iptables_{{ chain_name }}{% if rule.family is defined %}_{{ rule.family }}{% endif %}
  62. - save: True