Enabled LDAP/SaslAuthd tests
This commit is contained in:
parent
40e51b382c
commit
6de1cfb372
|
@ -14,7 +14,7 @@ after_script:
|
||||||
env:
|
env:
|
||||||
- SMTP_ONLY=0 ENABLE_CLAMAV=1 ENABLE_SPAMASSASSIN=1 ENABLE_FAIL2BAN=1 ONE_DIR=1 ENABLE_POP3=1 ENABLE_MANAGESIEVE=1 ENABLE_FETCHMAIL=1 PERMIT_DOCKER=host DMS_DEBUG=0 SA_TAG=1.0 SA_TAG2=2.0 SA_KILL=3.0 VIRUSMAILS_DELETE_DELAY=7 SASL_PASSWD="external domain.com username:password"
|
- SMTP_ONLY=0 ENABLE_CLAMAV=1 ENABLE_SPAMASSASSIN=1 ENABLE_FAIL2BAN=1 ONE_DIR=1 ENABLE_POP3=1 ENABLE_MANAGESIEVE=1 ENABLE_FETCHMAIL=1 PERMIT_DOCKER=host DMS_DEBUG=0 SA_TAG=1.0 SA_TAG2=2.0 SA_KILL=3.0 VIRUSMAILS_DELETE_DELAY=7 SASL_PASSWD="external domain.com username:password"
|
||||||
- SMTP_ONLY=0 ENABLE_CLAMAV=0 ENABLE_SPAMASSASSIN=0 ENABLE_FAIL2BAN=0 ONE_DIR=0 ENABLE_POP3=0 ENABLE_MANAGESIEVE=0 ENABLE_FETCHMAIL=0 PERMIT_DOCKER=network DMS_DEBUG=1
|
- SMTP_ONLY=0 ENABLE_CLAMAV=0 ENABLE_SPAMASSASSIN=0 ENABLE_FAIL2BAN=0 ONE_DIR=0 ENABLE_POP3=0 ENABLE_MANAGESIEVE=0 ENABLE_FETCHMAIL=0 PERMIT_DOCKER=network DMS_DEBUG=1
|
||||||
- SMTP_ONLY=1
|
- SMTP_ONLY=1 ENABLE_LDAP=1 LDAP_SERVER_HOST=ldap LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain ENABLE_SASLAUTHD=1 SASLAUTHD_MECHANISMS=ldap SASLAUTHD_LDAP_SERVER=ldap SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain SASLAUTHD_LDAP_PASSWORD=admin SASLAUTHD_LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain POSTMASTER_ADDRESS=postmaster@localhost.localdomain
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack:
|
slack:
|
||||||
|
|
20
Makefile
20
Makefile
|
@ -17,6 +17,11 @@ generate-accounts:
|
||||||
docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
|
docker run --rm -e MAIL_USER=user2@otherdomain.tld -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
if [ -z $(ENABLE_LDAP) ]; then
|
||||||
|
docker run -d --name ldap_for_mail \
|
||||||
|
-e LDAP_DOMAIN="localhost.localdomain" \
|
||||||
|
-h mail.my-domain.com -t ldap
|
||||||
|
fi
|
||||||
# Run containers
|
# Run containers
|
||||||
docker run -d --name mail \
|
docker run -d --name mail \
|
||||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
|
@ -30,6 +35,16 @@ run:
|
||||||
-e ENABLE_FETCHMAIL=$(ENABLE_FETCHMAIL) \
|
-e ENABLE_FETCHMAIL=$(ENABLE_FETCHMAIL) \
|
||||||
-e ONE_DIR=$(ONE_DIR) \
|
-e ONE_DIR=$(ONE_DIR) \
|
||||||
-e PERMIT_DOCKER=$(PERMIT_DOCKER) \
|
-e PERMIT_DOCKER=$(PERMIT_DOCKER) \
|
||||||
|
-e ENABLE_LDAP=$(ENABLE_LDAP) \
|
||||||
|
-e LDAP_SERVER_HOST=$(LDAP_SERVER_HOST) \
|
||||||
|
-e LDAP_SEARCH_BASE=$(LDAP_SEARCH_BASE) \
|
||||||
|
-e LDAP_BIND_DN=$(LDAP_BIND_DN) \
|
||||||
|
-e ENABLE_SASLAUTHD=$(ENABLE_SASLAUTHD) \
|
||||||
|
-e SASLAUTHD_MECHANISMS=$(SASLAUTHD_MECHANISMS) \
|
||||||
|
-e SASLAUTHD_LDAP_SERVER=$(SASLAUTHD_LDAP_SERVER) \
|
||||||
|
-e SASLAUTHD_LDAP_BIND_DN=$(SASLAUTHD_LDAP_BIND_DN) \
|
||||||
|
-e SASLAUTHD_LDAP_PASSWORD=$(SASLAUTHD_LDAP_PASSWORD) \
|
||||||
|
-e SASLAUTHD_LDAP_SEARCH_BASE=$(SASLAUTHD_LDAP_SEARCH_BASE) \
|
||||||
-e SMTP_ONLY=$(SMTP_ONLY) \
|
-e SMTP_ONLY=$(SMTP_ONLY) \
|
||||||
-e SA_TAG=$(SA_TAG) \
|
-e SA_TAG=$(SA_TAG) \
|
||||||
-e SA_TAG2=$(SA_TAG2) \
|
-e SA_TAG2=$(SA_TAG2) \
|
||||||
|
@ -39,6 +54,8 @@ run:
|
||||||
-e DMS_DEBUG=$(DMS_DEBUG) \
|
-e DMS_DEBUG=$(DMS_DEBUG) \
|
||||||
--cap-add=NET_ADMIN \
|
--cap-add=NET_ADMIN \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-h mail.my-domain.com -t $(NAME)
|
||||||
|
|
||||||
|
|
||||||
# Wait for containers to fully start
|
# Wait for containers to fully start
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
|
@ -70,7 +87,8 @@ tests:
|
||||||
clean:
|
clean:
|
||||||
# Remove running test containers
|
# Remove running test containers
|
||||||
-docker rm -f \
|
-docker rm -f \
|
||||||
mail
|
mail \
|
||||||
|
ldap_for_mail
|
||||||
|
|
||||||
@if [ -f config/postfix-accounts.cf.bak ]; then\
|
@if [ -f config/postfix-accounts.cf.bak ]; then\
|
||||||
rm -f config/postfix-accounts.cf ;\
|
rm -f config/postfix-accounts.cf ;\
|
||||||
|
|
|
@ -86,18 +86,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=0)" {
|
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=0)" {
|
||||||
if [" $ENABLE_FETCHMAIL" -eq 0 ]; then
|
if [" $ENABLE_SASLAUTHD" -eq 0 ]; then
|
||||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
elif [ "$ENABLE_SASLAUTHD" -eq 1 ]; then
|
||||||
skip
|
skip
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=1)" {
|
@test "checking process: saslauthd (enabled by ENABLE_SASLAUTHD=1)" {
|
||||||
if [ "$ENABLE_FETCHMAIL" -eq 0 ]; then
|
if [ "$ENABLE_SASLAUTHD" -eq 0 ]; then
|
||||||
skip
|
skip
|
||||||
elif [ "$ENABLE_FETCHMAIL" -eq 1 ]; then
|
elif [ "$ENABLE_SASLAUTHD" -eq 1 ]; then
|
||||||
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
fi
|
fi
|
||||||
|
@ -961,6 +961,9 @@
|
||||||
|
|
||||||
# postfix
|
# postfix
|
||||||
@test "checking postfix: ldap lookup works correctly" {
|
@test "checking postfix: ldap lookup works correctly" {
|
||||||
|
if [ $ENABLE_LDAP -q 0 ]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
run docker exec mail /bin/sh -c "postmap -q some.user@localhost.localdomain ldap:/etc/postfix/ldap-users.cf"
|
run docker exec mail /bin/sh -c "postmap -q some.user@localhost.localdomain ldap:/etc/postfix/ldap-users.cf"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "some.user@localhost.localdomain" ]
|
[ "$output" = "some.user@localhost.localdomain" ]
|
||||||
|
@ -974,11 +977,17 @@
|
||||||
|
|
||||||
# dovecot
|
# dovecot
|
||||||
@test "checking dovecot: ldap imap connection and authentication works" {
|
@test "checking dovecot: ldap imap connection and authentication works" {
|
||||||
|
if [ $ENABLE_LDAP -q 0 ]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-ldap-auth.txt"
|
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-ldap-auth.txt"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking dovecot: mail delivery works" {
|
@test "checking dovecot: mail delivery works" {
|
||||||
|
if [ $ENABLE_LDAP -q 0 ]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
run docker exec mail /bin/sh -c "sendmail -f user@external.tld some.user@localhost.localdomain < /tmp/docker-mailserver-test/email-templates/test-email.txt"
|
run docker exec mail /bin/sh -c "sendmail -f user@external.tld some.user@localhost.localdomain < /tmp/docker-mailserver-test/email-templates/test-email.txt"
|
||||||
sleep 10
|
sleep 10
|
||||||
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/some.user/new | wc -l"
|
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/some.user/new | wc -l"
|
||||||
|
@ -988,11 +997,17 @@
|
||||||
|
|
||||||
# saslauthd
|
# saslauthd
|
||||||
@test "checking saslauthd: sasl ldap authentication works" {
|
@test "checking saslauthd: sasl ldap authentication works" {
|
||||||
|
if [ $ENABLE_SASLAUTHD -q 0 ]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
run docker exec mail bash -c "testsaslauthd -u some.user -p secret"
|
run docker exec mail bash -c "testsaslauthd -u some.user -p secret"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking saslauthd: ldap smtp authentication" {
|
@test "checking saslauthd: ldap smtp authentication" {
|
||||||
|
if [ $ENABLE_SASLAUTHD -q 0 ]; then
|
||||||
|
skip
|
||||||
|
fi
|
||||||
run docker exec mail /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt | grep 'Authentication successful'"
|
run docker exec mail /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt | grep 'Authentication successful'"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue