From 82a3237b0a5c1b991044455983f46d27761827cd Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Tue, 4 Feb 2020 12:14:54 -0300 Subject: [PATCH] try fixing antispam learning --- 90-antispam.conf | 12 ++++-------- Dockerfile | 6 ++++-- mailtrain | 13 +++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100755 mailtrain diff --git a/90-antispam.conf b/90-antispam.conf index 024cded..5b72092 100644 --- a/90-antispam.conf +++ b/90-antispam.conf @@ -9,11 +9,8 @@ plugin { # verbose as syslog debugging due to internal limitations. # # antispam_debug_target = syslog -# antispam_debug_target = stderr -# antispam_verbose_debug = 1 antispam_debug_target = stderr -# FIXME disable debug -antispam_verbose_debug = 1 +# antispam_verbose_debug = 1 # backend selection, MUST be configured first, # there's no default so you need to set one of @@ -142,13 +139,12 @@ antispam_spam = Junk;junk;Junk Mail;Spam;spam;SPAM antispam_pipe_tmpdir = /tmp # spam/not-spam argument (default unset which will is not what you want) -antispam_pipe_program_spam_arg = -s -antispam_pipe_program_notspam_arg = -n +antispam_pipe_program_spam_arg = spam +antispam_pipe_program_notspam_arg = ham # binary to pipe mail to -antispam_pipe_program = /usr/bin/bogofilter +antispam_pipe_program = /usr/local/bin/mailtrain #antispam_pipe_program_args = -f;%u@example.com # % expansion done by dovecot -antispam_pipe_program_args = -l #=================== # crm114 plugin diff --git a/Dockerfile b/Dockerfile index 0f474a7..3bb68bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,7 @@ RUN groupadd -g 5000 vmail && useradd -g vmail -u 5000 vmail -d /vmail \ dovecot-submissiond \ dovecot-managesieved \ dovecot-antispam \ - bogofilter \ + bogofilter-sqlite \ ssl-cert \ ca-certificates \ && rm -rf /var/lib/apt/lists/* \ @@ -69,9 +69,11 @@ ADD junk-filter.sieve /etc/dovecot/sieve/before/ ADD confd /etc/confd/ +ADD mailtrain /usr/local/bin/ + RUN sievec /etc/dovecot/sieve/before -VOLUME /etc/dovecot /ssl /vmail +VOLUME /ssl /vmail EXPOSE 110/tcp 143/tcp 587/tcp 993/tcp 995/tcp 2000/tcp diff --git a/mailtrain b/mailtrain new file mode 100755 index 0000000..4d22f99 --- /dev/null +++ b/mailtrain @@ -0,0 +1,13 @@ +#!/bin/bash +# train the spam filter. +# arg 1 - spam or ham + +if [ "$1" == "ham" ]; then + /usr/bin/bogofilter -e -p -Sn + exit 0 +fi + +if [ "$2" == "spam" ]; then + /usr/bin/bogofilter -e -p -Ns + exit 0 +fi