From a2772c83ad69a100aaf204b0a03ed11fe2115b55 Mon Sep 17 00:00:00 2001 From: Florian Lehne Date: Fri, 10 Feb 2017 12:11:49 +0100 Subject: [PATCH] Fixed wrong mail headers when using OVERRIDE_HOSTNAME by setting the the hostname explicitly --- target/start-mailserver.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index d0e83fd9..67a03577 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -104,6 +104,9 @@ function register_functions() { _register_setup_function "_setup_mailname" _register_setup_function "_setup_amavis" + _register_setup_function "_setup_dmarc" + _register_setup_function "_setup_postfix_hostname" + _register_setup_function "_setup_dovecot_hostname" _register_setup_function "_setup_postfix_override_configuration" _register_setup_function "_setup_postfix_sasl_password" @@ -395,6 +398,29 @@ function _setup_amavis() { sed -i 's/^#\$myhostname = "mail.example.com";/\$myhostname = "'$HOSTNAME'";/' /etc/amavis/conf.d/05-node_id } +function _setup_dmarc() { + notify 'task' 'Setting up dmarc' + + notify 'inf' "Applying hostname to /etc/opendmarc.conf" + sed -i -e 's/^AuthservID.*$/AuthservID '$HOSTNAME'/g' \ + -e 's/^TrustedAuthservIDs.*$/TrustedAuthservIDs '$HOSTNAME'/g' /etc/opendmarc.conf +} + +function _setup_postfix_hostname() { + notify 'task' 'Applying hostname and domainname to postfix/main.cf' + + notify 'inf' "Applying hostname to /etc/postfix/main.cf" + postconf -e "myhostname = $HOSTNAME" + postconf -e "mydomain = $DOMAINNAME" +} + +function _setup_dovecot_hostname() { + notify 'task' 'Applying hostname to Dovecot' + + notify 'inf' "Applying hostname to /etc/postfix/main.cf" + sed -e 's/^#hostname =.*$/hostname = '$HOSTNAME'/g' /etc/dovecot/conf.d/15-lda.conf +} + function _setup_dovecot() { notify 'task' 'Setting up Dovecot'