Thought I would post an update regarding my reference to firewall dynamic blacklists.
I found SquidBlacklist which someone had written for my router vendor, Mikrotik's RouterOS.
I was using this for a number of months but noticed that it had stopped working.
I later learned that the guy running the site and code had passed away several months prior. It had continued for a while under automation but eventually the service stopped.
I managed to find a replacement script which queries various published lists directly.
I thought I would share my RouterOS script as I'm sure it could be adapted to suit other platforms.
I have the script running once daily or on reboot. The first action is to clear the existing content of the list and then re-import the latest entries.
I then have a firewall rule at the top of my policy before anything else to drop any traffic with a source address matching the list.
I also have a further list & rules for IP addresses or subnets manually added from being observed in AMS logs etc.
- Code: Select all
/ip firewall address-list remove [/ip firewall address-list find list=dynamicblacklist]
/ip firewall address-list
:local update do={
:do {
:local data ([:tool fetch url=$url output=user as-value]->"data")
remove [find list=blacklist comment=$description]
:while ([:len $data]!=0) do={
:if ([:pick $data 0 [:find $data "\n"]]~"^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}") do={
:do {add list=dynamicblacklist address=([:pick $data 0 [:find $data $delimiter]].$cidr) timeout=2d} on-error={}
}
:set data [:pick $data ([:find $data "\n"]+1) [:len $data]]
}
} on-error={:log warning "Address list <$description> update failed"}
}
$update url=http://feeds.dshield.org/block.txt description="dshield" delimiter=("\t") cidr=/24
$update url=http://www.spamhaus.org/drop/drop.txt description="spamhausdrop" delimiter=("\_")
$update url=http://www.spamhaus.org/drop/edrop.txt description="spamhausextended" delimiter=("\_")
$update url=http://osint.bambenekconsulting.com/feeds/c2-ipmasterlist-high.txt description="bambenek" delimiter=("\2C")
$update url=https://sslbl.abuse.ch/blacklist/sslipblacklist.txt description="abuse-ch" delimiter=("\r")
$update url=http://malc0de.com/bl/IP_Blacklist.txt description="Malc0de" delimiter=("\n")
$update url=https://raw.githubusercontent.com/ktsaou/blocklist-ipsets/master/firehol_level2.netset description="FireHOL Level2" delimiter=("\n")