From 30a38705d8f3cad8ae051389fadcbb5f134f00bd Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 22 Dec 2021 14:03:37 +0100 Subject: [PATCH] add sieve junk configuration --- Dockerfile | 10 +++++----- rootfs/etc/confd/templates/15-lda.conf.tmpl | 2 +- rootfs/etc/confd/templates/20-lmtp.conf.tmpl | 2 +- rootfs/etc/confd/templates/90-sieve.conf.tmpl | 11 +++-------- rootfs/etc/confd/templates/spam.sieve.tmpl | 8 ++++---- rootfs/etc/cont-init.d/02-sieve-rules | 3 +++ 6 files changed, 17 insertions(+), 19 deletions(-) create mode 100755 rootfs/etc/cont-init.d/02-sieve-rules diff --git a/Dockerfile b/Dockerfile index 1e49a63..17e2cfb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14 as builder +FROM alpine:3.15 as builder RUN apk --no-cache add \ rpcgen \ @@ -16,15 +16,15 @@ RUN apk --no-cache add \ icu-dev \ inotify-tools-dev -ENV SHA256_SUM_DOVECOT=03a71d53055bd9ec528d55e07afaf15c09dec9856cba734904bfd05acbc6cf12 -ENV DOVECOT_FILENAME=dovecot-2.3.16.tar.gz +ENV SHA256_SUM_DOVECOT=1c67ccccdc81a75007c01dedc02ad608c4d856c60a6b89b9cd246e79f72aa2b8 +ENV DOVECOT_FILENAME=dovecot-2.3.17.1.tar.gz RUN wget https://www.dovecot.org/releases/2.3/$DOVECOT_FILENAME RUN echo "$SHA256_SUM_DOVECOT $DOVECOT_FILENAME" | sha256sum -c - || exit 1 RUN mkdir /tmp/dovecot RUN tar xzf $DOVECOT_FILENAME -C /tmp/dovecot --strip 1 -ENV SHA256_SUM_PIGEONHOLE=5ca36780e23b99e6206440f1b3fe3c6598eda5b699b99cebb15d418ba3c6e938 -ENV PIGEONHOLE_FILENAME=dovecot-2.3-pigeonhole-0.5.16.tar.gz +ENV SHA256_SUM_PIGEONHOLE=3cc4a3de6d7e27bd99ac59b99faa161287f78167272699a22591798ffcf84512 +ENV PIGEONHOLE_FILENAME=dovecot-2.3-pigeonhole-0.5.17.1.tar.gz RUN wget https://pigeonhole.dovecot.org/releases/2.3/$PIGEONHOLE_FILENAME RUN echo "$SHA256_SUM_PIGEONHOLE $PIGEONHOLE_FILENAME" | sha256sum -c - || exit 1 RUN mkdir /tmp/pigeonhole diff --git a/rootfs/etc/confd/templates/15-lda.conf.tmpl b/rootfs/etc/confd/templates/15-lda.conf.tmpl index 92d947f..cfc02b8 100644 --- a/rootfs/etc/confd/templates/15-lda.conf.tmpl +++ b/rootfs/etc/confd/templates/15-lda.conf.tmpl @@ -4,5 +4,5 @@ lda_mailbox_autocreate = yes lda_mailbox_autosubscribe = yes protocol lda { - mail_plugins = $mail_plugins + mail_plugins = $mail_plugins sieve } diff --git a/rootfs/etc/confd/templates/20-lmtp.conf.tmpl b/rootfs/etc/confd/templates/20-lmtp.conf.tmpl index b825287..2619ce5 100644 --- a/rootfs/etc/confd/templates/20-lmtp.conf.tmpl +++ b/rootfs/etc/confd/templates/20-lmtp.conf.tmpl @@ -1,3 +1,3 @@ protocol lmtp { - mail_plugins = $mail_plugins + mail_plugins = $mail_plugins sieve } diff --git a/rootfs/etc/confd/templates/90-sieve.conf.tmpl b/rootfs/etc/confd/templates/90-sieve.conf.tmpl index 773bf90..95569e4 100644 --- a/rootfs/etc/confd/templates/90-sieve.conf.tmpl +++ b/rootfs/etc/confd/templates/90-sieve.conf.tmpl @@ -1,8 +1,3 @@ -#protocol sieve { -# disable_plaintext_auth = no -#} - -#plugin { -# sieve = bindir=~/.sieve-bin/ -# sieve_after = /var/lib/vmail/sieve-after/ -#} +plugin { + sieve_after = /var/lib/vmail/sieve-after/ +} diff --git a/rootfs/etc/confd/templates/spam.sieve.tmpl b/rootfs/etc/confd/templates/spam.sieve.tmpl index 861c3fe..1f84896 100644 --- a/rootfs/etc/confd/templates/spam.sieve.tmpl +++ b/rootfs/etc/confd/templates/spam.sieve.tmpl @@ -1,6 +1,6 @@ -require ["fileinto","mailbox"]; - -if header :contains "X-Spam-Flag" "YES" { - fileinto :create "Junk"; +require ["fileinto"]; + +if header :contains "X-Spam" "Yes" { + fileinto "Junk"; stop; } diff --git a/rootfs/etc/cont-init.d/02-sieve-rules b/rootfs/etc/cont-init.d/02-sieve-rules new file mode 100755 index 0000000..df0c4ad --- /dev/null +++ b/rootfs/etc/cont-init.d/02-sieve-rules @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv sh + +s6-setuidgid vmail sievec /var/lib/vmail/sieve-after/spam.sieve