diff --git a/postfix/config.sls b/postfix/config.sls index 0554677..0215705 100644 --- a/postfix/config.sls +++ b/postfix/config.sls @@ -1,19 +1,20 @@ +{% from "postfix/map.jinja" import postfix with context %} include: - postfix -/etc/postfix: +{{ postfix.config_path }}: file.directory: - user: root - - group: root + - group: {{ postfix.root_grp }} - dir_mode: 755 - file_mode: 644 - makedirs: True -/etc/postfix/main.cf: +{{ postfix.config_path }}/main.cf: file.managed: - source: salt://postfix/files/main.cf - user: root - - group: root + - group: {{ postfix.root_grp }} - mode: 644 - require: - pkg: postfix @@ -22,7 +23,7 @@ include: - template: jinja {% if 'vmail' in pillar.get('postfix', '') %} -/etc/postfix/virtual_alias_maps.cf: +{{ postfix.config_path }}/virtual_alias_maps.cf: file.managed: - source: salt://postfix/files/virtual_alias_maps.cf - user: root @@ -34,7 +35,7 @@ include: - service: postfix - template: jinja -/etc/postfix/virtual_mailbox_domains.cf: +{{ postfix.config_path }}/virtual_mailbox_domains.cf: file.managed: - source: salt://postfix/files/virtual_mailbox_domains.cf - user: root @@ -46,7 +47,7 @@ include: - service: postfix - template: jinja -/etc/postfix/virtual_mailbox_maps.cf: +{{ postfix.config_path }}/virtual_mailbox_maps.cf: file.managed: - source: salt://postfix/files/virtual_mailbox_maps.cf - user: root @@ -60,11 +61,11 @@ include: {% endif %} {% if salt['pillar.get']('postfix:manage_master_config', True) %} -/etc/postfix/master.cf: +{{ postfix.config_path }}/master.cf: file.managed: - source: salt://postfix/files/master.cf - user: root - - group: root + - group: {{ postfix.root_grp }} - mode: 644 - require: - pkg: postfix @@ -74,11 +75,11 @@ include: {% endif %} {% if 'transport' in pillar.get('postfix', '') %} -/etc/postfix/transport: +{{ postfix.config_path }}/transport: file.managed: - source: salt://postfix/files/transport - user: root - - group: root + - group: {{ postfix.root_grp }} - mode: 644 - require: - pkg: postfix @@ -88,10 +89,10 @@ include: run-postmap: cmd.wait: - - name: /usr/sbin/postmap /etc/postfix/transport + - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/transport - cwd: / - watch: - - file: /etc/postfix/transport + - file: {{ postfix.config_path }}/transport {% endif %} {%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %} @@ -99,7 +100,7 @@ run-postmap: postfix_{{ domain }}_ssl_certificate: file.managed: - - name: /etc/postfix/ssl/{{ domain }}.crt + - name: {{ postfix.config_path }}/ssl/{{ domain }}.crt - makedirs: True - contents_pillar: postfix:certificates:{{ domain }}:public_cert - watch_in: @@ -107,7 +108,7 @@ postfix_{{ domain }}_ssl_certificate: postfix_{{ domain }}_ssl_key: file.managed: - - name: /etc/postfix/ssl/{{ domain }}.key + - name: {{ postfix.config_path }}/ssl/{{ domain }}.key - mode: 600 - makedirs: True - contents_pillar: postfix:certificates:{{ domain }}:private_key diff --git a/postfix/files/master.cf b/postfix/files/master.cf index 0238620..c993a80 100644 --- a/postfix/files/master.cf +++ b/postfix/files/master.cf @@ -133,5 +133,5 @@ scache unix - - n - 1 scache # ${nexthop} ${user} {% if salt['pillar.get']('postfix:policyd-spf:enabled', False) %} policy-spf unix - n n - - spawn - user=nobody argv=/usr/bin/policyd-spf + user=nobody argv={{ xbin_prefix }}/bin/policyd-spf {%- endif %} diff --git a/postfix/init.sls b/postfix/init.sls index 8d364ee..6642bb6 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -33,7 +33,7 @@ postfix_alias_database: - name: {{ file_path }} - source: salt://postfix/aliases - user: root - - group: root + - group: {{ postfix.root_grp }} - mode: 644 - template: jinja - require: @@ -77,7 +77,7 @@ postfix_{{ mapping }}: - name: {{ file_path }} - source: salt://postfix/files/mapping.j2 - user: root - - group: root + - group: {{ postfix.root_grp }} {%- if mapping.endswith('_sasl_password_maps') %} - mode: 600 {%- else %} @@ -90,7 +90,7 @@ postfix_{{ mapping }}: - pkg: postfix {%- if need_postmap %} cmd.wait: - - name: /usr/sbin/postmap {{ file_path }} + - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ file_path }} - cwd: / - watch: - file: {{ file_path }}