The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 Adding unknown hosts into spamdb
Author: Dan 
Date:   29-11-08 22:32

I run pf and spamdb for greylisting. Many hosts get through the greylisting only to have bad DNS. I use postfix and make use of the reject_unknown_client_hostname option in my smtpd_client_restrictions directive. As such, I frequently see mail connections such as this:

Nov 29 00:07:19 nyi postfix/smtpd[85071]: NOQUEUE: reject: CONNECT from unknown[216.226.129.231]: 450 4.7.1 Client host rejected: cannot find your hostname, [216.226.129.231]; proto=SMTP

Today I decided to gather up those IP addresses and trap them in spamdb. They will stay there for 24 hours.

grep "Client host rejected: cannot" /var/log/maillog | awk '{print $10}' | cut -d '[' -f 2 | cut -d ']' -f 1 | sort | uniq | xargs -J % -n 1 sudo spamdb -ta %

Hope that helps. :)

--
Webmaster

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 Adding unknown hosts into spamdb   new
Dan 29-11-08 22:32 
 Re: Adding unknown hosts into spamdb   new
Dan 29-11-09 19:42 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org