Remove binary apk and use sieve_imap for antispam learning, fixes #33

master
Pierre Jaury 8 years ago
parent f1be8d7fd5
commit f2ff1eb955

@ -2,17 +2,11 @@ FROM alpine:edge
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk add --update \ && apk add --update \
dovecot \ dovecot dovecot-sqlite dovecot-pigeonhole-plugin dovecot-pigeonhole-plugin-extdata \
dovecot-sqlite \
dovecot-pigeonhole-plugin \
dovecot-antispam-plugin@testing \
rspamd-client@testing \ rspamd-client@testing \
bash \ bash \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
COPY dovecot-pigeonhole-plugin-extdata-39-r0.apk /
RUN apk add --allow-untrusted --force dovecot-pigeonhole-plugin-extdata-39-r0.apk
COPY conf /etc/dovecot COPY conf /etc/dovecot
COPY sieve /var/lib/dovecot COPY sieve /var/lib/dovecot

@ -104,7 +104,7 @@ service auth-worker {
############### ###############
protocol imap { protocol imap {
mail_plugins = $mail_plugins imap_quota antispam mail_plugins = $mail_plugins imap_quota imap_sieve
} }
protocol pop3 { protocol pop3 {
@ -155,13 +155,16 @@ service managesieve {
plugin { plugin {
sieve = file:~/sieve;active=~/.dovecot.sieve sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_plugins = sieve_extdata sieve_plugins = sieve_extdata sieve_imapsieve sieve_extprograms
sieve_global_extensions = +vnd.dovecot.extdata +spamtest +spamtestplus sieve_global_extensions = +vnd.dovecot.extdata +spamtest +spamtestplus +vnd.dovecot.execute
sieve_before = /var/lib/dovecot/before.sieve sieve_before = /var/lib/dovecot/before.sieve
sieve_default = /var/lib/dovecot/default.sieve sieve_default = /var/lib/dovecot/default.sieve
sieve_after = /var/lib/dovecot/after.sieve sieve_after = /var/lib/dovecot/after.sieve
sieve_extdata_dict_uri = proxy::sieve sieve_extdata_dict_uri = proxy::sieve
# Sieve execute
sieve_execute_bin_dir = /var/lib/dovecot/bin
# Send vacation replies even for aliases # Send vacation replies even for aliases
# See the Pigeonhole documentation about warnings: http://wiki2.dovecot.org/Pigeonhole/Sieve/Extensions/Vacation # See the Pigeonhole documentation about warnings: http://wiki2.dovecot.org/Pigeonhole/Sieve/Extensions/Vacation
# It appears that our implemntation of mail delivery meets criteria of section 4.5 # It appears that our implemntation of mail delivery meets criteria of section 4.5
@ -171,19 +174,20 @@ plugin {
# Include the recipient in vacation replies so that DKIM applies # Include the recipient in vacation replies so that DKIM applies
sieve_vacation_send_from_recipient = yes sieve_vacation_send_from_recipient = yes
antispam_backend = mailtrain
antispam_spam = Junk
antispam_trash = Trash
antispam_mail_sendmail = /usr/bin/rspamc
antispam_mail_spam = learn_spam
antispam_mail_notspam = learn_ham
antispam_mail_sendmail_args = -h;antispam:11334;-P;q1
# extract spam score from # extract spam score from
# X-Spam-Result: .... [<value> / <max_value] ... # X-Spam-Result: .... [<value> / <max_value] ...
sieve_spamtest_status_type = score sieve_spamtest_status_type = score
sieve_spamtest_status_header = X-Spamd-Result: .*\[(-?[[:digit:]]+\.[[:digit:]]+) .*\] sieve_spamtest_status_header = X-Spamd-Result: .*\[(-?[[:digit:]]+\.[[:digit:]]+) .*\]
sieve_spamtest_max_header = X-Spamd-Result: .*\[.* ([[:digit:]]+\.[[:digit:]]+)\] sieve_spamtest_max_header = X-Spamd-Result: .*\[.* ([[:digit:]]+\.[[:digit:]]+)\]
# Learn from spam
imapsieve_mailbox1_name = Junk
imapsieve_mailbox1_causes = COPY
imapsieve_mailbox1_before = file:/var/lib/dovecot/report-spam.sieve
imapsieve_mailbox2_name = *
imapsieve_mailbox2_from = Junk
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_before = file:/var/lib/dovecot/report-ham.sieve
} }
############### ###############

@ -0,0 +1,3 @@
#!/bin/sh
rspamc -h antispam:11334 -P mailu "learn_$1" /dev/stdin <&0

@ -0,0 +1,3 @@
require "vnd.dovecot.execute";
execute :pipe mailtrain ham;

@ -0,0 +1,3 @@
require "vnd.dovecot.execute";
execute :pipe "mailtrain" "spam";

@ -2,7 +2,7 @@ worker {
bind_socket = "0.0.0.0:11334"; bind_socket = "0.0.0.0:11334";
type = "controller"; type = "controller";
count = 1; count = 1;
password = "q1"; password = "mailu";
secure_ip = "127.0.0.1"; secure_ip = "127.0.0.1";
secure_ip = "::1"; secure_ip = "::1";
static_dir = "${WWWDIR}"; static_dir = "${WWWDIR}";
Loading…
Cancel
Save