From a350266b2c537527d0115f94697160474af0dbfc Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 3 Dec 2022 00:05:37 +0100 Subject: [PATCH] updated postfix state --- states/postfix/defaults.yaml | 2 +- states/postfix/maps.sls | 8 ++++ states/postfix/templates/master.cf.j2 | 68 +++++++++++++++------------ 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/states/postfix/defaults.yaml b/states/postfix/defaults.yaml index 28a2cfb..5f1ef19 100644 --- a/states/postfix/defaults.yaml +++ b/states/postfix/defaults.yaml @@ -4,7 +4,7 @@ postfix: base_dir: '/etc/postfix' pkgs: - postfix - db: None + db: config: main: alias_database: 'hash:/etc/aliases' diff --git a/states/postfix/maps.sls b/states/postfix/maps.sls index f0bdc97..5cadcd2 100644 --- a/states/postfix/maps.sls +++ b/states/postfix/maps.sls @@ -28,8 +28,16 @@ postfix-transport: cmd.run: - name: postmap transport - cwd: {{ postfix.base_dir }} + - success_stdout: + - "" + - success_retcodes: + - 0 postfix-sender-access: cmd.run: - name: postmap sender_access - cwd: {{ postfix.base_dir }} + #- success_stdout: + # - "" + - success_retcodes: + - 0 diff --git a/states/postfix/templates/master.cf.j2 b/states/postfix/templates/master.cf.j2 index 14c550b..819dd2a 100644 --- a/states/postfix/templates/master.cf.j2 +++ b/states/postfix/templates/master.cf.j2 @@ -1,49 +1,57 @@ ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} -smtp inet n - - - - smtpd -pickup unix n - - 60 1 pickup -cleanup unix n - - - 0 cleanup -qmgr unix n - n 300 1 qmgr -tlsmgr unix - - - 1000? 1 tlsmgr -rewrite unix - - - - - trivial-rewrite -bounce unix - - - - 0 bounce -defer unix - - - - 0 bounce -trace unix - - - - 0 bounce -verify unix - - - - 1 verify -flush unix n - - 1000? 0 flush -proxymap unix - - n - - proxymap -proxywrite unix - - n - 1 proxymap -smtp unix - - - - - smtp -relay unix - - - - - smtp -showq unix n - - - - showq -error unix - - - - - error -retry unix - - - - - error -discard unix - - - - - discard -local unix - n n - - local -virtual unix - n n - - virtual -lmtp unix - - - - - lmtp -anvil unix - - - - 1 anvil -scache unix - - - - 1 scache +smtp inet n - - - - smtpd +pickup unix n - - 60 1 pickup +cleanup unix n - - - 0 cleanup +qmgr unix n - n 300 1 qmgr +tlsmgr unix - - - 1000? 1 tlsmgr +rewrite unix - - - - - trivial-rewrite +bounce unix - - - - 0 bounce +defer unix - - - - 0 bounce +trace unix - - - - 0 bounce +verify unix - - - - 1 verify +flush unix n - - 1000? 0 flush +proxymap unix - - n - - proxymap +proxywrite unix - - n - 1 proxymap +smtp unix - - - - - smtp +relay unix - - - - - smtp +showq unix n - - - - showq +error unix - - - - - error +retry unix - - - - - error +discard unix - - - - - discard +local unix - n n - - local +virtual unix - n n - - virtual +lmtp unix - - - - - lmtp +anvil unix - - - - 1 anvil +scache unix - - - - 1 scache -smtps inet n - n - - smtpd +submission inet n - n - - smtpd + -o smtpd_tls_wrappermode=yes + -o smtpd_sasl_auth_enable=yes + -o smtpd_client_restrictions=permit_sasl_authenticated,reject + -o milter_macro_daemon_name=ORIGINATING + -o smtpd_tls_security_level=encrypt + -o smtpd_tls_auth_only=yes + +smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -dovecot unix - n n - - pipe +dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} -maildrop unix - n n - - pipe +maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} -uucp unix - n n - - pipe +uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) -maildb unix - n n - - pipe +maildb unix - n n - - pipe flags=DROhu user=vmail:vmail argv=/usr/local/apps/maildb/maildb.py --config /usr/local/apps/config/common.ini ${sender} ${original_recipient} -127.0.0.1:10025 inet n - n - - smtpd +127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -o mynetworks=127.0.0.0/8 -o smtpd_recipient_restrictions=permit_mynetworks,reject \ No newline at end of file