From 8de15b6a57bf03039fdffebfe76713088f9be4bb Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Sat, 19 Mar 2016 17:45:42 +0100 Subject: [PATCH] Checking configuration --- Makefile | 20 +++++++------------- postfix/accounts.cf | 3 ++- postfix/virtual | 9 ++------- target/usr/local/bin/start-mailserver.sh | 2 +- test/{ => postfix}/accounts.cf | 0 test/{ => postfix}/main.cf | 0 test/{ => postfix}/virtual | 0 test/spamassassin/rules.cf | 1 + 8 files changed, 13 insertions(+), 22 deletions(-) rename test/{ => postfix}/accounts.cf (100%) rename test/{ => postfix}/main.cf (100%) rename test/{ => postfix}/virtual (100%) create mode 100644 test/spamassassin/rules.cf diff --git a/Makefile b/Makefile index aed0b797..8ca1ec29 100644 --- a/Makefile +++ b/Makefile @@ -7,14 +7,10 @@ build: docker build --no-cache -t $(NAME) . run: - # Copy test files - cp test/accounts.cf postfix/ - cp test/main.cf postfix/ - cp test/virtual postfix/ # Run containers docker run -d --name mail \ - -v "`pwd`/postfix":/tmp/postfix \ - -v "`pwd`/spamassassin":/tmp/spamassassin \ + -v "`pwd`/test/postfix":/tmp/postfix \ + -v "`pwd`/test/spamassassin":/tmp/spamassassin \ -v "`pwd`/test":/tmp/test \ -e SA_TAG=1.0 \ -e SA_TAG2=2.0 \ @@ -22,14 +18,14 @@ run: -e SASL_PASSWD=testing \ -h mail.my-domain.com -t $(NAME) docker run -d --name mail_pop3 \ - -v "`pwd`/postfix":/tmp/postfix \ - -v "`pwd`/spamassassin":/tmp/spamassassin \ + -v "`pwd`/test/postfix":/tmp/postfix \ + -v "`pwd`/test/spamassassin":/tmp/spamassassin \ -v "`pwd`/test":/tmp/test \ -e ENABLE_POP3=1 \ -h mail.my-domain.com -t $(NAME) docker run -d --name mail_smtponly \ - -v "`pwd`/postfix":/tmp/postfix \ - -v "`pwd`/spamassassin":/tmp/spamassassin \ + -v "`pwd`/test/postfix":/tmp/postfix \ + -v "`pwd`/test/spamassassin":/tmp/spamassassin \ -v "`pwd`/test":/tmp/test \ -e SMTP_ONLY=1 \ -h mail.my-domain.com -t $(NAME) @@ -45,14 +41,12 @@ fixtures: docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/existing-user.txt" docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/test/email-templates/non-existing-user.txt" # Wait for mails to be analyzed - sleep 10 + sleep 30 tests: # Start tests ./test/bats/bats test/tests.bats clean: - # Get default files back - git checkout postfix/accounts.cf postfix/main.cf postfix/virtual # Remove running test containers docker rm -f mail mail_pop3 mail_smtponly diff --git a/postfix/accounts.cf b/postfix/accounts.cf index ecb0f063..8f209cc6 100644 --- a/postfix/accounts.cf +++ b/postfix/accounts.cf @@ -1 +1,2 @@ -user@domain.tld|mypassword +user1@localhost.localdomain|mypassword +user2@otherdomain.tld|mypassword diff --git a/postfix/virtual b/postfix/virtual index ca220715..e93eb8fb 100644 --- a/postfix/virtual +++ b/postfix/virtual @@ -1,7 +1,2 @@ -# -# ALIAS => from alias@domain.tld (alias) to user@domain.tld (real account), space separated -# alias@domain.tld user@domain.tld -# -# FORWARD => from redirect@domain.tld to a list of internal/external email addresses, space separated -# redirect@domain.tld otheruser@domain.tld otheruser@otherdomain.tld -# +alias1@localhost.localdomain user1@localhost.localdomain +alias2@localhost.localdomain external1@otherdomain.tld diff --git a/target/usr/local/bin/start-mailserver.sh b/target/usr/local/bin/start-mailserver.sh index 46f1ff45..4ff2abff 100644 --- a/target/usr/local/bin/start-mailserver.sh +++ b/target/usr/local/bin/start-mailserver.sh @@ -263,8 +263,8 @@ if [ "$ENABLE_POP3" = 1 -a "$SMTP_ONLY" != 1 ]; then /etc/init.d/courier-pop-ssl start fi -/etc/init.d/spamassassin start /etc/init.d/clamav-daemon start +/etc/init.d/spamassassin start /etc/init.d/amavis start /etc/init.d/opendkim start /etc/init.d/opendmarc start diff --git a/test/accounts.cf b/test/postfix/accounts.cf similarity index 100% rename from test/accounts.cf rename to test/postfix/accounts.cf diff --git a/test/main.cf b/test/postfix/main.cf similarity index 100% rename from test/main.cf rename to test/postfix/main.cf diff --git a/test/virtual b/test/postfix/virtual similarity index 100% rename from test/virtual rename to test/postfix/virtual diff --git a/test/spamassassin/rules.cf b/test/spamassassin/rules.cf new file mode 100644 index 00000000..891e84ff --- /dev/null +++ b/test/spamassassin/rules.cf @@ -0,0 +1 @@ +# Place you custom Spamassasin rules here \ No newline at end of file