I could never understand the mentality behind accepting spam when using SURBL then trashing it. This gives spammers the notion that they can continue sending their junk because from their prospective it seems like the message is being successfully delivered even though your MailScanner is working like crazy to trash the message.
Now you can stop spam at SMTP time and reject the message outright if the spammers domain is on the SURBL blacklist.
Here is how to do it.
I do not take credit for the code. The credit goes to Erik Mugele and his code snippnet. I have merely tested it and integrated it with Cpanel and it works beautifully. Thanks Erik!
1) If you are currently using my_rules_du_jour and downloading your rulesets, leave those in place. Those rulesets should be left as is and should not be deleted. They will be used to weed out spam for non blacklisted sites.
Visit, http://www.teuton.org/~ejm/exim_surbl/ and download the latest tar, its currently v1.6. V1.6 includes URIBL and MIME decoding.
2) Make a copy of exim.pl
CODE
cp /etc/exim.pl /etc/exim_surbl.pl
If you are updating, run the command above and answer Y to overwrite existing file.
3) Edit exim_surbl.pl using your favourite editor and scroll to the bottom of the file, right to the very eof. Now just before the number 1;
CODE
|<--- HERE
1;
Copy and paste the content of the file from the zip file. Save and exit.
4) Implament ccTLD.txt
CODE
touch /etc/ccTLD.txt
vi /etc/ccTLD.txt and copy the contents of ccTLD.txt from the zip file.
5) Edit /etc/exim_surbl.pl again, and do a search for ccTLD.txt. You will need to change the path to ccTLD.txt here to /etc/ccTLD.txt.
6) Open the Exim Configuration Editor in WHM and click on Switch To Advanced Mode. In the first box copy and paste this code.
CODE
perl_startup = do '/etc/exim_surbl.pl'
7) Find the center box, where most of the exim rules reside and search for this line of code. The codes resides at the end of file, the last 4 lines of code.
CODE
#------------------------------------------------
#!!# ACL that is used after the DATA command
check_message:
require verify = header_sender
accept
#------------------------------------------------
[B]Change it to:[/B]
#------------------------------------------------
#!!# ACL that is used after the DATA command
check_message:
require verify = header_sender
# Log the message subject
warn
logwrite = Subject: $h_Subject:
#MIME ACL
deny set acl_m0 = ${perl{surblspamcheck}}
message = $acl_m0
condition = ${if eq{$acl_m0}{false}{no}{yes}}
#DATA ACL
deny set acl_m1 = ${perl{surblspamcheck}}
message = $acl_m1
condition = ${if eq{$acl_m1}{false}{no}{yes}}
condition = ${if eq{$acl_m0}{}{yes}{no}}
# Accept the message.
#
accept
#-----------------------------------------------
If you are upgrading from an earlier version, make sure you replace this line of code as shown above as there are is now a new routine to check for MIME messages.
Save and reload! I added the Log subject code above. I like to see the subject of messages arriving so i can see what spammers and users are sending. If you include those lines, the subject for each message will appear in exim_mainlog.
After saving your changes you should tail your exim_mainlog to make sure everyting is functioning correctly. Use;
tail -f /var/log/exim_mainlog to monitor the log.
NOTE: If surbl lookups are happening, you will notice messages that look something like this;
2005-09-01 10:34:18 1EAq8w-00006T-13 Subject: Clean Shave on Us
2005-09-01 10:34:18 1EAq8w-00006T-13 H=(mx1.rainkeys.com) [205.150.209.142] F=
AND BEST OF ALL, they are all getting wiped out before it gets a change to be accepted!
Good Luck!
Update History;
QUOTE
Origional post on 09/01/05
QUOTE
Updated on 12/27/05
QUOTE
Last Updated on 06/10/06