Заметки сисадмина » Using pfBlockerNG (And Block Lists) On pfSense

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

Using pfBlockerNG (And Block Lists) On pfSense

Instead, I’ll talk about using IPv4 blocklists in pfBlockerNG. At this point, I’m assuming you have already installed the package. If not, go do so and I’ll wait here…

After installing the package, you will need to enable it from the main page. Change the settings on the main screen as necessary. Items worth noting include that I would check the interfaces to verify all of your networks are there and the “kill states” is checked.

Next, go to the IPv4 section and we are going to add some fairly well-known lists. I already discussed the ban list from Binary Defense in the last blog. The IP banlist updates every 5 minutes and while we won’t update every 5 minutes, we are going to set it up to update every hour as shown below. The other difference is that we will set the list action to “deny both” to create firewall rules blocking traffic in both directions to offending IP addresses. Note: the header/label (BD_IPs for this example) is simply used as a  placeholder. The label should, however, have something signifying which list it originates from. I’ll explain this a bit more later.

//www.binarydefense.com/banlist.txt

Great! So we did the same thing as the previous post did with aliases, but now we are updating once an hour instead of once a day. What else can we do?

The big change is that we can add other lists in various formats. In addition to a huge, clean list of IP addresses like the banlist.txt from Binary Defense, we can also add list formats such as those used by Emerging Threats and DShield. Both of these include CIDRs (196.63.0.0/16), which would would block huge swaths of IP addresses vs. single IP addresses.

For what it is worth, you may have also seen previously that you can tie multiple blacklists to a single alias. So you may be asking, why am I separating them here? Based on experience, the free Emerging Threats lists only update every few days so to avoid unnecessary calls to their servers, once a day should suffice.

The one “block” list from Emerging Threats already includes the aforementioned CIDRs from DShield so we don’t need to include that list separately (as shown below).

//rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt

Information from that feed header
*Those DShield CIDRs are also listed at the bottom of that feed

# Emerging Threats fwip rules.
#
# Raw IPs for the firewall block lists. These come from:
#
# Spam nets identified by Spamhaus (www.spamhaus.org)
# Top Attackers listed by DShield (www.dshield.org)
# Abuse.ch
# More information available at www.emergingthreats.net

The URL for the other list is below.

//rules.emergingthreats.net/blockrules/compromised-ips.txt

After we add both URLs, the identifying headers/labels, change list action to ‘deny both,’ and update frequency to ‘once a day’ we are ready to go.

Click ‘save’ and if you followed my naming conventions, your aliases under IPv4 should look similar to mine below.

Update – firehol_level3 – 19 March 2017

I was notified of the numerous ban lists on //iplists.firehol.org/ shortly after this write-up (and the related one on using firewall blocklists). Overall, the site has great explanations on the in’s and out’s of the various lists. Their comparisons/metrics include what percent of one list is included in another list, which ones might yield false positives, how an IP address would get added to a list, etc. After testing in a few environments for several weeks, I found the firehol_level3 list to be extremely effective and I haven’t yet experienced a false positive.

You configure firehol_level3 much in the same way the Binary Defense list was configured above, i.e. deny both, update every hour, etc. I also chose to update from the GitHub feed (vs. the firehol.org site) to avoid bandwidth costs for someone providing a free/low-cost service. Note: There are other feeds there that might be useful on the site as well. I chose the firehol_level3 feed because of what is included and what should be a fairly limited number of false positives.

//raw.githubusercontent.com/firehol/blocklist-ipsets/master/firehol_level3.netset

Firewall Rules

If you go to the firewall rules section of your firewall, you should see two (or three) separate rules added automatically on the WAN side. Similar rules should have been added to the LAN side as well… Remember we are blocking in both directions.

WAN

LAN

As previously described, you can once again hover over either of the rules to see if the IP addresses/ranges have been pulled back by the firewall cron entry we setup a short time ago. You can also go to the diagnostics, table, pfB_[your list name] to look at all of the IP addresses and ranges for that particular alias/list.

The update page for pfBlockerNG also tends to be pretty solid if you need some assistance troubleshooting, e.g. why something won’t update. You can also force updates, see when the next run time is, etc. as well.

Last, but not least… Is it working? The alerts page on pfBlockerNG shows you timestamps for blocked IPs, what interface it was on, what rule triggered the block or reject, etc.

Note in the example above I’m seeing blocks on the WAN side. If you’re seeing blocks on the LAN, that means an internal machine is attempting to contact a known malicious IP address and is really, really ridiculously bad!

In all seriousness, keep an eye out for blocks on the LAN side as that can be a fantastic indicator that one of your internal machines is compromised.


список для pfblocker. Обязательно поставьте галку удалять дубликаты.

IPv4:
//voipbl.org/update
//list.iblocklist.com/?list=xpbqleszmajjesnzddhv&fileformat=p2p&archiveformat=gz
//lists.blocklist.de/lists/all.txt
//rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt
//www.badips.com/get/list/any/3?age=2w
//ransomwaretracker.abuse.ch/downloads/RW_IPBL.txt
//torstatus.blutmagie.de/ip_list_exit.php/Tor_ip_list_EXIT.csv
//torstatus.blutmagie.de/ip_list_all.php/Tor_ip_list_ALL.csv
//torstatus.blutmagie.de/query_export.php/Tor_query_EXPORT.csv
//www.malwaredomainlist.com/hostslist/ip.txt
//list.iblocklist.com/?list=togdoptykrlolpddwbvz&fileformat=p2p&archiveformat=gz
//pfblockerlists.smallbusinesstech.net/hackerlist.txt
//www.myip.ms/files/blacklist/csf/latest_blacklist.txt
//panwdbl.appspot.com/lists/shedrop.txt
//panwdbl.appspot.com/lists/bruteforceblocker.txt
//panwdbl.appspot.com/lists/etcompromised.txt
//panwdbl.appspot.com/lists/dshieldbl.txt
//panwdbl.appspot.com/lists/sslabuseiplist.txt
//www.squidblacklist.org/downloads/drop.malicious.rsc
//www.squidblacklist.org/downloads/dg-ads.acl
//raw.githubusercontent.com/firehol/blocklist-ipsets/master/snort_ipfilter.ipset
//raw.githubusercontent.com/firehol/blocklist-ipsets/master/cta_cryptowall.ipset
//raw.githubusercontent.com/firehol/blocklist-ipsets/master/blocklist_de_sip.ipset

DNSBL:
//osint.bambenekconsulting.com/feeds/dga-feed.gz
//gist.githubusercontent.com/BBcan177/4a8bf37c131be4803cb2/raw/be5fddb116667699c246df97b79e1032ab71bb1c/MS-2
//osint.bambenekconsulting.com/feeds/c2-dommasterlist.txt

Список не проверенных адресов. Возможны ложные срабатывания.
//labs.snort.org/feeds/ip-filter.blf
//gist.githubusercontent.com/BBcan177/bf29d47ea04391cb3eb0/raw/b344ebc9475acdea1fae38a12c4ea9332838a184/MS-1
//gist.githubusercontent.com/BBcan177/d7105c242f17f4498f81/raw/90eb2ac8bdc01af3008d728b7c0f10dc7b2506b4/MS-3
//github.com/firehol/blocklist-ipsets/raw/master/firehol_proxies.netset
//raw.githubusercontent.com/BBcan177/blocklist-ipsets/master/firehol_anonymous.netset
//rules.emergingthreats.net/open/suricata/rules/tor.rules
//www.abuseat.org/iotcc.txt
//raw.githubusercontent.com/firehol/blocklist-ipsets/master/cybercrime.ipset
//cinsscore.com/list/ci-badguys.txt

Leave a Reply