My main concern is the ability to use firewall rules to block spam email at router level based on the blacklists above, and also to block networks that have a high level of security threats.
There should be an option to import a list of compatible blacklists, and a time setting to grab an updated list every X hours.
i will probably setup a bgp feed of these and allow others access. Once I do this I will post an update. I will also create a script on *nix that runs and ssh’s this lists to whatever boxes you have. in 3.0 it would be nice if wget was added and this could be done directly within the router.
As I haven’t heard anything about this I scratched up some code together to generate rules, it’s based on another script that I found that generated iptables firewall rules. The scripts were tested on FreeBSD but should also work just fine on just about any linux distro. Only requirements are perl and wget.
All that is needed is to ftp upload the output file droproutes.rsc and then import drouproutes.rsc, every time that the script is imported it will remove the previous list and add the new list in case there was any changes.
It could be done manually or done through a scheduled script to do it on it’s own.
The last part is to create your firewall rules to drop the traffic or what ever you want it to do with it.
We setup a firewall rule to look at the list of IP in the drop list and within the 1st 12 hours we dropped 125,000 syn connection attempts. They are mostly dns lookups. What was very interesting we had 20 or so customers to call for support stating thay can not surf. We found that the DNS setting of those computers had DNS servers entered that are in the block list. We are working to identify exactly what changed the dns servers on the infected computers.
The code is simple
apr/21/2007 07:47:14 by RouterOS 2.9.35
software id = 0DEM-BCT
/ ip firewall filter
add chain=forward action=jump jump-target=droplist comment="" disabled=no
add chain=droplist dst-address-list=drop.lasso action=log log-prefix=""
comment="" disabled=yes
add chain=droplist src-address-list=drop.lasso action=drop comment="Spamhaus
Drop List 4-19-07" disabled=no
add chain=droplist dst-address-list=drop.lasso action=drop comment=""
disabled=no
add chain=droplist src-address-list=drop.dshield action=drop comment="Dshield
Drop List 4-19-07" disabled=no
add chain=droplist dst-address-list=drop.dshield action=drop comment=""
disabled=no
Would you mind if I make this post a wiki article? As your the original author i should ask before I make one. I have only made one change to the script and that was to fix a format change in the drop.lasso list that caused a blank firewall rule to be included that caused a problem. Of course will add more information about the firewall rules and a basic how to to setup everything to get it all going. It’s been working well for myself now for quite a while.
#!/bin/csh
#
# Original author changeip
# Minor modifications and commenting by cdemers
#
# This script downloads a few blacklists and imports them into MT.
#
set today = `date "+%m%d%y"`
set workdir = "/usr/home/admin/work"
set targets = ( 10.0.0.1 10.0.0.2 10.0.0.3 )
cd ${workdir}
#
# Fetch block lists from sources and store in current folder
#
wget -q -nv -t 2 -O drop.lasso.txt -U wget-changeip-script http://www.spamhaus.org/drop/drop.lasso
wget -q -nv -t 2 -O drop.dshield.txt -U wget-changeip-script http://feeds.dshield.org/block.txt
#
# Begin Processing drop.lasso
#
echo :log info \"drop.lasso script import started\" > drop.lasso.rsc
echo :foreach subnet in [/ip firewall address-list find list=drop.lasso] do=\{ /ip firewall address-list remove \$subnet \} >> drop.lasso.rsc
cat drop.lasso.txt | awk '{print $1 " " $3}' | awk -F"/" '{print $1 " " $2 " " $3}' | grep -v ";" | sort +1 | sed '/^ *$/d' | awk '{print "/ip firewall addr
ess-list add list=drop.lasso address=" $1 "/" $2 " comment=" $3}' >> drop.lasso.rsc
echo :log info \"drop.lasso script import completed\" >> drop.lasso.rsc
#
# Begin processing drop.dshield
#
echo :log info \"drop.dshield script begin run\" >> drop.lasso.rsc
echo :foreach subnet in [/ip firewall address-list find list=drop.dshield] do=\{ /ip firewall address-list remove \$subnet \} >> drop.lasso.rsc
egrep "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" drop.dshield.txt | awk '{print "/ip firewall address-list add list=drop.dshield address=" $1 "-" $2}'
>> drop.lasso.rsc
echo :log info \"drop.dshield script end run\" >> drop.lasso.rsc
#
# Upload script to router and execute
#
foreach target ($targets)
echo $target
echo "put drop.lasso.rsc" | ftp ftp://ftpuser\:password\@{$target}:21
ssh -l admin-ssh -i ${workdir}/dsa ${target} "/import drop.lasso.rsc" >> ${workdir}/push-lasso.output
end
cdemers - go for it. . . I didnt know if it was 100% stable so I didnt post it yet, but I think its working okay. I really want to get 3.0 to pull these down directly, once I get that going I will post.
It’s been completely stable, only change i had to make was recent when drop.lasso list changed something and kept making a bogus rule. I have tested it with up to 2.9.50 but not yet with 3.0, Not sure I’m going to have enough time this weekend but I have it partially already written up for my own documentation. I’m going to upgrade a test router to 3.0 and see if I need to make any modifications. Have to anyways. Will probably take me a couple days and will post it in the wiki for anyone else to use.
Maybe I’m not polished up on the intricacies of address lists, but I don’t see anything in the scripts to remove entries that are no longer in the blacklist. I would think the program should clear the address list, then import the entries.
Things do get erroneously listed, or temporarily listed while there is a problem, and many blacklist users don’t use it properly and inadvertently keep blocking things. This causes lingering issues to the person who cleaned up the problem at the source or who inherited an IP address that had been previously blacklisted.