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.

67 lines
1.6KB

  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. - watch_in:
  11. - module: apache-restart
  12. - require_in:
  13. - module: apache-restart
  14. - module: apache-reload
  15. - service: apache
  16. {% if apache.mod_security.crs_install %}
  17. mod-security-crs:
  18. pkg.installed:
  19. - name: {{ apache.mod_security.crs_package }}
  20. - order: 180
  21. - require:
  22. - pkg: mod-security
  23. - watch_in:
  24. - module: apache-restart
  25. - require_in:
  26. - module: apache-restart
  27. - module: apache-reload
  28. - service: apache
  29. {% endif %}
  30. {% if apache.mod_security.manage_config %}
  31. mod-security-main-config:
  32. file.managed:
  33. - name: {{ apache.mod_security.config_file }}
  34. - order: 220
  35. - template: jinja
  36. - source:
  37. - {{ 'salt://apache/files/' ~ salt['grains.get']('os_family') ~ '/modsecurity.conf.jinja' }}
  38. - context: {{ apache.mod_security }}
  39. - require:
  40. - pkg: mod-security
  41. - watch_in:
  42. - module: apache-reload
  43. - require_in:
  44. - module: apache-restart
  45. - module: apache-reload
  46. - service: apache
  47. {% endif %}
  48. {% if grains['os_family']=="Debian" %}
  49. a2enmod security2:
  50. cmd.run:
  51. - unless: ls /etc/apache2/mods-enabled/security2.load && ls /etc/apache2/mods-enabled/security2.conf
  52. - order: 225
  53. - require:
  54. - pkg: mod-security
  55. - watch_in:
  56. - module: apache-restart
  57. - require_in:
  58. - module: apache-restart
  59. - module: apache-reload
  60. - service: apache
  61. {% endif %}