From 3fd2f365a9422b9438470022c1804b414b42e40b Mon Sep 17 00:00:00 2001 From: Kyle Ondy Date: Thu, 4 Aug 2016 13:05:34 -0400 Subject: [PATCH] Allow disabling amavis service Setting the `DISABLE_AMAVIS=1` env var will skip the starting of the amavis process. --- Makefile | 8 +++++++- target/start-mailserver.sh | 4 +++- test/tests.bats | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b2f97842..4c58adaf 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,12 @@ run: -e ENABLE_FAIL2BAN=1 \ --cap-add=NET_ADMIN \ -h mail.my-domain.com -t $(NAME) + sleep 20 + docker run -d --name mail_disabled_amavis \ + -v "`pwd`/test/config":/tmp/docker-mailserver \ + -v "`pwd`/test":/tmp/docker-mailserver-test \ + -e DISABLE_AMAVIS=1 \ + -h mail.my-domain.com -t $(NAME) # Wait for containers to fully start sleep 20 @@ -77,4 +83,4 @@ tests: clean: # Remove running test containers - docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer + docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 31bdae72..7b7aa1c3 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -328,7 +328,9 @@ fi # Start services related to SMTP /etc/init.d/spamassassin start /etc/init.d/clamav-daemon start -/etc/init.d/amavis start +if ! [ "$DISABLE_AMAVIS" = 1 ]; then + /etc/init.d/amavis start +fi /etc/init.d/opendkim start /etc/init.d/opendmarc start /etc/init.d/postfix start diff --git a/test/tests.bats b/test/tests.bats index 724a3058..34a498cd 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -37,6 +37,11 @@ [ "$status" -eq 0 ] } +@test "checking process: amavis (amavis disabled by DISABLE_AMAVIS)" { + run docker exec mail_disabled_amavis /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/amavisd-new'" + [ "$status" -eq 1 ] +} + # # imap #