It’s about frickin’ time that I added support for DSPAM to my mail server. I use a Postfix+Courier+IMAP+MySQL combination for mail administration as I have a fair deal of domains and users in the system (Read more about the mail setup here).
I will document my steps in trying to fit DSPAM into this mix on this page in the hopes that it will help me or you!
Btw, I’m doing this on a machine running Fedora Core 1, but I guess it’d work fine with most Linux setups.
Firstly, download DSPAM (I choose the latest beta, v3.4-BETA 1, always living on the edge)
I tested my luck with ./configure, but it just threw an error my way:
checking sqlite.h usability... no checking sqlite.h presence... no checking for sqlite.h... no configure: error: Required version of libsqlite not found
So, I actually had to RTFM, at least the README.
Figured I would use MySQL as the backend and I tried the following: ./configure --with-storage-driver=mysql_drv --enable-daemon --enable-virtual-users --enable-preferences-extension. This gave me a new error:
checking where to find MySQL headers... compiler default paths checking mysql.h usability... no checking mysql.h presence... no checking for mysql.h... no configure: error: Required version of libmysqlclient not found
Oh well, using ./configure --with-storage-driver=mysql_drv --enable-daemon --enable-virtual-users --enable-preferences-extension --with-mysql-includes=/usr/include/mysql/ --with-mysql-libraries=/usr/lib/mysql/ *puuh*, made all the difference.
Now just run make && make install and watch the magic happen.
Next, create a new database in MySQL and create a new user that has privileges to this database. Run the enclosed .sql-scripts (found under src/tools.mysql_drv/. Which ones you run will depend on your version of MySQL and whether or not you want to use virtual users with DSPAM. I chose to use mysql_objects-speed.sql and virtual_users.sql.
Next I chmod‘ed and chown‘ed the /usr/local/var/dspam/ directory so both the postfix and the apache user can use the files therein.
Also made sure to edit /usr/local/etc/dspam.confset trusted user to myself, root, apache and postfix and also set the correct MySQL settings:
MySQLServer /var/lib/mysql/mysql.sock MySQLPort MySQLUser dspamuser MySQLPass secretpassword MySQLDb dspam MySQLCompress true
Next we create /etc/maildroprc like so:
SHELL="/bin/bash"
if (/^X-Spam-Status: Yes/:h || /^X-DSPAM-Result: Spam/:h)
{
# See if the Spam folder exists.
`test -d "./Maildir/.Spam/"`
if ($RETURNCODE != 0)
{
# If not, create directories
`mkdir ./Maildir/.Spam/`
`mkdir ./Maildir/.Spam/cur`
`mkdir ./Maildir/.Spam/new`
`mkdir ./Maildir/.Spam/tmp`
}
to "./Maildir/.Spam/."
}
Now chmod and chown the file so the postfix user can run the file.
Add dspam_destination_recipient_limit = 1 to /etc/postfix/main.cf.
Recent Comments