Daniele Duca
BOFH excuse for today:  Boss' kid fucked up the machine
Server date is: 20/4/2024

This site best viewed with eyes

Say NO to software patents!

20/04/04 - Release 0.1

Assuming you already have a working qmail+vpopmail installation, with this paper you will be able to install and use spamassassin, a very good piece of software that can help you a lot fighting spam.

I use spamassasin with maildrop, so if you want to use this paper you should install maildrop too.

1) Download maildrop from here

2) Untar, configure an make it, basically you will need to:
$ tar xvfj maildrop-X.X.X.tar.bz2
$ cd maildrop-X.X.X
$ ./configure [options available with ./configure --help]
$ make
# make install-strip [as root]
# make install-man [as root]

3) Go to your domain directory, normally located in /home/vpopmail/domains/yourdomain.com

4) Edit .qmail-default, remove every line and type "| /usr/local/bin/maildrop mailfilter" (without quotes)

5) Create a file called mailfilter, and type:
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`
`test -d $VHOME/Maildir`
if ( $RETURNCODE == 1 )
{echo "Sorry, no mailbox here with that name."

`test -f ../spamfilter`
if( $RETURNCODE == 0)
include ../spamfilter

6) Create a file called VPOP and type:
| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox

7) Be careful with file permissions:
# chown vpopmail.vchkpw mailfilter
# chown vpopmail.vchkpw VPOP
# chmod 600 mailfilter
# chmod 600 VPOP

You have now a (hopefully) working system with maildrop; you should not notify any change in the delivery or anything else.

Now you should install spamassassin:

1) Download it from here.

2)Untar, configure an make it:
$ cd Mail-SpamAssassin-*
$ perl Makefile.PL
$ make
$ make install (as root)

After that you should have spamd (the daemon) and spamc (the client) installed system wide.

3) Create the directory needed for spamassassin:
# cd /home/vpopmail
# mkdir .spamassassin
# chown vpopmail.vchkpw .spamassassin

4)Edit /etc/mail/spamassassin/local.cf to fit your needs, very minimal setup:
bayes_path /home/vpopmail/.spamassassin/bayes
report_safe 0
required_hits 7.0
rewrite_subject 1
report_header 1
defang_mime 1
dns_available yes
add_header all DCC _DCCB_: _DCCR_
use_dcc 1

5) Edit /home/vpopmail/domains/spamfilter and type
xfilter "nice -n 10 spamc -f -t 20"

6)change the permission of the file
# cd /home/vpopmail/domains
# chown vpopmail.vchkpw spamfilter
# chmod 600 spamfilter

7)Now, download the start script for spamassassin, copy it to /etc/init.d and chmod +x /etc/init.d/spamassassin

8) Finally, start the spamd daemon
# /etc/init.d/spamassassin start

You should now have a working setup that will mark every junk mail with "***** SPAM *****" in the subject and will also add 3 spamassassin headers to every email. With these header you will be able to fine tune your installation.

You can get more informations about spamassassin, new spam rules and other related software here

If you encounter problems, feel free to write me.


No liability for the contents of this document can be accepted. Use the concepts, examples and other content at your own risk. There may be errors and inaccuracies that may damage your system. Proceed with caution, and although this is highly unlikely, the author does not and can not take any responsibility for any damage to your system that may occur as a direct or indirect result of information that is contained within this document. You are strongly recommended to make a backup of your system before proceed and adhere to the practice of backing up at regular intervals.

Informations on this page are released under the GNU FDL License
This page last updated: 08/12/05