From ec6e5eea3958bd5a04ae911fb51230de20581d2c Mon Sep 17 00:00:00 2001 From: Michael Als Date: Wed, 12 Apr 2017 17:59:04 +0200 Subject: [PATCH] Include whitelist_clients.local in postgrey setup from config folder (#564) --- target/start-mailserver.sh | 1 + test/config/whitelist_clients.local | 1 + test/nc_templates/postgrey_whitelist.txt | 9 +++++++++ test/tests.bats | 8 ++++++++ 4 files changed, 19 insertions(+) create mode 100644 test/config/whitelist_clients.local create mode 100644 test/nc_templates/postgrey_whitelist.txt diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index d4b4f543..7fc58059 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -540,6 +540,7 @@ function _setup_postgrey() { if [ $TEXT_FOUND -eq 0 ]; then printf "POSTGREY_TEXT=\"$POSTGREY_TEXT\"\n\n" >> /etc/default/postgrey fi + cp -f /tmp/docker-mailserver/whitelist_clients.local /etc/postgrey/whitelist_clients.local } diff --git a/test/config/whitelist_clients.local b/test/config/whitelist_clients.local new file mode 100644 index 00000000..409d5a32 --- /dev/null +++ b/test/config/whitelist_clients.local @@ -0,0 +1 @@ +whitelist.tld diff --git a/test/nc_templates/postgrey_whitelist.txt b/test/nc_templates/postgrey_whitelist.txt new file mode 100644 index 00000000..aa065ebc --- /dev/null +++ b/test/nc_templates/postgrey_whitelist.txt @@ -0,0 +1,9 @@ +request=smtpd_access_policy +protocol_state=RCPT +protocol_name=ESMTP +client_address=127.0.0.1 +client_name=whitelist.tld +helo_name=whitelist.tld +sender=test@whitelist.tld +recipient=user1@localhost.localdomain + diff --git a/test/tests.bats b/test/tests.bats index df632df8..9e7a4f65 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -169,6 +169,14 @@ load 'test_helper/bats-assert/load' assert_output 1 } +@test "checking postgrey: there should be a log entry about the whitelisted and passed e-mail user@whitelist.tld in /var/log/mail/mail.log" { + run docker exec mail_with_postgrey /bin/sh -c "nc 0.0.0.0 10023 < /tmp/docker-mailserver-test/nc_templates/postgrey_whitelist.txt" + sleep 8 + run docker exec mail_with_postgrey /bin/sh -c "grep -i 'action=pass, reason=client whitelist' /var/log/mail/mail.log | wc -l" + assert_success + assert_output 1 +} + # # imap #