apache-formula/apache/manage_security.sls

44 lines
1.2 KiB
Plaintext
Raw Normal View History

{% from "apache/map.jinja" import apache with context %}
include:
- apache
2017-01-08 13:45:36 +01:00
{% if grains['os_family']=="Debian" %}
{% if salt['file.file_exists' ]('/etc/apache2/conf-available/security.conf') %}
apache_security-block:
file.blockreplace:
- name: /etc/apache2/conf-available/security.conf
- marker_start: "# START managed zone -DO-NOT-EDIT-"
- marker_end: "# END managed zone --"
- append_if_not_found: True
- show_changes: True
- require:
- pkg: apache
- watch_in:
- module: apache-reload
{% for option, value in salt['pillar.get']('apache:security', {}).items() %}
apache_manage-security-{{ option }}:
file.accumulated:
- filename: /etc/apache2/conf-available/security.conf
- name: apache_manage-security-add-{{ option }}
- text: "{{ option }} {{ value }}"
- require_in:
- file: apache_security-block
{% endfor %}
{% endif %}
2017-01-08 13:45:36 +01:00
{% elif grains['os_family']=="FreeBSD" %}
{{ apache.confdir }}/security.conf:
file.managed:
- source: salt://apache/files/{{ salt['grains.get']('os_family') }}/security.conf.jinja
- mode: 644
- template: jinja
- require:
- pkg: apache
- watch_in:
- module: apache-restart
2015-12-16 14:42:59 +01:00
{% endif %}