You've already forked docker-mailserver
mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-08 23:06:49 +02:00
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:
@ -14,6 +14,44 @@ load 'test_helper/bats-assert/load'
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking configuration: hostname/domainname override: check container hostname is applied correctly" {
|
||||
run docker exec mail_override_hostname /bin/bash -c "hostname | grep unknown.domain.tld"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking configuration: hostname/domainname override: check overriden hostname is applied to all configs" {
|
||||
run docker exec mail_override_hostname /bin/bash -c "cat /etc/mailname | grep my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "postconf -n | grep mydomain | grep my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "postconf -n | grep myhostname | grep mail.my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "doveconf | grep hostname | grep mail.my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "cat /etc/opendmarc.conf | grep AuthservID | grep mail.my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "cat /etc/opendmarc.conf | grep TrustedAuthservIDs | grep mail.my-domain.com"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/bash -c "cat /etc/amavis/conf.d/05-node_id | grep myhostname | grep mail.my-domain.com"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking configuration: hostname/domainname override: check hostname in postfix HELO message" {
|
||||
run docker exec mail_override_hostname /bin/bash -c "nc -w 1 0.0.0.0 25 | grep mail.my-domain.com"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking configuration: hostname/domainname override: check headers of received mail" {
|
||||
run docker exec mail_override_hostname /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l | grep 1"
|
||||
assert_success
|
||||
run docker exec mail_override_hostname /bin/sh -c "cat /var/mail/localhost.localdomain/user1/new/* | grep mail.my-domain.com"
|
||||
assert_success
|
||||
|
||||
# test whether the container hostname is not found in received mail
|
||||
run docker exec mail_override_hostname /bin/sh -c "cat /var/mail/localhost.localdomain/user1/new/* | grep unknown.domain.tld"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
#
|
||||
# processes
|
||||
#
|
||||
|
Reference in New Issue
Block a user