1
1
Fork 0
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-05-19 14:16:06 +02:00

Disables clamav config in amavis when DISABLE_CLAMAV=1. Fixes #378 (#431)

This commit is contained in:
Thomas VIAL 2016-12-25 15:41:02 +01:00 committed by GitHub
parent 49b62aa1be
commit 63cf0f9965
3 changed files with 33 additions and 0 deletions

View File

@ -123,6 +123,7 @@ fixtures:
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-catchall-local.txt"
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-spam-folder.txt"
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/non-existing-user.txt"
docker exec mail_disabled_clamav /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user.txt"
# Wait for mails to be analyzed
sleep 10

View File

@ -744,6 +744,19 @@ function _setup_security_stack() {
SA_KILL=${SA_KILL:="6.31"} && sed -i -r 's/^\$sa_kill_level_deflt (.*);/\$sa_kill_level_deflt = '$SA_KILL';/g' /etc/amavis/conf.d/20-debian_defaults
test -e /tmp/docker-mailserver/spamassassin-rules.cf && cp /tmp/docker-mailserver/spamassassin-rules.cf /etc/spamassassin/
if [ "$DISABLE_CLAMAV" = 1 ]; then
notify 'inf' "Disabling clamav"
cat > /etc/amavis/conf.d/50-user-security <<- EOM
use strict;
@bypass_virus_checks_maps = ();
$undecipherable_subject_tag = undef;
1;
EOM
else
notify 'inf' "Enabling clamav"
echo "" > /etc/amavis/conf.d/50-user-security
fi
if [ "$ENABLE_FAIL2BAN" = 1 ]; then
notify 'inf' "Fail2ban enabled"
test -e /tmp/docker-mailserver/fail2ban-jail.cf && cp /tmp/docker-mailserver/fail2ban-jail.cf /etc/fail2ban/jail.local

View File

@ -292,6 +292,25 @@
[ "$status" -eq 0 ]
}
#
# clamav
#
@test "checking clamav: should be listed in amavis when enabled" {
run docker exec mail grep -i 'Found secondary av scanner ClamAV-clamscan' /var/log/mail/mail.log
[ "$status" -eq 0 ]
}
@test "checking clamav: should not be listed in amavis when disabled" {
run docker exec mail_disabled_clamav grep -i 'Found secondary av scanner ClamAV-clamscan' /var/log/mail/mail.log
[ "$status" -eq 1 ]
}
@test "checking clamav: should not be called when disabled" {
run docker exec mail_disabled_clamav grep -i 'connect to /var/run/clamav/clamd.ctl failed' /var/log/mail/mail.log
[ "$status" -eq 1 ]
}
#
# opendkim
#