selective service disable (#250)
* Allow disabling amavis service Setting the `DISABLE_AMAVIS=1` env var will skip the starting of the amavis process. * Enable option to not run spamassassin Setting the `DISABLE_SPAMASSASSIN=1` env var will start this container without spamassain. * Allow starting of the container without clamav Setting the `DISABLE_CLAMAV=1` env var will start this container without starting clamav.
This commit is contained in:
parent
bfecb65947
commit
4872d0e777
20
Makefile
20
Makefile
|
@ -48,6 +48,24 @@ run:
|
||||||
-e ENABLE_FAIL2BAN=1 \
|
-e ENABLE_FAIL2BAN=1 \
|
||||||
--cap-add=NET_ADMIN \
|
--cap-add=NET_ADMIN \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-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)
|
||||||
|
sleep 20
|
||||||
|
docker run -d --name mail_disabled_spamassassin \
|
||||||
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
|
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||||
|
-e DISABLE_SPAMASSASSIN=1 \
|
||||||
|
-h mail.my-domain.com -t $(NAME)
|
||||||
|
sleep 20
|
||||||
|
docker run -d --name mail_disabled_clamav \
|
||||||
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
|
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||||
|
-e DISABLE_CLAMAV=1 \
|
||||||
|
-h mail.my-domain.com -t $(NAME)
|
||||||
# Wait for containers to fully start
|
# Wait for containers to fully start
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
|
@ -77,4 +95,4 @@ tests:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
# Remove running test containers
|
# 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 mail_disabled_spamassassin mail_disabled_clamav
|
||||||
|
|
|
@ -326,9 +326,15 @@ if [ -f /tmp/docker-mailserver/dovecot.cf ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start services related to SMTP
|
# Start services related to SMTP
|
||||||
/etc/init.d/spamassassin start
|
if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then
|
||||||
/etc/init.d/clamav-daemon start
|
/etc/init.d/spamassassin start
|
||||||
/etc/init.d/amavis start
|
fi
|
||||||
|
if ! [ "$DISABLE_CLAMAV" = 1 ]; then
|
||||||
|
/etc/init.d/clamav-daemon start
|
||||||
|
fi
|
||||||
|
if ! [ "$DISABLE_AMAVIS" = 1 ]; then
|
||||||
|
/etc/init.d/amavis start
|
||||||
|
fi
|
||||||
/etc/init.d/opendkim start
|
/etc/init.d/opendkim start
|
||||||
/etc/init.d/opendmarc start
|
/etc/init.d/opendmarc start
|
||||||
/etc/init.d/postfix start
|
/etc/init.d/postfix start
|
||||||
|
|
|
@ -37,6 +37,21 @@
|
||||||
[ "$status" -eq 0 ]
|
[ "$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 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "checking process: spamassassin (spamassassin disabled by DISABLE_SPAMASSASSIN)" {
|
||||||
|
run docker exec mail_disabled_spamassassin /bin/bash -c "ps aux --forest | grep -v grep | grep ''/usr/sbin/spamd'"
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "checking process: clamav (clamav disabled by DISABLE_CLAMAV)" {
|
||||||
|
run docker exec mail_disabled_clamav /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# imap
|
# imap
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue