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

47 lines
1.1KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. include:
  3. - apache
  4. mod-security:
  5. pkg.installed:
  6. - name: {{ apache.mod_security.package }}
  7. - order: 180
  8. - require:
  9. - pkg: apache
  10. {% if apache.mod_security.crs_install %}
  11. mod-security-crs:
  12. pkg.installed:
  13. - name: {{ apache.mod_security.crs_package }}
  14. - order: 180
  15. - require:
  16. - pkg: mod-security
  17. {% endif %}
  18. {% if apache.mod_security.manage_config %}
  19. mod-security-main-config:
  20. file.managed:
  21. - name: {{ apache.mod_security.config_file }}
  22. - order: 220
  23. - template: jinja
  24. - source:
  25. - {{ 'salt://apache/files/' ~ salt['grains.get']('os_family') ~ '/modsecurity.conf.jinja' }}
  26. - context: {{ apache.mod_security }}
  27. - require:
  28. - pkg: mod-security
  29. - watch_in:
  30. - module: apache-reload
  31. {% endif %}
  32. {% if grains['os_family']=="Debian" %}
  33. a2enmod security2:
  34. cmd.run:
  35. - unless: ls /etc/apache2/mods-enabled/security2.load && ls /etc/apache2/mods-enabled/security2.conf
  36. - order: 225
  37. - require:
  38. - pkg: mod-security
  39. - watch_in:
  40. - module: apache-restart
  41. {% endif %}