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.

service.sls 826B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {% from "iptables/map.jinja" import service with context %}
  2. {%- if service.enabled %}
  3. include:
  4. - iptables.rules
  5. iptables_packages:
  6. pkg.installed:
  7. - names: {{ service.pkgs }}
  8. iptables_services:
  9. {%- if grains.init == 'systemd' %}
  10. service.running:
  11. {%- else %}
  12. service.dead:
  13. {%- endif %}
  14. - enable: true
  15. - name: {{ service.service }}
  16. - sig: test -e /etc/iptables/rules.v4
  17. - require:
  18. - pkg: iptables_packages
  19. {%- else %}
  20. iptables_services:
  21. service.dead:
  22. - enable: false
  23. - name: {{ service.service }}
  24. {%- for chain_name in ['INPUT', 'OUTPUT', 'FORWARD'] %}
  25. iptables_{{ chain_name }}_policy:
  26. iptables.set_policy:
  27. - chain: {{ chain_name }}
  28. - policy: ACCEPT
  29. - table: filter
  30. - require_in:
  31. - iptables: iptables_flush
  32. {%- endfor %}
  33. iptables_flush:
  34. iptables.flush
  35. {%- endif %}