Gentoo Wiki




This is a tutorial for implementing DSPAM with ClamAV as a content filter with Postfix on a Gateway machine forwarding to an internal mail server. This will allow you to install Postfix, Dspam, clamAV on a firewall to handle all mail delivery, filter contents of mail and forward the cleared mail to your internal mail server. This installation does include per user training as well as virtual user account checking, which will bounce mail to unknown mail addresses.

Warning: This is work in progress and might not work correctly for you. Please double check everything.

USE Flags

First we are going to add the use flags we need for each package.

Adds virtual-users clamav daemon mysql support for dspam

echo "mail-filter/dspam virtual-users clamav daemon mysql" >> /etc/portage/package.use

Adds mysql support for postfix

echo "mail-mta/postfix mysql" >> /etc/portage/package.use

Emerge needed packages

Before you emerge postfix, make sure you have no other MTA provider installed. This includes, ssmtp, qmail, sendmail, exim etc.

emerge postfix

We need to add the dspam users manually for the WebUI to work correctly. The WebUI uses suexec to function and the users runing the WebUI needs to have a UID/GUI higher then normal.

groupadd -g 1110 dspam
usermod -u 1110 -g 1110 dspam

Now we can emerge dspam

emerge dspam

This should install all needed packages including ClamAV / MySQL etc for dspam to function.


Thanks to all the guys on the dpsam-user mailing list for all the help. This tutorial is based on the following documentation:

Retrieved from ""

Last modified: Sat, 28 Jun 2008 06:58:00 +0000 Hits: 4,543