Saltstack Official FirewallD Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

policies.sls 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # == State: firewalld.policies
  2. #
  3. # This state ensures that /etc/firewalld/policies/ exists.
  4. #
  5. {% from "firewalld/map.jinja" import firewalld with context %}
  6. directory_firewalld_policies:
  7. file.directory: # make sure this is a directory
  8. - name: /etc/firewalld/policies
  9. - user: root
  10. - group: root
  11. - mode: 750
  12. - require:
  13. - pkg: package_firewalld # make sure package is installed
  14. - require_in:
  15. - service: service_firewalld
  16. - watch_in:
  17. - cmd: reload_firewalld # reload firewalld config
  18. # == Define: firewalld.policies
  19. #
  20. # This defines a policy configuration, see firewalld.policy (5) man page.
  21. #
  22. {% for k, v in salt['pillar.get']('firewalld:policies', {}).items() %}
  23. {% set z_name = v.name|default(k) %}
  24. /etc/firewalld/policies/{{ z_name }}.xml:
  25. file.managed:
  26. - name: /etc/firewalld/policies/{{ z_name }}.xml
  27. - user: root
  28. - group: root
  29. - mode: 644
  30. - source: salt://firewalld/files/policy.xml
  31. - template: jinja
  32. - require:
  33. - pkg: package_firewalld # make sure package is installed
  34. - file: directory_firewalld_policies
  35. - require_in:
  36. - service: service_firewalld
  37. - watch_in:
  38. - cmd: reload_firewalld # reload firewalld config
  39. - context:
  40. name: {{ z_name }}
  41. policy: {{ v|json }}
  42. {% endfor %}