Tuesday, February 21, 2006
Qmail - Valid User Checking
One thing that has always irked me about qmail is the lack of valid user checking. The qmail-smtpd will always accept mail for delivery regardless of weather the address given in the rcpt to: field exists for the given domain. The message is then processed at which time qmail realizes that's not a valid user and generates a bounce message. In the case of spam where the from address is probably forged the bounce bounces back or worse still the spammer things he has a live email address and spams it even harder.
A bit of a scratch around on the net reveals 2 solutions to this problem.
qpsmtpd
magic mail
As I read it qpsmtpd needs the real smtp daemon to sit on another port (eg 2525) and it passes sessions through to that port after it passes the checks qpsmptd makes. That kind of approach seems a little out of place to me, but qpsmtpd does have some nice features.
In the end I went for magic mail. It is a direct replacement for qmail-smtpd. What follows is my notes on getting started with magic mail on Ubuntu 5.10:
I installed this on to of a qmail installation based on the one outlined by Qmail Rocks.
A bit of a scratch around on the net reveals 2 solutions to this problem.
qpsmtpd
magic mail
As I read it qpsmtpd needs the real smtp daemon to sit on another port (eg 2525) and it passes sessions through to that port after it passes the checks qpsmptd makes. That kind of approach seems a little out of place to me, but qpsmtpd does have some nice features.
In the end I went for magic mail. It is a direct replacement for qmail-smtpd. What follows is my notes on getting started with magic mail on Ubuntu 5.10:
I installed this on to of a qmail installation based on the one outlined by Qmail Rocks.
Download magic mail 0.8.4
To get it to work with gcc4 remove line from the file magicmail-0.8.4-2/magic-smtpd/magic-smtpd.h:
extern lm_string_t smtp_from_addr;
(Will be fixed in next version)
I changed Makefile.inc to USE_TLS
Run through the installation instructions.
Be sure to create the /etc/magic-mail/control directory.
I wanted valid user checking
echo true > /etc/magic-mail/control/check_valid_users
Which tells magic mail to check valid users
cp magicmail-0.8.4-2/scripts/vpopmail-check-user.sh /home/vpopmail/bin
chown vpopmail:vchkpw vpopmail-check-user.sh
Doesn't appear to work correctly unless chown'ed correctly
This program does the valid user check
Tell magic-mail to use it
vi /etc/magic-mail/control/ext_check_user_prog
Make this file contain the following line only
/home/vpopmail/bin/vpopmail-check-user.sh