vpopq_tcp (Robert Schulze <rob at rob-schulze.de>)

This package includes client and server to check whether a given recipient is valid for a mail host, preferrably on qmail-based systems. The server speaks a bit vpopmail API and does some checks on qmail-related files. It has to be used with tcpserver/(x)inetd and can easily be used by any simple client program. The client is specific to a qmail+spamcontrol mailsystem, handling incoming mail. Spamcontrol (>= 2.5.23) is able to drive any binary to check if the recipient is valid, this extension is used by the client.

Installation

Download and unpack the archive, then edit the Makefile. Have a look at the strings given as library (-L...) and include (-I...) paths.

Server

Edit vpopq_server.c and modify the values of QMAIL_ASSIGN and VPOPMAIL_BASEDIR to your needs.
QMAIL_ASSIGN represents the full path to the file "users/assign" below your qmail basedir.
VPOPMAIL_BASEDIR means the path where vpopmail is installed.

To build the server, you will need gcc, libmysqlclient, libvpopmail.
$ make server
... if everything works, the result is a binary called vpopq_server.

Setup tcpserver - or whatever TCP daemon you want to use - to drive vpopq_server on your magic port. A sample script to invoke tcpserver is included in the archive.

Conversation is quite simple and may be adapted by any client program:
Just send "foo@example.com\n" to the server, and it will send back one character as response and exit:
Beware if you try to use telnet to test the server, you will send "foo@example.com\r\n" in most cases, which will always fail.

The server does the following to determine if the recipient is valid:

Client

$ make client
... if everything works, the result is a binary called vpopq_client.

You may put the binary to /var/qmail/bin, but you have to edit the file /var/qmail/recipients.
Maybe try the client with one domain at first:
# ... example.com|/var/qmail/bin/vpopq_client 10.23.42.5 10001 # ... !*
If a mail to example.com arrives, this will tell qmail-smtpd to invoke vpopq_client which will query the vpopq_server on host 10.23.42.5 port 10001. Being quite pessimistic, mail will only be rejected when the client receives a valid negative answer, on other cases (valid address or error), delivery is permitted. If the connection to the server times out (2 seconds), the client will abort with a positive response.

Notes

This has been tested in production environment.
Use it WITHOUT WARRANTY, but don't bother about editing Makefiles and sources.

Known limitations

Download:

2009-03-24 vpopq_tcp-0.1 (SHA256: 8ef5d43515d72ce0b5a341fac62c7d9e2d49ae58ed135f84e2fbd2f11f8f7c9c)
initial release