Add DCC (Distributed Checksum Clearing Houses),
Pyzor and Razon checks in Spamassassin on Debian Lenny / Howto
improve spamassassin anti spam protection on Debian GNU /
Linux
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.