Saltstack Official IPTables Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

44 行
1.2KB

  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 service.ipv6 %}
  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 %}