Guide updated on 29th of February 2016

Implement validrcptto feature

The goal is to verify the RCPT TO argument, and reject (at SMTP level) messages which were being sent to non-existent addresses.

Qmail sources needs to be patched as described in Step 2. If you've followed the entire guide, this is already done.

aptitude install freecdb libcdb1 libcdb-file-perl libcdb-dev

Unfortunately, the freecdb package provides not all the commands from original D.J. Bernstein tar file (cdbmake-12 and cdbmake-sv are missing). We have to compile to have the missing commands.

cd /downloads/
gzip -dc < cdb-0.75.tar.gz | tar -xf -
cd /downloads/cdb-0.75
echo 'gcc -O2 -include /usr/include/errno.h' > conf-cc
make setup check

Then install mkvalidrcptto script and test all used libraries are loaded correctly:

cp /downloads/scripts/mkvalidrcptto /usr/local/bin
chmod 755 /usr/local/bin/mkvalidrcptto
perl -cwT /usr/local/bin/mkvalidrcptto

You should see something like that:

mkvalidrcptto syntax OK

We can now create a first CDB file containing all the created accounts

cd /var/qmail/control/
mkvalidrcptto > validrcptto.txt
cdbmake-12 validrcptto.cdb validrcptto.tmp < validrcptto.txt

We finally will start using it.

To achieve this, edit the file /var/qmail/supervise/qmail-smtpd/run and uncomment following options :


Automate the update of valid adress list

cp /downloads/scripts/update-validrcptto /etc/cron.hourly/
chmod +x /etc/cron.hourly/update-validrcptto

If you need each change to be reflected immediately, do not put script in cron but compile vpopmail with the --onchange feature.

In such case, read the file /downloads/vpopmail-5.4.33/doc/README.onchange for more information

Restart the service

qmailctl restart

External reference

List of optional features

Users comments