From b2922935ff5bf1ad78eabad656bd70786c634996 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Mon, 22 May 2017 09:28:32 +0200 Subject: [PATCH] This should fix most of 2.3 issues reported in #545 & #586 (#612) * Fixes most of 2.3 issues reported in #545 & 586 --- target/postfix/master.cf | 38 +++++++++++++++++++------------------- target/start-mailserver.sh | 19 +++++++++++++++++-- test/tests.bats | 4 ++++ 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/target/postfix/master.cf b/target/postfix/master.cf index 008bc012..aac77a5b 100644 --- a/target/postfix/master.cf +++ b/target/postfix/master.cf @@ -7,7 +7,7 @@ # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args -# (yes) (yes) (yes) (never) (100) +# (yes) (yes) (no) (never) (100) # ========================================================================== smtp inet n - n - - smtpd @@ -22,32 +22,32 @@ submission inet n - n - - smtpd -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_relay_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -pickup fifo n - - 60 1 pickup +pickup fifo n - y 60 1 pickup -o content_filter= -o receive_override_options=no_header_body_checks -cleanup unix n - - - 0 cleanup +cleanup unix n - y - 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 +tlsmgr unix - - y 1000? 1 tlsmgr +rewrite unix - - y - - trivial-rewrite +bounce unix - - y - 0 bounce +defer unix - - y - 0 bounce +trace unix - - y - 0 bounce +verify unix - - y - 1 verify +flush unix n - y 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 +smtp unix - - y - - smtp +relay unix - - y - - smtp +showq unix n - y - - showq +error unix - - y - - error +retry unix - - y - - error +discard unix - - y - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp -anvil unix - - - - 1 anvil -scache unix - - - - 1 scache +anvil unix - - y - 1 anvil +scache unix - - y - 1 scache maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} @@ -73,7 +73,7 @@ policyd-spf unix - n n - 0 spawn # Amavis configuration # -smtp-amavis unix - - - - 2 smtp +smtp-amavis unix - - n - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 067196d0..94bddb6c 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -549,8 +549,16 @@ function _setup_dovecot_local_user() { echo ${domain} >> /tmp/vhost.tmp done else - notify 'warn' "'config/docker-mailserver/postfix-accounts.cf' is not provided. No mail account created." + notify 'inf' "'config/docker-mailserver/postfix-accounts.cf' is not provided. No mail account created." fi + + if [[ ! $(grep '@' /tmp/docker-mailserver/postfix-accounts.cf | grep '|') ]]; then + if [ $ENABLE_LDAP -eq 0 ]; then + notify 'fatal' "Unless using LDAP, you need at least 1 email account to start the server." + defunc + fi + fi + } function _setup_ldap() { @@ -1096,10 +1104,17 @@ function _misc_save_states() { ln -s $dest $d fi done + + notify 'inf' 'Fixing /var/mail-state/* permissions' + chown -R clamav /var/mail-state/lib-clamav + chown -R postfix /var/mail-state/lib-postfix + chown -R postgrey /var/mail-state/lib-postgrey + chown -R debian-spamd /var/mail-state/lib-spamassasin + chown -R postfix /var/mail-state/spool-postfix + fi } - ########################################################################## # >> Start Daemons ########################################################################## diff --git a/test/tests.bats b/test/tests.bats index 3114ca2d..05c73536 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -744,6 +744,10 @@ load 'test_helper/bats-assert/load' assert_failure run docker exec mail grep -i '(!)connect' /var/log/mail/mail.log assert_failure + run docker exec mail grep -i 'backwards-compatible default setting chroot=y' /var/log/mail/mail.log + assert_failure + run docker exec mail grep -i 'connect to 127.0.0.1:10023: Connection refused' /var/log/mail/mail.log + assert_failure run docker exec mail_pop3 grep 'non-null host address bits in' /var/log/mail/mail.log assert_failure run docker exec mail_pop3 grep ': error:' /var/log/mail/mail.log