Spam throttling for qmail

You can download the latest version for qmail-1.03, for netqmail-1.05, or for qmail-ldap. Proceed to the patches area to browse the patch directory.


Note: A qmail-ldap version of the patch is available.

Note: A netqmail-1.05 version of the patch is available.

Note: The latest patch should apply very nearly cleanly to netqmail-1.04

Note: The latest patch should apply cleanly to netqmail-1.04

The idea of spam throttling came about after would-be spammers were easily circumventing (classic) tarpitting. A reasonable recipient limit in tarpitting must not adversely affect acceptable mail usage, so spam clients typically create multiple SMTP connections, all of which fall under this threshold. Surprisingly, tarpitting is still recommended by many people despite its obvious shortcomings. The inclusion of teergrubing in the spam throttle patch should make it a suitable replacement.

Other sources have similar concepts, using rate limiting, stuttering, et cetera to describe them.

This patch is intended for large or high-volume mail servers, especially ISPs, but is also suitable for small/home servers where potential mail abuse exists.

You might also want to read the man page.

Exim and Postfix have nearly similar ideas already implemented, though they are not quite as "sophisticated". If there's sufficient interest, we would create a similar patch for those two MTAs (or others too, excluding sendmail of course).

Update (13 Sep 2004): A qmail-ldap version of the patch is now available.

Update (22 Jul 2004): A netqmail-1.05 version of the patch is now available.

Update (21 Apr 2004): Kevin Kadow confirms that the 2.02 patch will apply very nearly clean to netqmail-1.05. One patch hunk in qmail-smtpd.c will fail. Since it is a cosmetic change, there is no impact on the resulting source or targets. A future release of the spamthrottle patch will not have this problem.

Update (08 Jan 2004): Confirmed that the 2.02 patch will apply cleanly to netqmail-1.04.

Update (19 Aug 2003): Release 2.02. This just fixes a bug when the spamt file consists only of a default entry with no directory specified.

Update (31 Dec 2002): Release 2.01. This is a complete rewrite/redesign of the "control interface". A cdb-style format is used now instead of relying on plain control files and environment variables. The new format should be much easier to maintain and not require tcpserver, although tcp-env (or something that provides TCPREMOTEIP) is required. Also, the sleep loop has been modified to call getpeername() every second; the loop should terminate early if the client closes its connection prematurely.

Update (6 Dec 2002): Hossein Lotfi reported a compilation problem when trying to use the spamthrottle patch in conjunction with Iain Patterson's MySQL + qmail patch. Assuming you apply Iain's patch, then the spamthrottle patch, you can apply this patch afterwards.

Update (6 Mar 2002): Oops. The softlinks for the current patch were broken, although one could still grab the version-stamped patches. Fixed.

Update (26 Feb 2002): Release 1.03. Fixed a few bugs all related to use of the time modules when not using libtai. Fixed a bug where spamthrottlercpt was documented as having a default of 0 when it really had a default of 1 (the default really is 0 now).

Update (19 Feb 2002): Release 1.02. Fixed a bug with teergrubing where continuation lines were not being flushed.

Update (19 Feb 2002): Release 1.01. Fixed a bug where packed taia values were not being written to the time file (thanks to Roland Chan). We've also added support for teergrubing. Please see the documentation for details.