amavisd-new? clamav? razor? anyone?

Florin Andrei florin at andrei.myip.org
Thu Oct 7 20:51:30 UTC 2004


On Thu, 2004-10-07 at 00:51, Marius Andreiana wrote:
> On Wed, 2004-10-06 at 23:52 -0700, Florin Andrei wrote:
> > I want to upgrade to SpamAssassin-3.0 and turn on as many features as
> > possible. Nice description here:
> After you set it up to work with amavis, please send me your config
> files. amavis+spamassassin works by default, but I don't know how to
> make possible training server-side spamassassin by users (on IMAP, I
> guess on pop3 it's not possible) and delivering mail in a global spam
> folder accessible by all users.

I'm currently using SpamAssassin-2.6x + amavisd-ng + clamav +
Cyrus-IMAPd

In Cyrus, for each user i created a folder named "bayes", with two
subfolders: "spam" and "ham". There's also a per-user folder named
"Spam" and another one called "Virus".
I also created an IMAP account called "amavis" that has read/write
privileges to all bayes/spam and bayes/ham folders in all IMAP accounts.
It's all a matter of Cyrus permissions, the docs suck but you'll figure
it out eventually.

The server-side filtering capabilities (Sieve) in Cyrus are so
configured that, when a message gets tagged by amavisd-ng as either spam
or virus, it automatically gets sent to the appropriate folders in the
respective IMAP user account (either the "Spam" folder or "Virus").
The users also have access to their set of Sieve rules through
Squirrelmail (i think it's a Sieve plugin to the default Squirrel
installation), should they need additional folders and filters for other
types of messages (but the spam and virus rules must not be changed).
Squirrel is also the webmail interface to IMAP.

Now, to train the bayesian filter:
When a user sees a spam message in the Inbox, it's enough to drag that
message (using an IMAP client such as Evolution or Thunderbird) to the
bayes/spam folder and forget about it.
When a user looks in the "Spam" folder and sees a clean message that was
incorrectly tagged spam, it's enough to copy it to the bayes/ham folder
(in addition to moving it to the Inbox or another folder).
That's all the users have to do. Everything else happens behind the
scenes.

There's a cronjob that runs as the "amavis" Unix user, wakes up every
half an hour, logs in to Cyrus as the "amavis" IMAP user, goes through
all bayes/* folders in all IMAP accounts and downloads then erases all
messages. The messages from bayes/spam get fed to SA's bayesian filters
as spam, the ones from bayes/ham get fed as ham.
I attached a very crude script that does parts of what i just said (i
think it only works with one user account), just pay attention that the
Net::IMAP::Simple Perl module is broken w.r.t. deleting messages on
Cyrus, i fixed it twice but my fixes were only partially included by the
author back in the module. I think it's either the delete() or the
expunge_mailbox() functions that need to be fixed. I don't remember
much, really.
I also attached a version of
/usr/lib/perl5/site_perl/5.8.3/Net/IMAP/Simple.pm that i hacked and
works for me with perl-Net-IMAP-Simple-0.94-8. If the original doesn't
work and you have to use the hacked version, please bug the author of
the Perl module. Or maybe there's a newer version of the Perl module now
that works, i dunno.

You could also setup a global bayes/* folder hierarchy, instead of one
per user, it's all a matter of Cyrus permissions. The only reason to
choose one version over the other is, i think, the level of
security/privacy that's desired. Also, with a huge common spam trashcan,
less technically-inclined users might get confused about messages
"magically" appearing in those folders.

With SA-2.6x you cannot have a bayesian DB for each user except if you
do a lot of hacking.
With SA-3.0 you can do that if you use the MySQL backend. Get the SA3
tarball and read the text files, one of them describes everything you
need to do in order to turn on the bayesian MySQL backend; judging from
what that file says, it's really simple.
I didn't try that yet, i'm currently only getting all ducks to sit
nicely in a row before i start actually shooting them. :-)

-- 
Florin Andrei

http://florin.myip.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bayes_coach.pl
Type: application/x-perl
Size: 1122 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20041007/74fe83d3/attachment-0002.pl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Simple.pm
Type: application/x-perl
Size: 13698 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20041007/74fe83d3/attachment-0003.pl>


More information about the fedora-list mailing list