HowTo: DSpam on DA/FreeBSD

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,100
Location
Switzerland
Here is how I built Dspam on FreeBSD 5.4, MySQL 4.1, Spamblocker 2.
I'm not using the CGI that allows a user to manage its preferences.
This is just a document to get you started and you need to be familiar with the way exim.conf works and its syntax to make Dspam work the way you want it to.
I'm no security expert and the way this is configured may open security holes.
Use at your OWN risk, I accept no reponsabilities.

----------------------
BUILDING
----------------------
Download the source[1], unpack and create a build file.

In the build file, paste something like this

Code:
#!/bin/sh
./configure \
--enable-debug \
--enable-domain-scale \
--with-storage-driver=mysql_drv \
--with-mysql-includes=/usr/local/include/mysql \
--with-mysql-libraries=/usr/local/lib/mysql \
--enable-virtual-users \
--enable-preferences-extension \
--with-dspam-home=/var/dspam \

-The MySQL backend is recommended
-You can put your dspam home anywhere you like, it will just store the stats and the logs because since the quarantine system only talks mailbox, it is not recommended to use it on a DA box running Dovecot (and Dovecot is the future).
-The debug option is optional, but doesn't cost you much in term of performance, so you can leave it there.

----------------------
MySQL
----------------------
After that, you need to create the MySQL database and insert mysql_objects-4.1.sql and virtual_users.sql (located in src/tools.mysql_drv).

----------------------
DSPAM.CONF
----------------------
In dspam.conf, most of the things will be automatically configured from the arguments you supplied to configure.
You still need to modify a couple of things:

-Uncomment the Exim TrustedDeliveryAgent
-Only Trust root and mail
-Populate this with your own data:
Code:
#MySQLServer            /var/lib/mysql/mysql.sock
#MySQLPort
#MySQLUser              dspam
#MySQLPass              changeme
#MySQLDb                dspam
#MySQLCompress          true

----------------------
EXIM
----------------------
exim.conf needs to be modified to be able to clear emails through dspam. You can use the config from the Wiki[2].
Make sure you comment out the SpamAssasin router and transport.

The only change you have to do is to make sure all emails are delivered, not only the innocent ones. So, use:
Code:
--deliver=innocent,spam
for the first transport.
You are then able to deliver emails taged as spam to the chosen (via DA) spam mailbox of the user by configuring the domain exim filters.
Code:
if
   $header_X-DSPAM-Result: contains "Spam"
then
...

----------------------
UIDs
----------------------
The tricky part with Dspam is to find the best way for you to handle Dspam user ids, so that users can report spams and false positives. It all depends whether you use Exim routers or crons that monitor specific folders. There are many options, read the doc...
[3]

----------------------
DEFAULT PREFS
----------------------
It's time to configure the default user.
In the console type:
Code:
# dspam_admin ch pref default trainingMode TEFT
# dspam_admin ch pref default spamAction quarantine
# dspam_admin ch pref default enableWhitelist on
# dspam_admin ch pref showFactors off
# dspam_admin ch pref signatureLocation headers

----------------------
TRAINING
----------------------
You can also use a globaluser to give your users some base dictionary. There is a SA Trainer tool that you can use.
It's available from the DSpam download page [1].

----------------------
Maintenance
----------------------
You can add some maintenance script to a cron so that the DB is purged every day (example in src/tools.mysql_drv) and that's it, there is not much more maintenance to do.

----------------------
REFERENCES
----------------------
[1]http://dspam.nuclearelephant.com/download.shtml
[2]http://dspamwiki.expass.de/Installation/Exim/Exim
[3]http://dspam.nuclearelephant.com/text/README-3.6.2.txt
 
Last edited:
Back
Top