Saltstack Official IPTables Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

34 lines
976B

  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. - chain: {{ chain_name }}
  7. - policy: {{ chain.policy }}
  8. - table: filter
  9. {%- endif %}
  10. {%- for service_name, service in pillar.items() %}
  11. {%- if service.get('_support', {}).get('iptables', {}).get('enabled', False) %}
  12. {%- set grains_fragment_file = service_name+'/meta/iptables.yml' %}
  13. {%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
  14. {%- set grains_yaml = load_grains_file()|load_yaml %}
  15. {%- for rule in grains_yaml.iptables.rules %}
  16. {%- set rule_name = service_name+'_'+loop.index|string %}
  17. {% include "iptables/_rule.sls" %}
  18. {%- endfor %}
  19. {%- endif %}
  20. {%- endfor %}
  21. {%- for rule in chain.get('rules', []) %}
  22. {%- set rule_name = loop.index %}
  23. {% include "iptables/_rule.sls" %}
  24. {%- endfor %}
  25. {%- endfor %}