Installing DSPAM with QMAIL, VPOPMAIL AND POP3 HOWTO

The updated document will always be available at http://www.root.sg/index.php/Integrating_DSPAM_with_Qmail%2C_Vpopmail_and_Maildrop_HOWTO

Notes : The --enable-qmail-ext=y must be on during the vpopmailcompilation. This is to make sure vpopmail can read .qmail files. Thishowto is also based on a debian installation. Configuration options mayvary.

DSPAM official website at http://dspam.nuclearelephant.com/

#Download the latest DSPAM source

cd /usr/local/src

wget http://dspam.nuclearelephant.com/sources/dspam-3.6.2.tar.gz

tar xzvf dspam-3.6.2.tar.gz

cd dspam-3.6.2

#Compilation options

make && make install

#Set up MySQL database and tables:

mysql -u root -p >grant all privileges on dspamdb.* tovpopmail@localhost identified by 'password';

#Create the following file called mysql.data

vi /usr/local/dspam/mysql.data

#Add this in

#Create the trusted.users file:

echo "vpopmail" > trusted.users

Now we will begin the actually integration with QMAIL, VPOPMAILandMAILDROP. This concept is based upon a shared hosting environmentwithlots ofdomains under VPOPMAIL.

Our example will be example.com. The general idea for users of example.com will be to forward spam messages to spam@example.com . spam@example.com must then know who sent it the spam message and will be able to classify the spam message according to the preference of the user who forwarded the spam mail. The signatures will be stored in the mysql database.

First,

Trust root Trust mail Trust mailnull Trust smmsp Trust daemon Trust vpopmail <- add in vpopmail

#The .qmail-default file will have to be changed to the following :

#Add this in

#Change permission of the file

This will make all mails coming in to be passed on to dspam for training and for dspam to tag it, giving it a signature. After going through dspam, the mail will be passed on to maildrop for delivery using stout. Maildrop will use /home/vpopmail/global_mailfilter to filter emails. In our filter configuration, mails with "X-DSPAM-Result: Spam" in its header will be identified by maildrop and sent into the .SPAM folder. Below is the global_mailfilter that I used :

#example:

||<tablewidth="206px" tableheight="50px" tablealign="">

SHELL="/bin/sh" import EXT import HOST

VHOME=/home/vpopmail/bin/vuserinfo -d $EXT@$HOST VPOP=/usr/bin/head -1 .vpop

if (/^X-DSPAM-Result: Spam/) {

} else {

}||

#Next, we will create a .vpop file to tell qmail what to do with mails without any a valid recipient on the server.

vi /home/vpopmail/domains/example.com/.vpop

| /home/vpopmail/bin/vdelivermail bounce-no-mailbox

chown vpopmail.vchkpw .vpop

#This will tell vpopmail to bounce messages without a valid mailbox.

#Lastly, we will have to create a spam@example.com user. This does not have to be a valid POP user on the server. It can be just a forwarding account for users to forward spam to.

vi /home/vpopmail/domains/example.com/.qmail-spam

|/usr/local/dspam/bin/dspam --user $SENDER --mode=teft --class=spam --source=error

chown vpopmail.vchkpw .qmail-spam

#For more information regarding the qmail environment variables used in this documentation such as $EXT, $HOST, $SENDER, please check out lifewithqmail.org

#Forwarding spam to spam@example.com will tell spam@example.com to retrain the message as spam and update the database of the user who sent the spam.

last edited 2006-07-13 03:31:26 by zhihao