From dePoPo.net

Getting Sendmail DNSBL to work

Posted in: BlueOnyx
By dePoPo
Sep 4, 2009 - 9:51:24 PM

By default, both BlueQuartz and BlueOnyx installs contain an sendmail.mc file which contains instructions on how to enable dns blocklists. However, using just these instructions you will find no mail actualy gets blocked at all. Here's a simple step by step howto on enabling logging to see what is happening, and configuring the enhdnsbl option to actualy block.

The advantage of enabling these filters in these filters in sendmail vs the much used mailscanner is that in this setup the mail is rejected before being accepted, where mailscanner can only bounce (very bad idea) or delete the mail. The enhdnsbl approach saves you the bandwith and system load by not accepting and thus not having to evaluate and act upon the message.

editing the sendmail config file:

cd /etc/mail
nano sendmail.mc

Activating changes:

make -C /etc/mail
service sendmail restart

Changes to be made:

define(`confLOG_LEVEL',`14')dnl

This changes the default loglevel from 9 to 14. The default logging level is too low to see if the dns filters do anything at all.

 

FEATURE(`enhdnsbl', `bl.spamcop.net', `"Spam blocked (bl.spamcop.net)"$&{client_addr}', `t')dnl
FEATURE(`enhdnsbl', `zen.spamhaus.org', `"Spam blocked (zen.spamhaus.org)"$&{client_addr}', `t')dnl

 

This activates two sample blacklists. You will notice these lines are formulated different from the included examples in the sendmail.mc file. (the `t' is in a different spot)

While the defaultk samples will generate log entry's with the blacklists consulted and the return values, no actual blocking takes place with those.

Using the above format will not only generate the result line, eg:

Sep  4 21:49:10 hosting sendmail[30883]: n84JnAAo030883: dns 255.88.178.78.zen.spamhaus.org. => 127.0.0.4

but will ALSO perform the actual blocking, eg:

Sep  4 21:49:10 hosting sendmail[30883]: n84JnAAo030883: dns 255.88.178.78.zen.spamhaus.org. => 127.0.0.4
Sep  4 21:49:10 hosting sendmail[30883]: ruleset=check_relay, arg1=[78.178.88.255], arg2=127.0.0.4, relay=[78.178.88.255], reject=553 5.3.0 Spam blocked (zen.spamhaus.org) 78.178.88.255


© Copyright 2010 by dePoPo.net