Wednesday, February 21, 2007

qpsmtpd for anti-spam

Here are the steps to use qpsmtpd:

Get qpsmtpd from http://smtpd.develooper.com/
Extract and put for example on /usr/local/qpsmtpd
Change the port number of currently running qmail from 25 to, for example, 2525
Put (or uncomment) the following line on /usr/local/qpsmtpd/config/plugins
queue/smtp-forward localhost 2525
Make a symbolic link from daemontools' service directory to /usr/localqpsmtpd

The qpsmtpd will then run with default plugins. A list of plugins can be found at http://wiki.qpsmtpd.org/plugins

Here are some plugins that require extra work to set:

check_validrcptto_cdb
This plugin can be downloaded from http://robinbowes.com/projects/check_validrcptto_cdb. This plugin requires a database (cdb file) of valid recipient addresses, which can be made with mkvalidrcptto and cdbmake-12 program, a part of djb's cdb package. A cron job as follows will then periodically make the list of valid RCTP TO addresses and turn into cdb file:



#!/bin/sh
PATH=/usr/bin:/bin:/usr/local/bin:/var/qmail/bin
cd /var/qmail/control

if [ ! -f validrcptto.txt ] ; then touch validrcptto.txt ;

fi mkvalidrcptto > validrcptto.new if ! diff validrcptto.txt validrcptto.new > /dev/null 2>&1
then
cdbmake-12 validrcptto.cdb tmp$$ < validrcptto.new chmod 644 validrcptto.cdb validrcptto.new
fi

mv -f validrcptto.new validrcptto.txt



Then put this line on /usr/local/qpsmtpd/config/plugins
check_validrcptto_cdb /var/qmail/control/validrcptto.cdb

References:
O'Reilly Using Qpsmtpd

No comments: