Dspam

From LQWiki
Jump to navigation Jump to search

Dspam is supposed to be a lot better than spamassassin.

I was using debian stable but with backports, mysql and the stable dspam version. I am using procmail and postfix to deliver mail.

First make a user for the filtering, the spam, the ham and the group.

useradd filter
useradd spam
useradd ham
useradd group1

Download the program and extract it to /usr/local/dspam.

Go to /usr/local/dspam and type

./configure --enable-delivery-to-stdout --enable-spam-delivery --with-storage-driver=mysql_drv --with-mysql-libraries=/var/lib/mysql/mysql/ --with-mysql-includes=/usr/include/mysql/

then type

make && make install
chmod 4755 /usr/local/bin/dspam /usr/local/etc/dspam.conf  /usr/local/bin/dspam  /usr/local/etc/dspam.conf /usr/local/var/dspam/data/ /usr/local/var/dspam/data/filter/ /usr/local/var/dspam/data/kzar/ /usr/local/var/dspam/data/kzar/kzar.* /usr/local/var/dspam/data/filter/filter.*

Now make your mysql database, make the tables and edit the config file for dspam so it knows to use them.

Make a group for the spam and ham users. You also have to tag on the end all the users who are going to use this. group1:shared:spam,ham,user1,user2etc

Heres the procmail recipe to use dspam

# dspam spam filtering:
:0fw
| /usr/local/bin/dspam --stdout --user $LOGNAME --deliver=innocent,spam

# Add spam tag
:0 f
* ^X-DSPAM-Result: Spam
| sed -e '1,/^$/ s/^Subject: /&[SPAM] /'

# Do ham / spam addresses
:0
* ^To.*spam
| /usr/local/bin/dspam  --class=spam --source=error --mode=teft

:0
* ^To.*ham
| /usr/local/bin/dspam  --class=innocent --source=error --mode=teft