DSPAM With Embedded ClamAV Integrated Into Postfix With Virtual Users And Domains

Want to support HowtoForge? Become a subscriber!
 
Submitted by o.meyer (Contact Author) (Forums) on Tue, 2007-08-14 17:00. :: Anti-Spam/Virus | Debian | Postfix

DSPAM With Embedded ClamAV Integrated Into Postfix With Virtual Users And Domains

Version 1.0
Author: Oliver Meyer <o [dot] meyer [at] projektfarm [dot] de>
Last edited 08/14/2007

This document describes how to integrate DSPAM with embedded ClamAV into a mail server based on Postfix featuring virtual users and domains, i.e. users and domains that are in a MySQL database. It rests upon parts of the howto Virtual Users And Domains With Postfix, Courier And MySQL (Debian Etch) from Falko Timme.

The resulting Postfix server is functionally almost identic with the one from the howto above mentioned, but doesn't need Amavisd.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Preparation

Please follow the howto Virtual Users And Domains With Postfix, Courier And MySQL (Debian Etch) from Falko Timme from Step 1 - 8 before you proceed.

 

2 Add The debian-volatile Repository

We add the debian-volatile repository to the sources.list, to get a newer version of ClamAV than the one in the debian repository.

vi /etc/apt/sources.list

It should look like this:

# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main
 
deb http://ftp.uni-erlangen.de/pub/Linux/debian/ etch main
deb-src http://ftp.uni-erlangen.de/pub/Linux/debian/ etch main
 
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
 
# Debian Volatile
 
deb http://volatile.debian.org/debian-volatile etch/volatile main contrib non-free

Import the key for the debian-volatile repository:

wget http://www.debian.org/volatile/etch-volatile.asc -O- | apt-key add -

Now we refresh apt and update the system:

apt-get update && apt-get upgrade

 

3 Install DSPAM

apt-get install dspam dspam-doc libdspam7-drv-mysql

When you are asked to configure the database for libdspam7-drv-mysql with dbconfig-common, choose yes.

When you are asked for the database's administrative user's password, insert the one you chose in the howto before at step 4.

When you are asked for a password for libdspam7-drv-mysql, leave the field blank and choose OK. A password will be generated automatically.

 

4 Configure DSPAM

Now we have to edit the dspam.conf to our needs:

vi /etc/dspam/dspam.conf

Change the existing lines, that they look like this:

StorageDriver /usr/lib/dspam/libmysql_drv.so
DeliveryHost 127.0.0.1
DeliveryPort 10026
DeliveryIdent localhost
DeliveryProto SMTP
Preference "spamSubject=SPAM"
Opt out
TrackSources spam virus
ParseToHeaders on
ChangeModeOnParse on
ChangeUserOnParse off
ServerPID /var/run/dspam.pid
ServerMode auto
ServerPass.Relay1 "secret"
ServerParameters "--deliver=innocent"
ServerIdent "localhost.localdomain"
ServerDomainSocketPath "/var/spool/postfix/var/run/dspam.sock"
ClientHost /var/spool/postfix/var/run/dspam.sock
ClientIdent "secret@Relay1"

Enable this configuration for all users:

vi /var/spool/dspam/group

It should look like this:

dspam:shared:*.example.com

Go sure that you replace example.com with a valid FQDN, otherwise your Postfix might not work properly!

Enable DSPAM:

vi /etc/default/dspam

Change START=no to START=yes

Start DSPAM:

/etc/init.d/dspam start


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.