validrcptto

An important part of John Simpson's Combined Patch is the validrcptto.cdb patch which allows your server to check the RCPT TO argument and reject messages which were being sent to non-existent addresses. This is a great way to decrease the amount of spam your server has to process as dictionary attacks are a common spammer technique.

The validrcptto patch consults a CDB file, /var/qmail/control/validrcptto.cdb which should contain every valid email address and alias on your server. Rather than generate this list manually or try to create our own script to do it, we'll utilize John Simpson's mkvalidrcptto script.
We've already installed djb's CDB program, so we can proceed with installing the CDB_File Perl module. If you've never used the CPAN shell before on this server, you'll need to configure it the default options it provides should be adequate.

perl -MCPAN -e shell
install CDB_File
exit

In case the Perl module didn't install with the correct permissions, we'll use John Simpson's pfix script to fix them.

cd /usr/local/bin
wget http://www.jms1.net/code/pfix
chmod 755 pfix
pfix

Installing the mkvalidrcptto script is simple matter of downloading it:

cd /usr/local/bin
wget http://qmail.jms1.net/scripts/mkvalidrcptto
wget http://qmail.jms1.net/scripts/mkauth
chmod 755 mkvalidrcptto mkauth

To create the initial CDB files, run mkvalidrcptto and mkauth commands with the -c option:

cd /var/qmail/control
mkvalidrcptto -c /var/qmail/control/validrcptto.cdb
mkauth -c /var/qmail/control/auth.cdb

SMTP run script
The run script for your SMTP service might need to be modified to enable validrcptto checks. Uncomment:

VALIDRCPTTO_CDB="$VQ/control/validrcptto.cdb"
VALIDRCPTTO_LIMIT=5
VALIDRCPTTO_LOG=2

Excluding addresses from validrcptto
In order to exclude some email addresses from the validrcptto file and not accept delivery to them, they can be added to /usr/local/bin/mkvalidrcptto by editing this section:

# any entries listed in this array will NOT be included in the output
my @exclude = qw
(
sample1@domain.xyz
sample2@domain.xyz
) ;

Credits

Various bits of code, scripts, and procedures were put together with information from John Simpson's qmail.jms1.net website. It's an excellent resource on managing and setting up a Qmail server.

Recent Updates

  • 1 year 12 months ago
  • 1 year 12 months ago
  • 1 year 12 months ago
    php 8.x
  • 1 year 12 months ago
    10.6.7
  • 2 years 23 hours ago
    Drop Centos 5/6 stuff