mirror of
https://github.com/docker-mailserver/docker-mailserver
synced 2025-09-02 16:00:53 +02:00
Changed string to int
This commit is contained in:
parent
b217ae2983
commit
b01e6b285f
@ -7,18 +7,18 @@
|
||||
# Example: DEFAULT_VARS["KEY"]="VALUE"
|
||||
##########################################################################
|
||||
declare -A DEFAULT_VARS
|
||||
DEFAULT_VARS["ENABLE_CLAMAV"]="${ENABLE_CLAMAV:="0"}"
|
||||
DEFAULT_VARS["ENABLE_SPAMASSASSIN"]="${ENABLE_SPAMASSASSIN:="0"}"
|
||||
DEFAULT_VARS["ENABLE_POP3"]="${ENABLE_POP3:="0"}"
|
||||
DEFAULT_VARS["ENABLE_FAIL2BAN"]="${ENABLE_FAIL2BAN:="0"}"
|
||||
DEFAULT_VARS["ENABLE_MANAGESIEVE"]="${ENABLE_MANAGESIEVE:="0"}"
|
||||
DEFAULT_VARS["ENABLE_FETCHMAIL"]="${ENABLE_FETCHMAIL:="0"}"
|
||||
DEFAULT_VARS["ENABLE_LDAP"]="${ENABLE_LDAP:="0"}"
|
||||
DEFAULT_VARS["ENABLE_SASLAUTHD"]="${ENABLE_SASLAUTHD:="0"}"
|
||||
DEFAULT_VARS["ONE_DIR"]="${ONE_DIR:="0"}"
|
||||
DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}"
|
||||
DEFAULT_VARS["VIRUSMAILS_DELETE_DELAY"]="${VIRUSMAILS_DELETE_DELAY:="7"}"
|
||||
DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}"
|
||||
DEFAULT_VARS["ENABLE_CLAMAV"]=${ENABLE_CLAMAV:=0}
|
||||
DEFAULT_VARS["ENABLE_SPAMASSASSIN"]=${ENABLE_SPAMASSASSIN:=0}
|
||||
DEFAULT_VARS["ENABLE_POP3"]=${ENABLE_POP3:=0}
|
||||
DEFAULT_VARS["ENABLE_FAIL2BAN"]=${ENABLE_FAIL2BAN:=0}
|
||||
DEFAULT_VARS["ENABLE_MANAGESIEVE"]=${ENABLE_MANAGESIEVE:=0}
|
||||
DEFAULT_VARS["ENABLE_FETCHMAIL"]=${ENABLE_FETCHMAIL:=0}
|
||||
DEFAULT_VARS["ENABLE_LDAP"]=${ENABLE_LDAP:=0}
|
||||
DEFAULT_VARS["ENABLE_SASLAUTHD"]=${ENABLE_SASLAUTHD:=0}
|
||||
DEFAULT_VARS["ONE_DIR"]=${ONE_DIR:=0}
|
||||
DEFAULT_VARS["SMTP_ONLY"]=${SMTP_ONLY:=0}
|
||||
DEFAULT_VARS["VIRUSMAILS_DELETE_DELAY"]=${VIRUSMAILS_DELETE_DELAY:=7}
|
||||
DEFAULT_VARS["DMS_DEBUG"]=${DMS_DEBUG:=0}
|
||||
##########################################################################
|
||||
# << DEFAULT VARS
|
||||
##########################################################################
|
||||
|
@ -17,19 +17,19 @@
|
||||
}
|
||||
|
||||
@test "checking process: clamav (enabled by ENABLE_CLAMAV=1)" {
|
||||
if [ "$ENABLE_CLAMAV" = 0 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 0 ]; then
|
||||
skip
|
||||
elif [ "$ENABLE_CLAMAV" = 1 ]; then
|
||||
elif [ "$ENABLE_CLAMAV" -eq 1 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
|
||||
[ "$status" -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: clamav (disabled by ENABLE_CLAMAV=0)" {
|
||||
if [ "$ENABLE_CLAMAV" = 0 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 0 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
|
||||
[ "$status" -eq 1 ]
|
||||
elif [" $ENABLE_CLAMAV" = 1 ]; then
|
||||
elif [" $ENABLE_CLAMAV" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
}
|
||||
@ -50,54 +50,54 @@
|
||||
}
|
||||
|
||||
@test "checking process: fail2ban (disabled by ENABLE_FAIL2BAN=0)" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/python /usr/bin/fail2ban-server'"
|
||||
[ "$status" -eq 1 ]
|
||||
elif [ "$ENABLE_FAIL2BAN" = 1 ]; then
|
||||
elif [ "$ENABLE_FAIL2BAN" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: fail2ban (enabled by ENABLE_FAIL2BAN=1)" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
skip
|
||||
elif [ "$ENABLE_FAIL2BAN" = 1 ]; then
|
||||
elif [ "$ENABLE_FAIL2BAN" -eq 1 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/python /usr/bin/fail2ban-server'"
|
||||
[ "$status" -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: fetchmail (disabled by ENABLE_FETCHMAIL=0)" {
|
||||
if [ "$ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail'"
|
||||
[ "$status" -eq 1 ]
|
||||
elif [ "$ENABLE_FETCHMAIL" = 1 ]; then
|
||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: fetchmail (enabled by ENABLE_FETCHMAIL=1)" {
|
||||
if [ "$ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
skip
|
||||
elif [ "$ENABLE_FETCHMAIL" = 1 ]; then
|
||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail'"
|
||||
[ "$status" -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=0)" {
|
||||
if [" $ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [" $ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
||||
[ "$status" -eq 1 ]
|
||||
elif [ "$ENABLE_FETCHMAIL" = 1 ]; then
|
||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=1)" {
|
||||
if [ "$ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
skip
|
||||
elif [ "$ENABLE_FETCHMAIL" = 1 ]; then
|
||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
||||
[ "$status" -eq 0 ]
|
||||
fi
|
||||
@ -108,25 +108,25 @@
|
||||
#
|
||||
|
||||
@test "checking process: dovecot imaplogin (enabled in default configuration)" {
|
||||
if [ "$SMTP_ONLY" = 0 ]; then
|
||||
if [ "$SMTP_ONLY" -eq 0 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/dovecot'"
|
||||
[ "$status" -eq 0 ]
|
||||
elif [ "$SMTP_ONLY" = 1 ]; then
|
||||
elif [ "$SMTP_ONLY" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking process: dovecot imaplogin (disabled using SMTP_ONLY)" {
|
||||
if [ "$SMTP_ONLY" = 0 ]; then
|
||||
if [ "$SMTP_ONLY" -eq 0 ]; then
|
||||
skip
|
||||
elif [ "$SMTP_ONLY" = 1 ]; then
|
||||
elif [ "$SMTP_ONLY" -eq 1 ]; then
|
||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/dovecot'"
|
||||
[ "$status" -eq 1 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "checking imap: server is ready with STARTTLS" {
|
||||
if [ "$SMTP_ONLY" = 1 ]; then
|
||||
if [ "$SMTP_ONLY" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/bash -c "nc -w 2 0.0.0.0 143 | grep '* OK' | grep 'STARTTLS' | grep 'ready'"
|
||||
@ -134,7 +134,7 @@
|
||||
}
|
||||
|
||||
@test "checking imap: authentication works" {
|
||||
if [ "$SMTP_ONLY" = 1 ]; then
|
||||
if [ "$SMTP_ONLY" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-auth.txt"
|
||||
@ -146,7 +146,7 @@
|
||||
#
|
||||
|
||||
@test "checking pop: server is ready" {
|
||||
if [ "$ENABLE_POP3" = 0 ]; then
|
||||
if [ "$ENABLE_POP3" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'"
|
||||
@ -154,7 +154,7 @@
|
||||
}
|
||||
|
||||
@test "checking pop: authentication works" {
|
||||
if [ "$ENABLE_POP3" = 0 ]; then
|
||||
if [ "$ENABLE_POP3" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 110 < /tmp/docker-mailserver-test/auth/pop3-auth.txt"
|
||||
@ -232,19 +232,19 @@
|
||||
@test "checking smtp: delivers mail to existing alias" {
|
||||
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<alias1@localhost.localdomain>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: delivers mail to existing catchall" {
|
||||
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<wildcard@localdomain2.com>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: delivers mail to regexp alias" {
|
||||
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<test123@localhost.localdomain>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: user1 should have received 5 mails" {
|
||||
@ -256,7 +256,7 @@
|
||||
@test "checking smtp: rejects mail to unknown user" {
|
||||
run docker exec mail /bin/sh -c "grep '<nouser@localhost.localdomain>: Recipient address rejected: User unknown in virtual mailbox table' /var/log/mail/mail.log | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: redirects mail to external aliases" {
|
||||
@ -266,21 +266,21 @@
|
||||
}
|
||||
|
||||
@test "checking smtp: rejects spam" {
|
||||
if [ "$ENABLE_CLAMAV" = 0 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep 'Blocked SPAM' /var/log/mail/mail.log | grep spam@external.tld | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: rejects virus" {
|
||||
if [ "$ENABLE_SPAMASSASSIN" = 0 ]; then
|
||||
if [ "$ENABLE_SPAMASSASSIN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep 'Blocked INFECTED' /var/log/mail/mail.log | grep virus@external.tld | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
#
|
||||
@ -342,7 +342,7 @@
|
||||
#
|
||||
|
||||
@test "checking spamassassin: should be listed in amavis when enabled" {
|
||||
if [ "$ENABLE_SPAMASSASSIN" = 0 ]; then
|
||||
if [ "$ENABLE_SPAMASSASSIN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep -i 'ANTI-SPAM-SA code' /var/log/mail/mail.log | grep 'NOT loaded'"
|
||||
@ -350,7 +350,7 @@
|
||||
}
|
||||
|
||||
@test "checking spamassassin: should not be listed in amavis when disabled" {
|
||||
if [ "$ENABLE_SPAMASSASSIN" = 1 ]; then
|
||||
if [ "$ENABLE_SPAMASSASSIN" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep -i 'ANTI-SPAM-SA code' /var/log/mail/mail.log | grep 'NOT loaded'"
|
||||
@ -358,7 +358,7 @@
|
||||
}
|
||||
|
||||
@test "checking spamassassin: docker env variables are set correctly (default)" {
|
||||
if [ "$ENABLE_SPAMASSASSIN" = 0 || ! -z $SA_TAG ]; then
|
||||
if [ "$ENABLE_SPAMASSASSIN" -eq 0 || ! -z $SA_TAG ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep '\$sa_tag_level_deflt' /etc/amavis/conf.d/20-debian_defaults | grep '= 2.0'"
|
||||
@ -370,7 +370,7 @@
|
||||
}
|
||||
|
||||
@test "checking spamassassin: docker env variables are set correctly (custom)" {
|
||||
if [ "$ENABLE_SPAMASSASSIN" = 1 || -z $SA_TAG ]; then
|
||||
if [ "$ENABLE_SPAMASSASSIN" -eq 1 || -z $SA_TAG ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "grep '\$sa_tag_level_deflt' /etc/amavis/conf.d/20-debian_defaults | grep '= 1.0'"
|
||||
@ -386,7 +386,7 @@
|
||||
#
|
||||
|
||||
@test "checking clamav: should be listed in amavis when enabled" {
|
||||
if [ "$ENABLE_CLAMAV" = 0 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail grep -i 'Found secondary av scanner ClamAV-clamscan' /var/log/mail/mail.log
|
||||
@ -394,7 +394,7 @@
|
||||
}
|
||||
|
||||
@test "checking clamav: should not be listed in amavis when disabled" {
|
||||
if [ "$ENABLE_CLAMAV" = 1 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail grep -i 'Found secondary av scanner ClamAV-clamscan' /var/log/mail/mail.log
|
||||
@ -402,7 +402,7 @@
|
||||
}
|
||||
|
||||
@test "checking clamav: should not be called when disabled" {
|
||||
if [ "$ENABLE_CLAMAV" = 1 ]; then
|
||||
if [ "$ENABLE_CLAMAV" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail grep -i 'connect to /var/run/clamav/clamd.ctl failed' /var/log/mail/mail.log
|
||||
@ -588,7 +588,7 @@
|
||||
#
|
||||
|
||||
@test "checking fail2ban: localhost is not banned because ignored" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "fail2ban-client status postfix-sasl | grep 'IP list:.*127.0.0.1'"
|
||||
@ -598,7 +598,7 @@
|
||||
}
|
||||
|
||||
@test "checking fail2ban: fail2ban-jail.cf overrides" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
FILTERS=(sshd postfix dovecot postfix-sasl)
|
||||
@ -616,7 +616,7 @@
|
||||
}
|
||||
|
||||
@test "checking fail2ban: ban ip on multiple failed login" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
# Getting mail_fail2ban container IP
|
||||
@ -642,7 +642,7 @@
|
||||
}
|
||||
|
||||
@test "checking fail2ban: unban ip works" {
|
||||
if [ "$ENABLE_FAIL2BAN" = 0 ]; then
|
||||
if [ "$ENABLE_FAIL2BAN" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
FAIL_AUTH_MAILER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' fail-auth-mailer)
|
||||
@ -664,7 +664,7 @@
|
||||
#
|
||||
|
||||
@test "checking fetchmail: gerneral options in fetchmailrc are loaded" {
|
||||
if [ "$ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail grep 'set syslog' /etc/fetchmailrc
|
||||
@ -672,7 +672,7 @@
|
||||
}
|
||||
|
||||
@test "checking fetchmail: fetchmail.cf is loaded" {
|
||||
if [ "$ENABLE_FETCHMAIL" = 0 ]; then
|
||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail grep 'pop3.example.com' /etc/fetchmailrc
|
||||
@ -758,16 +758,16 @@
|
||||
#
|
||||
|
||||
@test "checking sieve: user1 should have received 1 email in folder INBOX.spam" {
|
||||
if [ "$ENABLE_MANAGESIEVE" = 0 ]; then
|
||||
if [ "$ENABLE_MANAGESIEVE" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/.INBOX.spam/new | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
[ "$output" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking manage sieve: server is ready when ENABLE_MANAGESIEVE has been set" {
|
||||
if [ "$ENABLE_MANAGESIEVE" = 0 ]; then
|
||||
if [ "$ENABLE_MANAGESIEVE" -eq 0 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/bash -c "nc -z 0.0.0.0 4190"
|
||||
@ -775,7 +775,7 @@
|
||||
}
|
||||
|
||||
@test "checking manage sieve: disabled per default" {
|
||||
if [ "$ENABLE_MANAGESIEVE" = 1 ]; then
|
||||
if [ "$ENABLE_MANAGESIEVE" -eq 1 ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/bash -c "nc -z 0.0.0.0 4190"
|
||||
|
Loading…
Reference in New Issue
Block a user