Tim's Sendmail REGEX Patches
Tim's Sendmail REGEX Patches
This patch will allow for regex checks of the body of all messages. It is based on
the existing MAP_REGEX work.
Warning! Use of this will result in users not being able to report
spam to your abuse@ email address!
If your running something newer than 8.11 then check out the newest version.
- Get a copy of sendmail 8.11.1 from sendmail.org
- Get a copy of the patch.
- Patch the source
patch < regex_patch
- Fix up devtools/Site/site.config.m4
add APPENDDEF(`confMAPDEF', `-DMAP_REGEX') (this may not be needed but wont hurt to ad)
add APPENDDEF(`confENVDEF', `-DREGEX_BODY')
- run sh ./Build
- update your cf/cf/config.mc by adding a LOCAL_CONFIG section like this:
LOCAL_CONFIG
#
# Regular expression to reject:
#
Kbodyregex regex -a@MATCH ^(spam|SPAM)
- Make config.cf with
make config.cf
- Test new config:
../../obj*/sendmail/sendmail -v -bs -C ./config.cf
mail from: me@here.com
rcpt to: root
data
message to test filter
.
- Change the regex to a real list of spam. rebuild and test again
Kbodyregex regex -a@MATCH (Millions of Email|new auto today|800-618-1495)
If sendmail won't filter on the patterns, make sure you built it
with the -DREGEX_BODY. The easy way is to remove the obj.* build
directory and rerun ./Build
Stuff I would like to add:
- Ability to ignore bodys for some users (like abuse and postmaster)
- Ability to hang connection. No use playing fair with spamers.
- The regex should go in a file. One per line
- The sendmail mapping allows for several maps of the same name. A
few lines of extra code should allow for several lines of regex.