From 0f7e7bb693b79c5a948015345cace2b5b6096e30 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Sat, 23 Jul 2016 21:01:01 +0200 Subject: [PATCH] Fixed #230 adding postifx configuration. Also added tests. --- Makefile | 1 + target/postfix/main.cf | 1 + test/email-templates/existing-alias-local.txt | 2 +- .../existing-user-and-cc-local-alias.txt | 13 +++++++++++++ test/tests.bats | 6 ++++-- 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 test/email-templates/existing-user-and-cc-local-alias.txt diff --git a/Makefile b/Makefile index 408f40fa..782b8c60 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ fixtures: docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-alias-external.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-alias-local.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user.txt" + docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user-and-cc-local-alias.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-external.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-local.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-spam-folder.txt" diff --git a/target/postfix/main.cf b/target/postfix/main.cf index 74194c9b..4ab8c0d9 100644 --- a/target/postfix/main.cf +++ b/target/postfix/main.cf @@ -49,6 +49,7 @@ smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject smtpd_sasl_auth_enable = yes smtpd_sasl_path = /var/spool/postfix/private/auth smtpd_sasl_type = dovecot +dovecot_destination_recipient_limit = 1 smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname diff --git a/test/email-templates/existing-alias-local.txt b/test/email-templates/existing-alias-local.txt index 97321ebe..99a5b6fb 100644 --- a/test/email-templates/existing-alias-local.txt +++ b/test/email-templates/existing-alias-local.txt @@ -3,7 +3,7 @@ MAIL FROM: user@external.tld RCPT TO: alias2@localhost.localdomain DATA From: Docker Mail Server -To: Existing Local User +To: Existing Local Alias Date: Sat, 22 May 2010 07:43:25 -0400 Subject: Test Message This is a test mail. diff --git a/test/email-templates/existing-user-and-cc-local-alias.txt b/test/email-templates/existing-user-and-cc-local-alias.txt new file mode 100644 index 00000000..1a0c0ccc --- /dev/null +++ b/test/email-templates/existing-user-and-cc-local-alias.txt @@ -0,0 +1,13 @@ +HELO mail.external.tld +MAIL FROM: user@external.tld +RCPT TO: user1@localhost.localdomain +DATA +From: Docker Mail Server +To: Existing Local User +Cc: Existing Local Alias +Date: Sat, 22 May 2010 07:43:25 -0400 +Subject: Test Message +This is a test mail. + +. +QUIT \ No newline at end of file diff --git a/test/tests.bats b/test/tests.bats index 430d1ffe..e1f37c27 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -131,7 +131,7 @@ @test "checking smtp: delivers mail to existing account" { run docker exec mail /bin/sh -c "grep 'status=sent (delivered via dovecot service)' /var/log/mail/mail.log | wc -l" [ "$status" -eq 0 ] - [ "$output" -eq 4 ] + [ "$output" -eq 5 ] } @test "checking smtp: delivers mail to existing alias" { @@ -149,7 +149,7 @@ @test "checking smtp: user1 should have received 3 mails" { run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l" [ "$status" -eq 0 ] - [ "$output" = 3 ] + [ "$output" = 4 ] } @test "checking smtp: rejects mail to unknown user" { @@ -427,6 +427,8 @@ @test "checking system: /var/log/mail/mail.log is error free" { run docker exec mail grep 'non-null host address bits in' /var/log/mail/mail.log [ "$status" -eq 1 ] + run docker exec mail grep 'mail system configuration error' /var/log/mail/mail.log + [ "$status" -eq 1 ] run docker exec mail grep ': error:' /var/log/mail/mail.log [ "$status" -eq 1 ] run docker exec mail_pop3 grep 'non-null host address bits in' /var/log/mail/mail.log