Regular expression matching power, now avaliable in a MTA!

While the native qmail ‘badmailfrom’ provides some ability to block spam it is fairly restricted as the match must be exact on either the full string or the domain. This means that it’s very difficult to block the 1234567@aol.com type addresses that some spammers are employing as you potentially require a large number of entries in ‘badmailfrom’.

Likes its predecesor the wildmat patch (which came from the INN product), qregex provides a higher level of control for evelope matching in the qmail-smtpd MTA. Wildmat used simple pattern matching, which while effective just wasn’t a true regular expression. qregex on the other hand implements the POSIX regex functions (found on most modern unices) to give the SMTP admin full control over the envelopes allowed to send mail through his/her mail servers.

With REs (Regular Expresions) it becomes quite easy to filter out email addresses that contain invalid characters or simply aren’t a real address. It also allows you to filter out these characters which are used to “source route” mail between mailservers, a technique spammers use. Below is a simple and short “badmailto” file from the qmail control files which stops all “source routing” formats that the abuse.net tests try.

# must not contain invalid characters, brakets or multiple @'s

Jan 29, 2002 release – qregex.patch-20020129.gz
Update/Bug fix
Further fixes the <sys/types.h> problem and updates the logic for the negate function.
All negate patterns should work properly now.

To install:
Download the .gz file, place it in your qmail source directory.
Run gzip -d qregex.patch-20011228.gz, then patch <qregex.patch-20011228 (or gpatch on solaris)
Read the file README.qregex

Jan 16, 2002 release – qregex.patch-20020116.gz
Bug fix
Fixes problem of needing to include <sys/types.h> on some systems.

Dec 28, 2001 release – qregex.patch-20011228.gz
v2 Rewrite
No longer uses stdio.h/stdlib.h/syslog.h, fits into qmail much better.

Scroll To Top