Commit c1ed7f30 authored by Alexander Weidinger's avatar Alexander Weidinger
Browse files

FreeBSD support

parent f5990cfb
include:
- postfix
/etc/postfix:
{% from "postfix/map.jinja" import postfix with context %}
{{ postfix.config_dir }}:
file.directory:
- user: root
- group: root
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- dir_mode: 755
- file_mode: 644
- makedirs: True
/etc/postfix/main.cf:
{{ postfix.config_dir }}/main.cf:
file.managed:
- source: salt://postfix/files/main.cf
- user: root
- group: root
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- mode: 644
- require:
- pkg: postfix
......@@ -22,10 +24,10 @@ include:
- template: jinja
{% if 'vmail' in pillar.get('postfix', '') %}
/etc/postfix/virtual_alias_maps.cf:
{{ postfix.config_dir }}/virtual_alias_maps.cf:
file.managed:
- source: salt://postfix/files/virtual_alias_maps.cf
- user: root
- user: {{ postfix.root_user }}
- group: postfix
- mode: 640
- require:
......@@ -34,10 +36,10 @@ include:
- service: postfix
- template: jinja
/etc/postfix/virtual_mailbox_domains.cf:
{{ postfix.config_dir }}/virtual_mailbox_domains.cf:
file.managed:
- source: salt://postfix/files/virtual_mailbox_domains.cf
- user: root
- user: {{ postfix.root_user }}
- group: postfix
- mode: 640
- require:
......@@ -46,10 +48,10 @@ include:
- service: postfix
- template: jinja
/etc/postfix/virtual_mailbox_maps.cf:
{{ postfix.config_dir }}/virtual_mailbox_maps.cf:
file.managed:
- source: salt://postfix/files/virtual_mailbox_maps.cf
- user: root
- user: {{ postfix.root_user }}
- group: postfix
- mode: 640
- require:
......@@ -60,11 +62,11 @@ include:
{% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %}
/etc/postfix/master.cf:
{{ postfix.config_dir }}/master.cf:
file.managed:
- source: salt://postfix/files/master.cf
- user: root
- group: root
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- mode: 644
- require:
- pkg: postfix
......@@ -74,11 +76,11 @@ include:
{% endif %}
{% if 'transport' in pillar.get('postfix', '') %}
/etc/postfix/transport:
{{ postfix.config_dir }}/transport:
file.managed:
- source: salt://postfix/files/transport
- user: root
- group: root
- user: {{ postfix.root_user }}
- group: {{ postfix.root_group }}
- mode: 644
- require:
- pkg: postfix
......@@ -88,10 +90,10 @@ include:
run-postmap:
cmd.wait:
- name: /usr/sbin/postmap /etc/postfix/transport
- name: /usr/sbin/postmap {{ postfix.config_dir }}/transport
- cwd: /
- watch:
- file: /etc/postfix/transport
- file: {{ postfix.config_dir }}/transport
{% endif %}
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
......@@ -99,7 +101,7 @@ run-postmap:
postfix_{{ domain }}_ssl_certificate:
file.managed:
- name: /etc/postfix/ssl/{{ domain }}.crt
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.crt
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:public_cert
- watch_in:
......@@ -107,7 +109,7 @@ postfix_{{ domain }}_ssl_certificate:
postfix_{{ domain }}_ssl_key:
file.managed:
- name: /etc/postfix/ssl/{{ domain }}.key
- name: {{ postfix.config_dir }}/ssl/{{ domain }}.key
- mode: 600
- makedirs: True
- contents_pillar: postfix:certificates:{{ domain }}:private_key
......
......@@ -3,3 +3,5 @@ postfix:
service: postfix
aliases_file: /etc/aliases
config_dir: /etc/postfix
root_user: root
root_group: root
......@@ -98,15 +98,15 @@ policy-spf_time_limit = {{ policyd_spf.get('time_limit', '3600s') }}
{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }}
{% if 'virtual' in pillar.get('postfix','') %}
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_maps = hash:{{ postfix.config_dir }}/virtual
{% endif %}
{% 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 %}
{% 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 %}
{# Accept arbitrary parameters -#}
......
......@@ -5,6 +5,10 @@ Debian:
pcre_pkg: postfix-pcre
mysql_pkg: postfix-mysql
FreeBSD:
config_dir: /usr/local/etc/postfix
root_group: wheel
Gentoo:
package: mail-mta/postfix
policyd_spf_pkg: mail-filter/pypolicyd-spf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment