should I use RBLs? home : internet : mail : toaster : filtering : qmail-smtpd patches chkuser

Patches to qmail-smtpd.

We block invalid users (based on chkuser patch), address blocking lists: badmailfrom, badrcptto, qregex, and other patches depending on what version of Mail::Toaster you are using.

The latest version of Mail::Toaster includes the following patches:

  • spf
  • chkuser (check for valid local users, syntax)
  • spam throttle
  • qregex (regular expression matching in badmailfrom and badmailto)
  • qmail-tap

There are seperate pages detailing the chkuser and SPF patches.


To implement the qregex patches, read the following:

  • man qmail-smtpd
  • more /var/qmail/doc/README.qregex

Here's a couple good ideas for using qregex:

  • 1. block helo hostnames that are not hostnames
    • echo "!\." >> /var/qmail/control/badhelo
  • 2. force users to fully qualify themselves (i.e. deny "user", accept "user@domain")
    • echo "!@" >> /var/qmail/control/badmailfrom
  • 3. destination email addresses must not contain invalid characters
    • echo "[!%#:*^ {}]" >> /var/qmail/control/badmailto
    • echo "@.*@" >> /var/qmail/control/badmailto

Read the man pages for more details.

Spam Throttle:

If you are interested in implementing spam throttle, read the following man pages:

  • man qmail-spamthrottle
  • man qmail-spamt
  • mail qmail-newst

If you just want some reasonable defaults, do this:

  • echo "::1501:120000::1000::::" > /var/qmail/control/spamt
  • echo "." >> /var/qmail/control/spamt
  • /var/qmail/bin/qmail-newst


Qmail-tap allows you to archive emails sent through your email system. Read all about qmail-tap on the inter7 web site. To use qmail-tap with Mail::Toaster, you need to manually apply the patch to netqmail and re-install netqmail. There is a customized version of the qmail-tap patch in the contrib directory that will apply cleanly. It's normally as easy as getting into the netqmail build directory (/usr/local/src/mail/netqmail-x.xx/netqmail-x.xx, applying the patch (patch < path/to/qmail-tap.patch), and running "make setup".

SPF (Sender Policy Framework)

Last modified on 5/26/05.