Saltstack Official UFW Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

33 lines
935B

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- set sls_package_install = tplroot ~ '.package.install' %}
  6. {%- set sls_enable_service = tplroot ~ '.service.enable' %}
  7. {%- set sls_reload_service = tplroot ~ '.service.reload' %}
  8. {%- from tplroot ~ "/map.jinja" import ufw with context %}
  9. {%- set enabled = ufw.get('enabled', False) %}
  10. include:
  11. - {{ sls_package_install }}
  12. - {{ sls_enable_service }}
  13. - {{ sls_reload_service }}
  14. # Interfaces
  15. {%- for interface_name, interface_details in ufw.get('interfaces', {}).items() %}
  16. {%- set comment = interface_details.get('comment', None) %}
  17. ufw-interface-{{ interface_name }}:
  18. ufw.allowed:
  19. - interface: {{ interface_name }}
  20. {%- if comment is not none %}
  21. - comment: '"{{ comment }}"'
  22. {%- endif %}
  23. {%- if enabled %}
  24. - listen_in:
  25. - cmd: reload-ufw
  26. {%- endif %}
  27. {%- endfor %}