Saltstack Official Apache 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.

46 lines
1.2KB

  1. {%- set apache = pillar.get('apache', {}) %}
  2. {%- set mod_security = apache.get('mod_security', {}) %}
  3. {%- if mod_security.get('manage_config', False) %}
  4. include:
  5. - apache.mod_security
  6. {%- for rule_name, rule_details in mod_security.get('rules', {}).items() %}
  7. {% set rule_set = rule_details.get('rule_set', '') %}
  8. {% set enabled = rule_details.get('enabled', False ) %}
  9. {%- if enabled %}
  10. /etc/modsecurity/{{ rule_name }}:
  11. file.symlink:
  12. - target: /usr/share/modsecurity-crs/{{ rule_set }}/{{ rule_name }}
  13. - user: root
  14. - group: root
  15. - mode: 755
  16. {%- else %}
  17. /etc/modsecurity/{{ rule_name }}:
  18. file.absent:
  19. - name: /etc/modsecurity/{{ rule_name }}
  20. {%- endif %}
  21. {%- endfor %}
  22. {%- for custom_rule, custom_rule_details in mod_security.get('custom_rule_files', {}).items() %}
  23. {% set file = custom_rule_details.get('file', None) %}
  24. {% set path = custom_rule_details.get('path', None) %}
  25. {% set enabled = custom_rule_details.get('enabled', False ) %}
  26. {%- if enabled %}
  27. /etc/modsecurity/{{ file }}:
  28. file.managed:
  29. - source: {{ path }}
  30. - user: root
  31. - group: root
  32. - mode: 755
  33. {%- else %}
  34. /etc/modsecurity/{{ file }}:
  35. file.absent:
  36. - name: /etc/modsecurity/{{ file }}
  37. {%- endif %}
  38. {%- endfor %}
  39. {% endif %}