FreeBSD support

This commit is contained in:
Alexander Weidinger 2017-12-08 02:54:21 +01:00
parent f5990cfbfc
commit c1ed7f30b7
4 changed files with 33 additions and 25 deletions

View File

@ -1,19 +1,21 @@
include: include:
- postfix - postfix
/etc/postfix: {% from "postfix/map.jinja" import postfix with context %}
{{ postfix.config_dir }}:
file.directory: file.directory:
- user: root - user: {{ postfix.root_user }}
- group: root - group: {{ postfix.root_group }}
- dir_mode: 755 - dir_mode: 755
- file_mode: 644 - file_mode: 644
- makedirs: True - makedirs: True
/etc/postfix/main.cf: {{ postfix.config_dir }}/main.cf:
file.managed: file.managed:
- source: salt://postfix/files/main.cf - source: salt://postfix/files/main.cf
- user: root - user: {{ postfix.root_user }}
- group: root - group: {{ postfix.root_group }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -22,10 +24,10 @@ include:
- template: jinja - template: jinja
{% if 'vmail' in pillar.get('postfix', '') %} {% if 'vmail' in pillar.get('postfix', '') %}
/etc/postfix/virtual_alias_maps.cf: {{ postfix.config_dir }}/virtual_alias_maps.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_alias_maps.cf - source: salt://postfix/files/virtual_alias_maps.cf
- user: root - user: {{ postfix.root_user }}
- group: postfix - group: postfix
- mode: 640 - mode: 640
- require: - require:
@ -34,10 +36,10 @@ include:
- service: postfix - service: postfix
- template: jinja - template: jinja
/etc/postfix/virtual_mailbox_domains.cf: {{ postfix.config_dir }}/virtual_mailbox_domains.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_mailbox_domains.cf - source: salt://postfix/files/virtual_mailbox_domains.cf
- user: root - user: {{ postfix.root_user }}
- group: postfix - group: postfix
- mode: 640 - mode: 640
- require: - require:
@ -46,10 +48,10 @@ include:
- service: postfix - service: postfix
- template: jinja - template: jinja
/etc/postfix/virtual_mailbox_maps.cf: {{ postfix.config_dir }}/virtual_mailbox_maps.cf:
file.managed: file.managed:
- source: salt://postfix/files/virtual_mailbox_maps.cf - source: salt://postfix/files/virtual_mailbox_maps.cf
- user: root - user: {{ postfix.root_user }}
- group: postfix - group: postfix
- mode: 640 - mode: 640
- require: - require:
@ -60,11 +62,11 @@ include:
{% endif %} {% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %} {% if salt['pillar.get']('postfix:manage_master_config', True) %}
/etc/postfix/master.cf: {{ postfix.config_dir }}/master.cf:
file.managed: file.managed:
- source: salt://postfix/files/master.cf - source: salt://postfix/files/master.cf
- user: root - user: {{ postfix.root_user }}
- group: root - group: {{ postfix.root_group }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -74,11 +76,11 @@ include:
{% endif %} {% endif %}
{% if 'transport' in pillar.get('postfix', '') %} {% if 'transport' in pillar.get('postfix', '') %}
/etc/postfix/transport: {{ postfix.config_dir }}/transport:
file.managed: file.managed:
- source: salt://postfix/files/transport - source: salt://postfix/files/transport
- user: root - user: {{ postfix.root_user }}
- group: root - group: {{ postfix.root_group }}
- mode: 644 - mode: 644
- require: - require:
- pkg: postfix - pkg: postfix
@ -88,10 +90,10 @@ include:
run-postmap: run-postmap:
cmd.wait: cmd.wait:
- name: /usr/sbin/postmap /etc/postfix/transport - name: /usr/sbin/postmap {{ postfix.config_dir }}/transport
- cwd: / - cwd: /
- watch: - watch:
- file: /etc/postfix/transport - file: {{ postfix.config_dir }}/transport
{% endif %} {% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %} {%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
@ -99,7 +101,7 @@ run-postmap:
postfix_{{ domain }}_ssl_certificate: postfix_{{ domain }}_ssl_certificate:
file.managed: file.managed:
- name: /etc/postfix/ssl/{{ domain }}.crt - name: {{ postfix.config_dir }}/ssl/{{ domain }}.crt
- makedirs: True - makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:public_cert - contents_pillar: postfix:certificates:{{ domain }}:public_cert
- watch_in: - watch_in:
@ -107,7 +109,7 @@ postfix_{{ domain }}_ssl_certificate:
postfix_{{ domain }}_ssl_key: postfix_{{ domain }}_ssl_key:
file.managed: file.managed:
- name: /etc/postfix/ssl/{{ domain }}.key - name: {{ postfix.config_dir }}/ssl/{{ domain }}.key
- mode: 600 - mode: 600
- makedirs: True - makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:private_key - contents_pillar: postfix:certificates:{{ domain }}:private_key

View File

@ -3,3 +3,5 @@ postfix:
service: postfix service: postfix
aliases_file: /etc/aliases aliases_file: /etc/aliases
config_dir: /etc/postfix config_dir: /etc/postfix
root_user: root
root_group: root

View File

@ -98,15 +98,15 @@ policy-spf_time_limit = {{ policyd_spf.get('time_limit', '3600s') }}
{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }} {{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }}
{% if 'virtual' in pillar.get('postfix','') %} {% if 'virtual' in pillar.get('postfix','') %}
virtual_alias_maps = hash:/etc/postfix/virtual virtual_alias_maps = hash:{{ postfix.config_dir }}/virtual
{% endif %} {% endif %}
{% if 'sasl_passwd' in pillar.get('postfix','') %} {% if 'sasl_passwd' in pillar.get('postfix','') %}
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_password_maps = hash:{{ postfix.config_dir }}/sasl_passwd
{% endif %} {% endif %}
{% if 'sender_canonical' in pillar.get('postfix','') %} {% if 'sender_canonical' in pillar.get('postfix','') %}
sender_canonical_maps = hash:/etc/postfix/sender_canonical sender_canonical_maps = hash:{{ postfix.config_dir }}/sender_canonical
{% endif %} {% endif %}
{# Accept arbitrary parameters -#} {# Accept arbitrary parameters -#}

View File

@ -5,6 +5,10 @@ Debian:
pcre_pkg: postfix-pcre pcre_pkg: postfix-pcre
mysql_pkg: postfix-mysql mysql_pkg: postfix-mysql
FreeBSD:
config_dir: /usr/local/etc/postfix
root_group: wheel
Gentoo: Gentoo:
package: mail-mta/postfix package: mail-mta/postfix
policyd_spf_pkg: mail-filter/pypolicyd-spf policyd_spf_pkg: mail-filter/pypolicyd-spf