Saltstack Official IPTables Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {% from "iptables/map.jinja" import service with context %}
  2. {%- for chain_name, chain in service.get('chain', {}).iteritems() %}
  3. {%- if chain.policy is defined %}
  4. iptables_{{ chain_name }}_policy:
  5. iptables.set_policy:
  6. - family: ipv4
  7. - chain: {{ chain_name }}
  8. - policy: {{ chain.policy }}
  9. - table: filter
  10. {%- if grains.ipv6|default(False) and service.ipv6|default(True) %}
  11. iptables_{{ chain_name }}_ipv6_policy:
  12. iptables.set_policy:
  13. - family: ipv6
  14. - chain: {{ chain_name }}
  15. - policy: {{ chain.policy }}
  16. - table: filter
  17. {%- endif %}
  18. {%- endif %}
  19. {%- for service_name, service in pillar.items() %}
  20. {%- if service.get('_support', {}).get('iptables', {}).get('enabled', False) %}
  21. {%- set grains_fragment_file = service_name+'/meta/iptables.yml' %}
  22. {%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
  23. {%- set grains_yaml = load_grains_file()|load_yaml %}
  24. {%- for rule in grains_yaml.iptables.rules %}
  25. {%- set rule_name = service_name+'_'+loop.index|string %}
  26. {% include "iptables/_rule.sls" %}
  27. {%- endfor %}
  28. {%- endif %}
  29. {%- endfor %}
  30. {%- for rule in chain.get('rules', []) %}
  31. {%- set rule_name = loop.index %}
  32. {% include "iptables/_rule.sls" %}
  33. {%- endfor %}
  34. {%- endfor %}