Merge pull request #92 from mjung/master

New SMTP_ONLY environment variable to disable all courier daemons
This commit is contained in:
Thomas VIAL 2016-03-01 09:18:50 +01:00
commit dc796ea9f2
4 changed files with 31 additions and 2 deletions

View File

@ -25,6 +25,12 @@ run:
-v "`pwd`/test":/tmp/test \
-e ENABLE_POP3=1 \
-h mail.my-domain.com -t $(NAME)
docker run -d --name mail_smtponly \
-v "`pwd`/postfix":/tmp/postfix \
-v "`pwd`/spamassassin":/tmp/spamassassin \
-v "`pwd`/test":/tmp/test \
-e SMTP_ONLY=1 \
-h mail.my-domain.com -t $(NAME)
# Wait for containers to fully start
sleep 60
@ -47,4 +53,4 @@ clean:
# Get default files back
git checkout postfix/accounts.cf postfix/virtual
# Remove running test containers
docker rm -f mail mail_pop3
docker rm -f mail mail_pop3 mail_smtponly

View File

@ -88,6 +88,9 @@ Example:
* ENABLE_POP3
* *empty* (default) => POP3 service disabled
* 1 => Enables POP3 service
* SMTP_ONLY
* *empty* (default) => courier daemons might start
* *1 => do not launch any courier daemons (imap, pop3)
* SA_TAG
* *2.0* (default) => add spam info headers if at, or above that level
* SA_TAG2

View File

@ -229,11 +229,15 @@ echo "Starting daemons"
cron
/etc/init.d/rsyslog start
/etc/init.d/saslauthd start
if [ "$SMTP_ONLY" != 1 ]; then
/etc/init.d/courier-authdaemon start
/etc/init.d/courier-imap start
/etc/init.d/courier-imap-ssl start
if [ "$ENABLE_POP3" = 1 ]; then
fi
if [ "$ENABLE_POP3" = 1 -a "$SMTP_ONLY" != 1 ]; then
echo "Starting POP3 services"
/etc/init.d/courier-pop start
/etc/init.d/courier-pop-ssl start

View File

@ -47,10 +47,26 @@
[ "$status" -eq 0 ]
}
@test "checking process: courierpop3d (disabled using SMTP_ONLY)" {
run docker exec mail_smtponly /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/lib/courier/courier/courierpop3d'"
[ "$status" -eq 1 ]
}
#
# imap
#
@test "checking process: courier imaplogin (enabled in default configuration)" {
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/lib/courier/courier/imaplogin'"
[ "$status" -eq 0 ]
}
@test "checking process: courier imaplogin (disabled using SMTP_ONLY)" {
run docker exec mail_smtponly /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/lib/courier/courier/imaplogin'"
[ "$status" -eq 1 ]
}
@test "checking imap: server is ready with STARTTLS" {
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 143 | grep '* OK' | grep 'STARTTLS' | grep 'Courier-IMAP ready'"
[ "$status" -eq 0 ]