Configure dovecot's managesieve plugin when the environment variable

ENABLE_MANAGE_SIEVE has been set.

Adapted README and updated tests.

The functionality has successfully been tested using the Sieve
Thunderbird plugin.
This commit is contained in:
André Stein 2016-04-29 15:24:10 +02:00
parent 570bf85319
commit 69b66d55bc
5 changed files with 25 additions and 2 deletions

View file

@ -5,7 +5,7 @@ MAINTAINER Thomas VIAL
RUN DEBIAN_FRONTEND=noninteractive apt-get update -q --fix-missing && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends \
postfix dovecot-core dovecot-imapd dovecot-pop3d dovecot-sieve gamin amavisd-new spamassassin razor pyzor \
postfix dovecot-core dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved gamin amavisd-new spamassassin razor pyzor \
clamav clamav-daemon libnet-dns-perl libmail-spf-perl bzip2 file gzip p7zip unzip arj rsyslog \
opendkim opendkim-tools opendmarc curl fail2ban ed iptables && \
curl -sk http://neuro.debian.net/lists/trusty.de-m.libre > /etc/apt/sources.list.d/neurodebian.sources.list && \
@ -74,6 +74,6 @@ RUN curl -s https://letsencrypt.org/certs/lets-encrypt-x1-cross-signed.pem > /et
ADD target/bin/generate-ssl-certificate target/bin/generate-dkim-config target/start-mailserver.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/*
EXPOSE 25 587 143 993 110 995
EXPOSE 25 587 143 993 110 995 4190
CMD /usr/local/bin/start-mailserver.sh

View file

@ -23,6 +23,7 @@ run:
-e SA_TAG2=2.0 \
-e SA_KILL=3.0 \
-e SASL_PASSWD=testing \
-e ENABLE_MANAGE_SIEVE=1 \
-h mail.my-domain.com -t $(NAME)
sleep 20
docker run -d --name mail_pop3 \

View file

@ -113,6 +113,11 @@ If you enable Fail2Ban, don't forget to add the following lines to your `docker-
Otherwise, `iptables` won't be able to ban IPs.
##### ENABLE_MANAGE_SIEVE
- **empty** => Managesieve service disabled
- 1 => Enables Managesieve on port 4190
##### SA_TAG
- **2.0** => add spam info headers if at, or above that level

View file

@ -23,6 +23,7 @@ if [ -f /tmp/docker-mailserver/postfix-accounts.cf ]; then
cp -a /usr/share/dovecot/protocols.d /etc/dovecot/
# Disable pop3 (it will be eventually enabled later in the script, if requested)
mv /etc/dovecot/protocols.d/pop3d.protocol /etc/dovecot/protocols.d/pop3d.protocol.disab
mv /etc/dovecot/protocols.d/managesieved.protocol /etc/dovecot/protocols.d/managesieved.protocol.disab
sed -i -e 's/#ssl = yes/ssl = yes/g' /etc/dovecot/conf.d/10-master.conf
sed -i -e 's/#port = 993/port = 993/g' /etc/dovecot/conf.d/10-master.conf
sed -i -e 's/#port = 995/port = 995/g' /etc/dovecot/conf.d/10-master.conf
@ -234,6 +235,12 @@ echo "Starting daemons"
cron
/etc/init.d/rsyslog start
# Enable Managesieve service by setting the symlink
# to the configuration file Dovecot will actually find
if [ "$ENABLE_MANAGE_SIEVE" = 1 ]; then
mv /etc/dovecot/protocols.d/managesieved.protocol.disab /etc/dovecot/protocols.d/managesieved.protocol
fi
if [ "$SMTP_ONLY" != 1 ]; then
# Here we are starting sasl and imap, not pop3 because it's disabled by default
echo " * Starting dovecot services"

View file

@ -419,3 +419,13 @@
[ "$status" -eq 0 ]
[ "$output" = 1 ]
}
@test "checking manage sieve: server is ready when ENABLE_MANAGE_SIEVE has been set" {
run docker exec mail /bin/bash -c "nc -z 0.0.0.0 4190"
[ "$status" -eq 0 ]
}
@test "checking manage sieve: disabled per default" {
run docker exec mail_pop3 /bin/bash -c "nc -z 0.0.0.0 4190"
[ "$status" -ne 0 ]
}