[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
Fri Feb 1 15:45:50 EET 2013


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

On Thu, 31 Jan 2013, Ben Johnson wrote:

> On 1/17/2013 4:31 AM, Steffen Kaiser wrote:
>> On Wed, 16 Jan 2013, Ben Johnson wrote:
>>
> I am using the Maildir format indeed.
>
>>> any of your mail users need write permission those directories,
>>> the admin needs read permissions for the spooled files,
>
> By "mail users", do you mean, e.g., the "vmail" user account (I'm on
> Debian/Ubuntu)? My understanding is that the "vmail" user account

Yes, I mean that Unix account, Dovecot accesses the fils with. In a setup 
with virtual users "vmail" makes sense.

> handles all IMAP transactions; if this is true, then are you saying
> that the only requisite to your suggestions is that the "vmail" user
> has read/write access to the following two directories?
>
> /path/to/admin/Maildir/.TrainingReview.spam/new/
>
> and
>
> /path/to/admin/Maildir/.TrainingReview.not_spam/new/

Yes.

>>> you need some method to pass the reviewed messages to sa-learn.
>
> In the past, I have simply sorted the messages into "Ham" and "Spam"
> sub-folders of the admin's training Inbox, and called sa-learn, with
> the appropriate --ham/--spam switch on each, using a cron job. It
> sounds as though this is what you are suggesting, and I can continue

That's what I mean.

> with this approach.
>
> I went ahead and tried to reconfigure Dovecot's Antispam plug-in to
> use the spool2dir backend, but I'm receiving a less-than-helpful
> message from the plug-in when I try to move a message from Inbox to
> Junk or vice versa: "CANNOT: antispam plugin not configured".
>
> Please note that I am using Dovecot 1.2.9 in Ubuntu 10.04 LTS. By

Oh, I have no experience with Dovecot v1.2; in v1.0 you have to compile 
one particular backend into antispam-plugin. Maybe, distributors have 
another, non-Dovecot way to select between the backends.

> extension, I am using the Antispam plug-in for Dovecot 1 (not 2), the
> manpage for which is at
> http://manpages.ubuntu.com/manpages/lucid/man7/dovecot-antispam.7.html
> . So, the configuration option names and expected values differ
> slightly from those in your example.

The man-page contains:

"INSTALLATION

        First copy the ‘defconfig’ file to ‘.config’ and edit it as 
necessary.
        You  need  to  have  the  dovecot  headers installed and possibly 
other
        things depending on the backend you choose.  Then,  assuming  you 
have
        configured the INSTALLDIR correctly, simply run ‘make install’.
"

- -and-

"BACKENDS

        The  plugin supports multiple backends, there are currently two 
working
        backends included in the distribution:
"

This suggests that my guess is true - although I don't understand the 
"there are currently two backends included" part.

======

So you could re-compile another antispam-plugin with spool2dir backend, or 
- - you are using these settings, right?

#=====================
            # mail sending plugin
            #
            # Because of the way this plugin works, you can also use it
            # to train via an arbitrary program that receives the message
            # on standard input, in that case you can use the config
            # options antispam_mail_spam and antispam_mail_notspam for
            # the argument that distinguishes between ham and spam.
            # For example:
            #   antispam_mail_sendmail = /path/to/mailtrain
            #   antispam_mail_sendmail_args = --for;%u
            #   antispam_mail_spam = --spam
            #   antispam_mail_notspam = --ham

change antispam_mail_sendmail into a script, that drops the message
into the correct mail folder, e.g.:

#!/bin/bash

mode=
for opt; do
 	if test "x$opt" == x--ham; then
 		mode=HAM
 		break
 	elif test "x$opt" == x--ham; then
 		mode=SPAM
 		break
 	fi
done

if test -n "$mode"; then
 	# options from http://wiki1.dovecot.org/LDA
 	/path/to/dovecot-deliver -d spamadmin -m Training.$mode
fi

This sends the message bypassing a MTA to the spamadmin user.

Kind regards,

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

iQEVAwUBUQvHDl3r2wJMiz2NAQJEeAf/XmxSzh+cPqviAax/ucThVaYfygrARz6G
qXRLbea/8fnhlRfO2seL75tElDmRsirVXGPu5awpf0WUEzFD96HWrmcrKMMRPfyE
uFylqzVB2dnmc+KOLolGb08hKRooMOaTPQt1Y9eVDGAplQM8PoNu+K3QE+rqkCbf
OJiL2pxJrEbiTOxzVhFSgUY/VdJVYLUBY4BpC5iZp7nNvXvub4scNlcd7OX0T1Kj
nlPnjpw2eNWX+UBCmjbfuVQKVFLBIFQFL9gnxZMphCMzjjYYgPaGHpSBlO00C+aM
ddiR46SrcjJIP4pXZsJyf5xw5aOCIUk2PXGr4aQFj409rcVJaK3CsQ==
=NgZB
-----END PGP SIGNATURE-----


More information about the dovecot mailing list