Valid User Checking Program
BY
Gregory Nowak
Copyright (C) 2004-2008 by Gregory Nowak
Version 0.2c, 28 May, 2008
As of version 0.2c, check if user@domain is defined in virtualdomains, and assume that address to be valid if it is found. We don't check for a domain preappend anymore in virtualdomains, the domain itself, or an e-mail address are considered as valid if they're found.
Version 0.2b now allows for relaying if $RELAYCLIENT is set in the environment. My humble opinion is that relaying should be allowed only to trusted users, so we don't check if an rcpt to address is valid or not when relaying. If you feel differently, this is a gpl program, and you are certainly welcomed and encouraged to submit a patch which still checks rcpt to addresses even if relaying is allowed.
Version 0.2, 16 June, 2004
Version 0.2 now works with Jay Soffian's $RCPTCHECK patch to qmail-smtpd, if "qmail" is #defined in the source code. Version 0.2 also includes a minor bug fix (see source code for details), as well as some cosmetic changes to make parts of the code more readable.
Version 0.1, 20 May, 2004
The valid user checking program is meant to be used in conjunction with the magic-smtpd program from http://www.linuxmagic.com. This program was tested with versions 0.8.2 through 0.8.3rc1 of the open source magic-smtpd program. As its name suggests, the valid user checking program acts as a back-end to magic-smtpd, and checks if a user exists on a email system running qmail. Unlike the valid user checking script provided with magic-smtpd, this program doesn't assume that you have the vpopmail package installed.
Installation Look through the "user-editable" section of check-user.c, and decide if check-user will be used with qmail, or with magic-smtpd. By default, check-user is setup for use with qmail via the $RCPTCHECK patch. If you will be using check-user with magic-smtpd, then find the following lines in check-user.c:
#define qmail 100 // invalid user return value for qmail-smtpd // #define magic 1 // invalid user return value for magic-smtpd
, and change them to read:
// #define qmail 100 // invalid user return value for qmail-smtpd #define magic 1 // invalid user return value for magic-smtpd
. All other values in the "user-editable" section of check-user.c should remain as they are, unless you have a specific reason for changing them.
To install the valid user checking program, run the following commands: 1. "gcc -o check-user check-user.c" 2. "strip check-user" 3. "cp check-user /var/qmail/bin/check-user" 4. "chmod 755 /var/qmail/bin/check-user" 5. "chown root.qmail /var/qmail/bin/check-user" That's it. Remember to activate valid user checking in magic-smtpd. Refer to the documentation that comes with magic-smtpd for instructions on how to do this.
Caveats 1. If you have a /var/qmail/alias/.qmail-me-something-default file, me-something@your_domain will be validated as a correct address, even though it's not. To get around this, I recommend that you create a /var/qmail/alias/.qmail-me-something file, and set the same delivery options as in /var/qmail/alias/.qmail-me-something-default. This problem doesn't effect virtual domain addresses. 2. If you are a backup MX for a domain, this domain has to exist in /var/qmail/control/virtualdomains, not just in /var/qmail/control/rcpthosts. In addition, the domain for which you are a backup has to be handled by autoturn, found in Dan Bernstein's serialmail package. 3. This program does not output the location of a user's spam directory, (magic-smtpd versions prior to 0.8.3rc1), as described in the magic-smtpd documentation, since I had no need for this feature. Anyone who would like to write and contribute a patch implementing this feature is certainly welcome to do so. 4. If you are running a list via ezmlm in /home/list/list, make sure that /home/list/list has 711 permissions. Otherwise, valid list addresses will be incorrectly determined as invalid.
This program is distributed under the gnu general public license, which means you can give copies to your friends or neighbors under certain conditions (see COPYING in the tar.bz2 archive for details.
)If you have any comments, bugs or suggestions concerning this program, please contact Gregory Nowak. Web Site: http://www.romuald.net.eu.org