[Dovecot] Dovecot and Bogofilter
mouss at netoyen.net
Sat Nov 15 12:58:59 EET 2008
Matthias-Christian Ott wrote:
> on my small Xen-virtualised server with 48 MiB RAM I use Postfix and
> Dovecot, because the Debian administrators dislike qmail , which is in
> my opinion despite some maintainability and code quality issues a quite
> well designed software, because it mostly follows the UNIX principles.
> Postfix is not able to sort my E-Mail into different Maildir folders
postfix can, with the help of other programs. "unix principles", you
postfix can pass mail to any program you want. A wrapper would do
- pass the message to a filter.
- save the filtered message to a temp file
- parse the temp file to determine the destination folder
- run dovecot deliver with the -m option to specify the destination folder
of course, you need to catch errors.
maildrop may be a better tool at this job, though.
> after I looked at procmail's source code, I decided to use Dovecot's LDA,
> because it supports sieve via a plugin.
> All in all it worked after some tweaking and Dovecot is now responsible
> for authentication and delivery.
> Furthermore I want to setup a spam filter and due to the memory
> constraints I decided in favour of bogofilter (I made no real world tests,
> but the authors claim that it's fast and has a small memory footprint).
> My first idea was train bogofilter via a cronjob that runs bogofilter
> for each E-Mail in my spam folder and deletes them afterwards. Then I
> stumbled upon the dovecot antispam  plugin and quickly wrote a backend
> for bogofilter. During the development I realised that bogofilter has
> to update the X-Bogosity header of the reclassified E-Mails. Johannes
> Berg told me that he wasn't sure whether dovecot would be able to do
> this and recommended to ask this on the mailing list.
one possibility would be
- deliver the reclassified message
- if ok, delete the original one. this means the plugin needs to know
the file location.
> An other problem is that each mail needs to be initially classified and
> due to the fact that sieve is not able to execute external programmes,
> deliver has to do this task. I'm currently thinking of possibilities to
> implement this, so far I came up with the following:
> 1. Write a generic pipe plugin which can execute an arbitrary number of
> programmes. The problem with this is that I'm not sure how to
> integrate this is in Dovecot's configuration file. I thought of
> something like this: pipe = prg1 | prg2
keep it simple ... if you need to pipe between multiple programs, just
use shell wrappers.
> 2. Write a bogofilter-specific plugin for this.
I guess we will end up with a foo-specific plugin, for every possible
foo filter. A generic plugin is better even if that means executing
> Anyhow I would like to take this opportunity to criticise Dovecot
> for being a bloated (unnecessary abstractions, verbose, pseudo
> object-oriented, ...), non-suckless  and non-unixish (plugin
> architecture, monolithic design, ...) software which in return works
> quite well and stable so far.
- plugins are simply loadable libraries. if you think they are
windowish, you are wrong. They fit perfectly into the "simple pieces of
code to do fewtasks" philosophy. just because dynamic libs weren't
usable a long time ago doesn't mean unix should stick with old stuff.
- the unix kernel is monolithic. loadable modules support has been added
but the kernel is still a large piece of code.
- and before I forget, my favourite provaction: unix is obsolete ;-p
> I appreciate any suggestions, ideas or criticism. I would really like
> to finish configuring my mail server as soon as possible.
>  http://smarden.org/pape/Debian/1215531259.4854_332.werc
>  http://johannes.sipsolutions.net/Projects/dovecot-antispam
>  http://www.suckless.org/common/
More information about the dovecot