Guide updated on 29th of December 2011

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.

cd /downloads/
tar xvzf cdb-0.75.tar.gz
cd /downloads/cdb-0.75
sed -i '/int errno/{s/^/\/* /;s/$/ *\//;G;s/$/#include <errno.h>/;}' error.h
make
make setup check

cd /downloads/deb-packages
dh-make-perl --build --install --cpan 'CDB_File'
dpkg -i /downloads/deb-packages/libcdb-file-perl_0.97-1_i386.deb

cp /downloads/scripts/mkvalidrcptto /usr/local/bin
chmod 755 /usr/local/bin/mkvalidrcptto
cd /var/qmail/control/
/home/vpopmail/bin/vadddomain Your-server-FQDN random-password
mkvalidrcptto > validrcptto.txt
cdbmake-12 validrcptto.cdb validrcptto.tmp < validrcptto.txt

Edit the file /var/qmail/supervise/qmail-smtpd/run and uncomment following options :

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

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

http://qmail.jms1.net/patches/validrcptto.cdb.shtml
http://www.x86linux.org/wiki/index.php/Valid_RCPT_TO_for_qmail

List of optional features


Users comments
Thibs - 03/09/2011 12:10

Another solution is to use my compiled package for AMD64 architecture libcdb-file-perl_0.97-1_amd64.deb

And I if needed still have an older version for I386 libcdb-file-perl_0.96-1_i386.deb

Note that it 'll be useless in next Debian version because the package 'll be included in the distribution http://packages.debian.org/sid/amd64/libcdb-file-perl/download

Hip0 - 02/09/2011 13:12

Heya again Thibs,

This is the work around on how to compile on amd64 architecture, though not the debian way:

debian:~#  ls -ld *CDB*/
drwxr-xr-x 5 root root 4096 Sep  2 12:08 CDB_File-0.97//
drwxr-xr-x 5 root root 4096 Sep  2 12:00 CDB_File-0.97.12987//
drwxr-xr-x 5 root root 4096 Sep  2 12:05 CDB_File-0.97.18426//
drwxr-xr-x 5 root root 4096 Sep  1 13:57 CDB_File-0.97.46521//
drwxr-xr-x 5 root root 4096 Sep  2 11:52 CDB_File-0.97.56405//
drwxr-xr-x 5 root root 4096 Sep  2 11:58 CDB_File-0.97.59617//
drwxr-xr-x 5 root root 4096 Sep  2 11:59 CDB_File-0.97.62262//
drwxr-xr-x 5 root root 4096 Sep  2 12:09 CDB_File-0.97.64740//

debian:~# cd /downloads/deb-packages/CDB_File-0.97.64740

debian:/downloads/deb-packages/CDB_File-0.97.64740# perl Makefile.PL && make && make test && make install

 

best!

Georgi

Hip0 - 02/09/2011 13:07

Hi Thibs ;)

I'm having compile troubles with:

 

# cd /downloads/deb-packages
dh-make-perl --build --install --cpan 'CDB_File'

 dh_installdeb
   dh_gencontrol
   dh_md5sums
   dh_builddeb
dpkg-deb: building package `libcdb-file-perl' in `../libcdb-file-perl_0.97-1_amd64.deb'.
make: Leaving directory `/downloads/deb-packages/CDB_File-0.97'
Can't locate object method "arch" via package "DhMakePerl::Command::make" at /usr/share/perl5/DhMakePerl/Command/make.pm line 307.

The compile fails

 

Here is

# uname -a;

Linux debian 2.6.32-5-amd64 #1 SMP Tue Jun 14 09:42:28 UTC 2011 x86_64 GNU/Linux

Gato - 07/08/2011 02:52

mkvalidrcptto > validrcptto.txt
Cannot continue.

solved with cat /var/qmail/control/me > /var/qmail/control/locals

Thibs - 20/08/2010 14:19

Hello Anoriel,

It's probably because your main domain has not been added in the system.

Try

/home/vpopmail/bin/vadddomain YOUR_DOMAIN PASSWORD_POSTMASTER

and/or

/home/vpopmail/bin/vadddomain YOUR_SERVER_FQDN PASSWORD_POSTMASTER

Anoriel - 20/08/2010 13:30

I think no becaus when I try to send an email to an existing address, I receive an error explaining that address does'nt exist in database...

Can someone help me please ?

Anoriel - 20/08/2010 13:21

Hi,

When i try this command:

mkvalidrcptto > validrcptto.txt

 

It give me this error:

Cannot continue.

 

Is this good ?


Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.