Compare commits
2 Commits
master
...
freebsd-su
Author | SHA1 | Date | |
---|---|---|---|
|
c1ed7f30b7 | ||
|
f5990cfbfc |
@ -1,19 +1,21 @@
|
||||
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
|
||||
|
7
postfix/defaults.yaml
Normal file
7
postfix/defaults.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
postfix:
|
||||
package: 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 -#}
|
||||
|
@ -1,36 +1,12 @@
|
||||
{% set postfix = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'package': 'postfix',
|
||||
'policyd_spf_pkg': 'postfix-policyd-spf-python',
|
||||
'postsrsd_pkg': 'postsrsd',
|
||||
'postgrey_pkg': 'postgrey',
|
||||
'pcre_pkg': 'postfix-pcre',
|
||||
'mysql_pkg': 'postfix-mysql',
|
||||
'service': 'postfix',
|
||||
'aliases_file': '/etc/aliases',
|
||||
},
|
||||
'Gentoo': {
|
||||
'package': 'mail-mta/postfix',
|
||||
'policyd_spf_pkg': 'mail-filter/pypolicyd-spf',
|
||||
'postsrsd_pkg': 'mail-filter/postsrsd',
|
||||
'postgrey_pkg': 'mail-filter/postgrey',
|
||||
'service': 'postfix',
|
||||
'aliases_file': '/etc/mail/aliases',
|
||||
},
|
||||
'RedHat': {
|
||||
'package': 'postfix',
|
||||
'policyd_spf_pkg': 'pypolicyd-spf',
|
||||
'postsrsd_pkg': 'postsrsd',
|
||||
'postgrey_pkg': 'postgrey',
|
||||
'service': 'postfix',
|
||||
'aliases_file': '/etc/aliases',
|
||||
},
|
||||
'Arch' : {
|
||||
'package': 'postfix',
|
||||
'policyd_spf_pkg': 'python-postfix-policyd-spf',
|
||||
'postsrsd_pkg': 'postsrsd',
|
||||
'postgrey_pkg': 'postgrey',
|
||||
'service': 'postfix',
|
||||
'aliases_file': '/etc/aliases',
|
||||
},
|
||||
}, merge=salt['pillar.get']('postfix:lookup')) %}
|
||||
{% import_yaml "postfix/defaults.yaml" as defaults %}
|
||||
{% import_yaml "postfix/osmap.yaml" as osmap %}
|
||||
|
||||
{% set postfix = salt['grains.filter_by'](
|
||||
defaults,
|
||||
merge=salt['grains.filter_by'](
|
||||
osmap,
|
||||
grain='os',
|
||||
merge=salt['pillar.get']('postfix:lookup', {}),
|
||||
),
|
||||
base='postfix')
|
||||
%}
|
||||
|
28
postfix/osmap.yaml
Normal file
28
postfix/osmap.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
Debian:
|
||||
policyd_spf_pkg: postfix-policyd-spf-python
|
||||
postsrsd_pkg: postsrsd
|
||||
postgrey_pkg: postgrey
|
||||
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
|
||||
postsrsd_pkg: mail-filter/postsrsd
|
||||
postgrey_pkg: mail-filter/postgrey
|
||||
aliases_file: /etc/mail/aliases
|
||||
|
||||
RedHat:
|
||||
policyd_spf_pkg: pypolicyd-spf
|
||||
postsrsd_pkg: postsrsd
|
||||
postgrey_pkg: postgrey
|
||||
|
||||
Arch:
|
||||
policyd_spf_pkg: python-postfix-policyd-spf
|
||||
postsrsd_pkg: postsrsd
|
||||
postgrey_pkg: postgrey
|
||||
|
Loading…
Reference in New Issue
Block a user