[Dovecot] Reviewing end-user ham/spam submissions before feeding them to sa-learn via Dovecot Antispam plug-in

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Thu Jan 17 11:31:54 EET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 16 Jan 2013, Ben Johnson wrote:

> Currently, I'm using the Dovecot Antispam plug-in with great success.
> Everything works as expected.
>
> However, I would like to change the plug-in's behavior such that it
> simply sends a copy of a message that is moved from Inbox -> Junk (or
> Junk -> Inbox) to an administrator, instead of calling sa-learn (I'm
> using SpamAssassin) automatically.
>
> Basically, I would like to be able to review messages that end-users
> submit for training before they are actually fed to sa-learn.

Hmm, if you use Maildir:

plugin {
         antispam_backend = spool2dir
         antispam_allow_append_to_spam = true
[snip]
         antispam_spool2dir_spam = /path/to/admin/Maildir/.TrainingReview.spam/new/%%020lu-%%05lu
         antispam_spool2dir_notspam  = /path/to/admin/Maildir/.TrainingReview.not_spam/new/%%020lu-%%05lu
}

any of your mail users need write permission those directories,
the admin needs read permissions for the spooled files,
you need some method to pass the reviewed messages to sa-learn.

IMHO, for 3rd step: I would either flag messages to be learned or move
them into another folder. And a cron job feeds them to sa-learn, so they
do not get into the message queue again and are probably re-filterred
or modified before sa-learn picks them up.

If you do not have Maildir to drop the files to or get problems, because
the messages appear in "new" before they are spooled on disk and hence
they may get indexed wrongly, because their content changes (which is
forbidden in IMAP), you could spool them into

         antispam_spool2dir_spam = /tmp/spamspool/spam/%%020lu-%%05lu-%u
         antispam_spool2dir_notspam  = /tmp/spamspool/ham/%%020lu-%%05lu-%u
    -or-
         antispam_spool2dir_spam = /tmp/spamspool/%%020lu-%%05lu-%u-S
         antispam_spool2dir_notspam  = /tmp/spamspool/%%020lu-%%05lu-%u-H

and have another cron job or inotify-wrapper move the messages to
the reviewer's mailbox. In this case, you can make use of the "%u"
component, which is expanded by the username, who spooled the message.
So you could ignore messages of some users and/or ... .

Kind regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUPfFC13r2wJMiz2NAQLSCAf/VEKn0DN9ueXLB9EDE7DOhzfn3ccqO9p+
k4xhuNVA6GaNdcpGpe69EgRfPaRkwbQrskyPABgdgS3nnSQPXA7nlnQm9BIr4cti
OPsse+scQBtmRlmiIgXBO4RsDdZGSKg6f3ob+BLUU579MrzBVCiR4fsVtKZBefJv
qK1TFYxGLUtimUx8lznrs053vBO/Y1cCpGe5u55UY8OnA8qu0gu9b3l6LWNHkiAu
5aL3thDqlnirrzQVvsCfEgb0N11vy2eT+KYn+WsfG+d/JCt/tDVEoPAs19C5NPgR
moMKqmU1EnUNxNuK8GHAEAgcAiixIhXbj95MkhTAYU9ephXMcGRodg==
=ynjz
-----END PGP SIGNATURE-----



More information about the dovecot mailing list