dnsblcheck.pl, 03.01.06 Paul Venezia (paul_venezia@infoworld.com)

--

First off, this is sparsely tested code. It works fine for me, but that's as far
as I've taken it. YMMV.

Required perl modules:
 Sendmail::Milter
 Net::Nslookup
 DBI
 DBD::MySQL


All this code does is collect data on DNSBL matches. It doesn't block anything.
You can add other DNSBLs by adding a row in the database that matches the DNSBL name,
i.e. if your lookups are to bl.thisbl.net, then 'bl.thisbl.net' should be the fieldname in 
the database. Now, add that string to the @bl array in dnsblcheck.pl, and you should be all
set.

INSTALLATION

To implement, put dnsblcheck.pl somewhere, then do 

mysql -u root -p < ./dnsblcheck.sql

which will set up the MySQL database.

Now, execute this to set up the user:

mysql> grant all privileges on dnsblcheck.* to db_user@localhost identified by 'db_pass';

You should change the passwords in that command and in the dnsblcheck.pl file.
Now, check all the configurable variables in dnsblcheck.pl and set them appropriately.
Then add these lines to your sendmail.mc:

INPUT_MAIL_FILTER(`dnsblcheck', `S=local:/var/spool/MIMEDefang/dnsblcheck.sock, F=T, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confINPUT_MAIL_FILTERS', `dnsblcheck')dnl

If you're using other milters, simply add 'dnsblcheck' as the first entry in the define.
Make sure the socket path matches the one specified in dnsblcheck.pl

Now, generate the sendmail.cf from the sendmail.mc file.
Finally, fire up the script and make sure it opens the socket, pid file, log, and so forth.
Restart sendmail and make sure that you're seeing output in the logfile (if $verbose) and/or
data in the database.

Enjoy
