[Dovecot] Spam filtering
Dmitri V. Ivanov
dima at intex.spb.ru
Tue Dec 15 20:33:49 EET 2009
On Tue, Dec 15, 2009 at 02:20:23PM +0800, Patrick Nagel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Dmitri,
>
> On 2009-12-15 04:54, Dmitri V. Ivanov wrote:
> > On Mon, Dec 14, 2009 at 09:30:54PM +0100, Marcus Rueckert wrote:
> >>> Is there a way do something like that with deliver?
> >>
> >> why not do it on MTA level? those already have the hooks for it
> >> normally. no need to reinvent the wheel imho.
> >>
> >
> > Sometimes it's virtual users using dovecot userdb or something like.
> > MTA isn't aware of it (all it uses for virtual user is mailbox
> > presence). But each virtual user have own wordlist for bogofilter.
> > deliver would set some environment variables like $HOME to desirable
> > values for such virtual user and then we have good place to call
> > filter pointing it to virtual user home directory.
>
> Indeed, that would be more straight-forward than what's currently needed
> (from an administrator's point of view, at least).
>
> We have postfix configured to pipe to-be-delivered mails into a shell
> script that takes ${recipient} (the recipient's e-mail address) as first
> argument (here is the relevant part from master.cf):
>
> spamcheck unix - n n - - pipe
> flags=DRhu user=maildeliver:maildeliver
> argv=/usr/local/libexec/spamcheck_and_deliver ${recipient}
>
> The script then pipes the mail through `/usr/bin/spamc -u 'left part of
> e-mail address'` (which lets spamassassin's spamd do the checking and
> insertion of headers, and thanks to the -u parameter for each user a
> separate bayes_journal, bayes_seen and bayes_toks file is being used).
>
> That output then gets finally piped into `deliver -d 'e-mail address'`,
> which files the mails into the inbox/spam/unsure mailbox, according to a
> global sieve script that checks the headers previously inserted by spamd.
>
> My private bogofilter setup is simpler, since it's just for me, but you
> could do it similarly, by specifying the user's bogofilter wordlist
> directory (-d ...) in the shell script (I think).
No holywar!!! I just tried to ask: "is there plugin to replace maildrop with
deliver for my setup". I just thinking that plugin to call bogofilter before
sieve isn't to bad idea, but there may be a stones under water (I don't know it
fairly).
I dont like to use shell there (procmail too, because maildrop would set all
needed environment variables from it's userdb and it's easy to write script to
fill maildrop userdb up from dovecot passwd-like file). And there is an option
to call deliver without '-d user' as far as I understand ($HOME is set to
desired value).
Note: with debian etch situation wasn't so clear bacause maildrop was compiled
to use courier authdaemon, and so construction got extra unnessessery parts.
WBR
Dmitri Ivanov
More information about the dovecot
mailing list