Spam control

Scott Russell lnxgeek at us.ibm.com
Tue Jun 20 06:33:02 EDT 2006


Martin Schiøtz wrote:
> My next step is to install Spam control. My plan is to use
> Spamassassin with dcc, razor, pyzor and bayes system. A want mail
> users to be able to disable and enable spam control. I also wan't mail
> users that has enabled spam control to train (sa-laern) and keep their
> own bayes database.

Use spamc and spamd in combination with postfix. The postfix 
FILTER_README will help you out. In my master.cf I have

192.168.1.100:smtp
          inet  n       -       n       -       -       smtpd
    -o smtp_send_xforward_command=yes
    -o content_filter=spamc

127.0.0.1:smtp
          inet  n       -       n       -       -       smtpd
    -o local_recipient_maps=
    -o mynetworks=127.0.0.1
    -o smtpd_client_restrictions=permit_mynetworks,reject

spamc     unix  -       n       n       -       20      pipe
    flags=Rq user=spamd argv=/usr/bin/spamc -u ${user} -t 300
    -s 250000 -e /usr/sbin/sendmail -oi -f ${sender} -- ${recipient}

This has postfix feed all inbound smtp mail from 192.168.1.100 into the 
spamc transport and back out to the localhost:smtp transport after spam 
checking. Make sure you configure SA to store everything in your 
database (accounts, preferences, bayes) and take advantage of the spamc 
-u option to specify the SA username for loading individual preferences.

For training bayes, you will find much better performance using spamc + 
spamd instead of sa-learn and you'll get the same results. Create 
per-user spam training folders (maybe "Learn as SPAM" and "Learn as HAM" 
and have a script do the following:

1) From the DB, find all users with the SA pref 'use_bayes' enabled.
2) For each user, find the "Learn as SPAM" folder
3) Read each message in the folder and pipe it into spamc for training
4) Mark the message deleted and repeat for the next message in the folder
5) Expunge the folder
6) Locate the next "Learn as HAM" folder and repeat steps 3 - 5

A script like the above can be setup to run from cron as often as you need.
>
> I can see a lot docs about postfix, cyrus and amavisd-new but can
> amavis-new work with personal bayes db and sa-learn etc.?

No. Amavisd-new does site wide bayes only. If you want personal bayes 
you need to roll your own solution, which is what I did as described above.

-- 
Scott Russell <lnxgeek at us.ibm.com>
IBM Linux Technology Center System Admin



More information about the Info-cyrus mailing list