In accordence to a recent qmail install, here is few things to install in order to improve the native spamassassin anti-spam mail server protection capabilities.
1. Install Pyzor and Razor
debian-server# apt-get install pyzor razor
2. Edit /etc/mail/spamassassin/local.cf and put the following lines in it:
use_razor2 1
razor_config /etc/razor/razor-agent.conf
razor_timeout 8
use_pyzor 1
pyzor_path /usr/bin/pyzor
add_header all Pyzor _PYZOR_
clear_report_template
3. Edit /etc/mail/spamassassin/v310.pre and make sure the following lines are included and uncommented:
loadplugin Mail::SpamAssassin::Plugin::DCC
loadplugin Mail::SpamAssassin::Plugin::Pyzor
loadplugin Mail::SpamAssassin::Plugin::Razor2
loadplugin Mail::SpamAssassin::Plugin::SpamCop
4. Now we modify /etc/mail/spamassassin/local.cf once more to enable Bayesian Filtering, so include in the conf the following:
use_bayes 1
bayes_file_mode 0700
bayes_path /var/spamd/.spamassassin/bayes
bayes_auto_learn 1
bayes_auto_learn_threshold_nonspam 0.1
bayes_auto_learn_threshold_spam 8.0
use_auto_whitelist 1
In my case I use /var/spamd/.spamassassin directory for bayesian filter files, anyways you might desire to have it in a different lacation, however if you desire to use the same directory as me, make the appropriate directories and files as shown below:
debian-server# mkdir -p /var/spamd/.spamassassin/
debian-server# touch /var/spamd/.spamassassin/bayes_{seen,toks} /var/spamd/.spamassassin/bayes
debian-server# chown -R vpopmail:vchkpw /var/spamd/
Note that in the above example whenever I’m using user vpopmail:vchkpw I did that because my spamassassin is running under the vpopmail:vchkpw user and group, in case if you’re using a different uid and gid please change the commands in accordance with ‘em.
5. Next we need to download and install the required DCC (Distributed Checksum Clearing Houses) binaries, Regrettably no debian package is available so we will compile it and install it from source:
debian-server# wget http://www.rhyolite.com/dcc/source/dcc.tar.Z
debian-server# tar -zxvf dcc.tar.Z
debian-server# cd dcc-1.3.120/
debian-server# ./configure && make && make install
debian-server# cdcc info > /var/dcc/map.txt
debian-server# chmod 0600 /var/dcc/map.txt
debian-server# rm /var/dcc/map
debian-server# cdcc "new map; load /var/dcc/map.txt"
debian-server# cdcc "delete 127.0.0.1"
6. Again we have to edit /etc/mail/spamassassin/local.cf and include in it:
use_dcc 1
dcc_timeout 8
dcc_home /var/spamd/
dcc_path /usr/local/bin/dccproc
add_header all DCC _DCCB_: _DCCR_
7. Last I include few configuration options I find handy, this is not required to have pyzor, razond and DCC properly configured, so it’s completely up to you to decide if you want that or not:
rewrite_subject 1
subject_tag [SPAM found in message]
dns_available yes
ok_locales all
add_header spam Flag _YESNOCAPS_
report_safe 1
Herein I also include a link to my whole local.cf spamassassin configuration file in a hope that it’s easier to check the above directives directly in the conf.
More helpful Articles

Tags: checksum, clearing, distributed, houses, pyzor, razon
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14) Gecko/2009091008 Iceweasel/3.0.14 (Debian-3.0.14-1)
P.S. rewrite_subject and subject_tag is now obsoleve with version of spamassassin 3.x or higher.
View CommentView CommentIt should be substituted with:
rewrite_header Subject spamassassin local.cf directive.
Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6
One more thing, I forgot to mention.
It is wise to check spamassassin local.cf configuration before spamassassin is restarted, to do so issue:
debian-server:~# spamassassin –lint
A sure sign that everything is fine with configuration is there are no warn: messages displayed, if you get some output from the command similar to:
“[48372] warn: lint: 1 issues detected, please rerun with debug enabled for more information”
Then edit local.cf resolve them and restart spamassassin
View CommentView CommentMozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6
Also few other necessery things until razor and pyzor start working, would probably be:
root@mail:~# su – spamd -s /bin/sh
View CommentView Commentspamd@mail:~$ pyzor discover
downloading servers from http://pyzor.sourceforge.net/cgi-bin/inform-servers-0-3-x
spamd@mail:~$
spamd@mail:~$ razor-admin –create
spamd@mail:~$ razor-admin –register
Register successful. Identity stored in /var/lib/spamassassin/.razor/identity-ru1p_uPumn