Unix is very simple, but it takes a genius to understand the simplicity (Dennis Ritchie)

Home

Linux

Iptables


Other Links

Slackware

Distro Watch

 

Any one interest in patching qmail with SpamControl an excellent extentions to qmail. For example The Recipients extension makes qmail-smtpd aware of acceptable Recipients and is employed in a none-RELAYCLIENT case only. The Recipients are kept in 'fastforward' compatible cdbs for a case-insensitive quick lookup during the SMTP session. ie to reject all non-existing emails for invalid users in the very early stages of SMTP negotiation.

Installation:

1) Patch your qmail source with SpamControl patch.
Download it from here

* Copy all files to the Qmail 1.03 source directory.
* (cd to qmail-1.03 and call tar -xzf DIR/spamcontrol-VRF_tgz.bin)
* Run ./install_spamcontrol.sh from the source directory. That's it

Customization: If you want you can edit conf-spamcontrol for some cool features before running ./install_spamcontrol.sh. For example ..

* Instead of a SMTP 450 Reply, you may want qmail-smtpd to return "550, sorry no mailbox by that name (#5.7.1)". In conf-spamcontrol use 'recipients550=yes'. The advantage is, that a potential Sender receives a quick bounce with the propper reason, instead a deferred one. The disadvantage is, that this might be used for address harvesting.

2. After patching qmail with spamcontrol stop qmail process may be by "qmailctl stop" ? :) (i'm sure you know how to stop qmail)

3. Run "make setup check" in qmail sources, then start qmail.

Wow your qmail would again runing smoothly with spamcontrol patched. but.. nothing happened yet. Okay let take a look how to stop emails for invalid emails id in the very start of SMTP negotiation with qmail-recipient extention which is part of spamcontrol.

For Recipients extension first you have to build a list of all virtual users (I assumes you're using qmail + vpopmail with no aliases). For building a list here is a script of "gudi", a very nice person, say my hello to him if you catch him on freenode :)

Note: You will need a perl Getopt::Mixed module for this script.

4. After downloading the "qmail-vpopmail-new2recipients.pl" script run this command to generate a users/recipients file for all virtual users of all of the virtual domains.

# perl qmail-vpopmail-new2recipients.pl -q=/var/qmail -v=/var/vpopmail -f=/var/qmail/users/recipients

Note: mine vpopmail directory is -v=/var/vpopmail replace this with your path may be -v=/var/qmail/vpopmail.

After that there should be a file /var/qmail/users/recipients (with all v.users addresses)

5. Run /var/qmail/bin/qmail-recipients to transform that list into a cdb: users/recipients.cdb

6. Edit control/recipients and include users/recipients.cdb therein
At that time, your control/recipients file may look like:

users/recipients.cdb

That's it your qmail mail server will now reject all emails destine for non-existing email IDs in starting stages of smtp negotiation. Spamcontrol comes with lot of other cool patches, for details read the "README.spamcontrol".