December 14, 2005

Add X-Country to mail header

I wrote a bash script to add X-Country tag to mail header.
e.g.: X-Country: TW
X-Country tag may be used for basic spam filtering.

Install:
Download xcountry.tgz
tar zxf xcountry.tgz -C /
ip-to-country data in /usr/local/xcountry, xcountry in /usr/local/bin

Usage:
Add following to procmailrc

:0fw
| /usr/local/bin/xcountry

Further more, if you want to delete mail from some countries, add following
# This example delete any mail from China and Korea.
:0
* X-Country: (CN|KR)
/dev/null

and you can use IP as parameter to get country code.
eg.
# xcountry 168.95.1.1
TW
# xcountry 200.200.200.200
BR

ref. Spamhaus TOP 10 Spam Origin Countries

Posted by pank at December 14, 2005 03:46 PM
Comments
Post a comment













Remember personal info?