Saltstack Official Apache Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

manage_security.sls 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {% from "apache/map.jinja" import apache with context %}
  2. include:
  3. - apache
  4. {% if grains['os_family']=="Debian" %}
  5. {% if salt['file.file_exists' ]('/etc/apache2/conf-available/security.conf') %}
  6. apache_security-block:
  7. file.blockreplace:
  8. - name: /etc/apache2/conf-available/security.conf
  9. - marker_start: "# START managed zone -DO-NOT-EDIT-"
  10. - marker_end: "# END managed zone --"
  11. - append_if_not_found: True
  12. - show_changes: True
  13. - require:
  14. - pkg: apache
  15. - watch_in:
  16. - module: apache-reload
  17. {% for option, value in salt['pillar.get']('apache:security', {}).items() %}
  18. apache_manage-security-{{ option }}:
  19. file.accumulated:
  20. - filename: /etc/apache2/conf-available/security.conf
  21. - name: apache_manage-security-add-{{ option }}
  22. - text: "{{ option }} {{ value }}"
  23. - require_in:
  24. - file: apache_security-block
  25. {% endfor %}
  26. {% endif %}
  27. {% elif grains['os_family']=="FreeBSD" %}
  28. {{ apache.confdir }}/security.conf:
  29. file.managed:
  30. - source: salt://apache/files/{{ salt['grains.get']('os_family') }}/security.conf.jinja
  31. - mode: 644
  32. - template: jinja
  33. - require:
  34. - pkg: apache
  35. - watch_in:
  36. - module: apache-restart
  37. {% endif %}