I wanted to share a bash script I use to generate a daily blacklist file. The script is written in bash and should be fairly fault-tolerant. Just give the file executable permissions, and call it from a cron job. In my case, I like to use the DShield.org blocklist (may not be safe for all cases), and the Spamhaus DROP list (should always be safe to use), but other blocklists could easily be added.

The script itself uses wget to grab the appropriate lists, then performs some simple parsing with grep and awk. Lines 21 and 22 are the actual calls to the getFile function to grab each list. GetFile requires two parameters passed to it -- the address where wget can download the file from, and an awk statement (escaping any " and $ symbols) to output the listed addresses in the format "0.0.0.0/0".

If there are any errors downloading the files, blacklist will not be updated. The final file will contain a timestamp, and comments denoting the start of the addresses for each file. On a successful update of the blacklist file, shorewall will be refreshed to get the updated information.

I would be interested to hear of any other suitable blocklists that could be included for this purpose.

Attachment: makeblacklist.sh
Description: Bourne shell script

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World™ now supports Android™ Apps 
for the BlackBerry® PlayBook™. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to