Hostname override fixes for docker option --net=host in conjunction with OVERRIDE_HOSTNAME (#517)

* Fixed wrong mail headers when using OVERRIDE_HOSTNAME by setting the the hostname explicitly

* Added tests and fixed hostname in dovecot conf

* Added missing tests

* Improved function naming and task notification message
This commit is contained in:
Florian 2017-02-13 11:07:30 +01:00 committed by Thomas VIAL
parent 4189374cb5
commit 7e4e3662b3
3 changed files with 76 additions and 1 deletions

View file

@ -104,6 +104,9 @@ function register_functions() {
_register_setup_function "_setup_mailname"
_register_setup_function "_setup_amavis"
_register_setup_function "_setup_dmarc_hostname"
_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_hostname() {
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'
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/dovecot/conf.d/15-lda.conf"
sed -i 's/^#hostname =.*$/hostname = '$HOSTNAME'/g' /etc/dovecot/conf.d/15-lda.conf
}
function _setup_dovecot() {
notify 'task' 'Setting up Dovecot'