mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
sieve after/before use folder instead of individual listing
Loading sieve scripts using a directory scheme permits to handle multi scripts wtihout defining individual sieve_before/sieve_after
This commit is contained in:
parent
a12cd9a26d
commit
92414b7eba
|
@ -125,7 +125,7 @@ RUN echo "0 */6 * * * clamav /usr/bin/freshclam --quiet" > /etc/cron.d/clamav-fr
|
||||||
# Configures Dovecot
|
# Configures Dovecot
|
||||||
COPY target/dovecot/auth-passwdfile.inc target/dovecot/??-*.conf /etc/dovecot/conf.d/
|
COPY target/dovecot/auth-passwdfile.inc target/dovecot/??-*.conf /etc/dovecot/conf.d/
|
||||||
COPY target/dovecot/scripts/quota-warning.sh /usr/local/bin/quota-warning.sh
|
COPY target/dovecot/scripts/quota-warning.sh /usr/local/bin/quota-warning.sh
|
||||||
COPY target/dovecot/sieve/* /usr/lib/dovecot/sieve-global/
|
COPY target/dovecot/sieve/ /etc/dovecot/sieve/
|
||||||
WORKDIR /usr/share/dovecot
|
WORKDIR /usr/share/dovecot
|
||||||
# hadolint ignore=SC2016,SC2086
|
# hadolint ignore=SC2016,SC2086
|
||||||
RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf && \
|
RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf && \
|
||||||
|
|
|
@ -31,14 +31,14 @@ plugin {
|
||||||
# executed. The order of execution within a directory is determined by the
|
# executed. The order of execution within a directory is determined by the
|
||||||
# file names, using a normal 8bit per-character comparison. Multiple script
|
# file names, using a normal 8bit per-character comparison. Multiple script
|
||||||
# file or directory paths can be specified by appending an increasing number.
|
# file or directory paths can be specified by appending an increasing number.
|
||||||
#sieve_before = /usr/lib/dovecot/sieve-global/before.dovecot.sieve
|
sieve_before = /usr/lib/dovecot/sieve-global/before/
|
||||||
#sieve_before2 = /usr/lib/dovecot/sieve-global/before.spam.sieve
|
#sieve_before2 =
|
||||||
#sieve_before3 = (etc...)
|
#sieve_before3 = (etc...)
|
||||||
|
|
||||||
# Identical to sieve_before, only the specified scripts are executed after the
|
# Identical to sieve_before, only the specified scripts are executed after the
|
||||||
# user's script (only when keep is still in effect!). Multiple script file or
|
# user's script (only when keep is still in effect!). Multiple script file or
|
||||||
# directory paths can be specified by appending an increasing number.
|
# directory paths can be specified by appending an increasing number.
|
||||||
#sieve_after = /usr/lib/dovecot/sieve-global/after.dovecot.sieve
|
sieve_after = /usr/lib/dovecot/sieve-global/after/
|
||||||
#sieve_after2 =
|
#sieve_after2 =
|
||||||
#sieve_after2 = (etc...)
|
#sieve_after2 = (etc...)
|
||||||
|
|
||||||
|
|
|
@ -614,29 +614,32 @@ function _setup_dovecot() {
|
||||||
rm -f /usr/lib/dovecot/sieve-pipe/*
|
rm -f /usr/lib/dovecot/sieve-pipe/*
|
||||||
[ -d /tmp/docker-mailserver/sieve-filter ] && cp /tmp/docker-mailserver/sieve-filter/* /usr/lib/dovecot/sieve-filter/
|
[ -d /tmp/docker-mailserver/sieve-filter ] && cp /tmp/docker-mailserver/sieve-filter/* /usr/lib/dovecot/sieve-filter/
|
||||||
[ -d /tmp/docker-mailserver/sieve-pipe ] && cp /tmp/docker-mailserver/sieve-pipe/* /usr/lib/dovecot/sieve-pipe/
|
[ -d /tmp/docker-mailserver/sieve-pipe ] && cp /tmp/docker-mailserver/sieve-pipe/* /usr/lib/dovecot/sieve-pipe/
|
||||||
|
|
||||||
|
# create global sieve directories
|
||||||
|
mkdir -p /usr/lib/dovecot/sieve-global/before
|
||||||
|
mkdir -p /usr/lib/dovecot/sieve-global/after
|
||||||
|
|
||||||
if [ -f /tmp/docker-mailserver/before.dovecot.sieve ]; then
|
if [ -f /tmp/docker-mailserver/before.dovecot.sieve ]; then
|
||||||
sed -i "s/#sieve_before =/sieve_before =/" /etc/dovecot/conf.d/90-sieve.conf
|
cp /tmp/docker-mailserver/before.dovecot.sieve /usr/lib/dovecot/sieve-global/before/
|
||||||
cp /tmp/docker-mailserver/before.dovecot.sieve /usr/lib/dovecot/sieve-global/
|
sievec /usr/lib/dovecot/sieve-global/before/before.dovecot.sieve
|
||||||
sievec /usr/lib/dovecot/sieve-global/before.dovecot.sieve
|
|
||||||
else
|
else
|
||||||
sed -i "s/ sieve_before =/ #sieve_before =/" /etc/dovecot/conf.d/90-sieve.conf
|
rm -f /usr/lib/dovecot/sieve-global/before/before.dovecot.sieve /usr/lib/dovecot/sieve-global/before/before.dovecot.svbin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /tmp/docker-mailserver/after.dovecot.sieve ]; then
|
if [ -f /tmp/docker-mailserver/after.dovecot.sieve ]; then
|
||||||
sed -i "s/#sieve_after =/sieve_after =/" /etc/dovecot/conf.d/90-sieve.conf
|
cp /tmp/docker-mailserver/after.dovecot.sieve /usr/lib/dovecot/sieve-global/after/
|
||||||
cp /tmp/docker-mailserver/after.dovecot.sieve /usr/lib/dovecot/sieve-global/
|
sievec /usr/lib/dovecot/sieve-global/after/after.dovecot.sieve
|
||||||
sievec /usr/lib/dovecot/sieve-global/after.dovecot.sieve
|
|
||||||
else
|
else
|
||||||
sed -i "s/ sieve_after =/ #sieve_after =/" /etc/dovecot/conf.d/90-sieve.conf
|
rm -f /usr/lib/dovecot/sieve-global/after/after.dovecot.sieve /usr/lib/dovecot/sieve-global/after/after.dovecot.svbin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# sieve will move spams to .Junk folder when SPAMASSASSIN_SPAM_TO_INBOX=1 and MOVE_SPAM_TO_JUNK=1
|
# sieve will move spams to .Junk folder when SPAMASSASSIN_SPAM_TO_INBOX=1 and MOVE_SPAM_TO_JUNK=1
|
||||||
if [ "$SPAMASSASSIN_SPAM_TO_INBOX" = 1 ] && [ "$MOVE_SPAM_TO_JUNK" = 1 ]; then
|
if [ "$SPAMASSASSIN_SPAM_TO_INBOX" = 1 ] && [ "$MOVE_SPAM_TO_JUNK" = 1 ]; then
|
||||||
notify 'inf' "Spam messages will be moved to the Junk folder."
|
notify 'inf' "Spam messages will be moved to the Junk folder."
|
||||||
sed -i "s/#sieve_before2 =/sieve_before2 =/" /etc/dovecot/conf.d/90-sieve.conf
|
cp /etc/dovecot/sieve/before/spam.sieve /usr/lib/dovecot/sieve-global/before/
|
||||||
sievec /usr/lib/dovecot/sieve-global/before.spam.sieve
|
sievec /usr/lib/dovecot/sieve-global/before/spam.sieve
|
||||||
else
|
else
|
||||||
sed -i "s/ sieve_before2 =/ #sieve_before2 =/" /etc/dovecot/conf.d/90-sieve.conf
|
rm -f /usr/lib/dovecot/sieve-global/before/spam.sieve /usr/lib/dovecot/sieve-global/before/spam.svbin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown docker:docker -R /usr/lib/dovecot/sieve*
|
chown docker:docker -R /usr/lib/dovecot/sieve*
|
||||||
|
|
Loading…
Reference in a new issue