How to Configure pfBlocker: An IP List and Country Block Package for pfSense

Updated on April 29, 2016
skear profile image

Sam works as a Network Analyst for an algorithmic trading firm. He obtained his Bachelors Degree in Information Technology from UMKC.

PfBlocker is a package for pfSense version 2.x that allows you to add IP block list and country block functions to a pfSense firewall or router. PfBlocker was created to replace the functions of the IP Blocklist ,and Country Block packages.

I would consider this package a must have package for anyone running an email server on their network. This package will quickly allow you to block the top 10 countries where spam originates from.

PfBocker also allows you to configure custom block lists for blocking traffic to or from any IP addresses or networks that you specify.

There are several free block lists which are available on the web that target known malicious IP ranges, botnet IP addresses, compromised IP's, and more.

Installing the Package

To install the package open the pfSense package manager by clicking on 'Packages' in the system menu. Locate the package in the list and click the plus symbol on the right side to begin the installation.

PfBlocker is only available for pfSense version 2.x, so if you haven't upgraded your pfSense installation then you'll need to do so before you can use this package.

After the installation is finished you will have a new menu item in the firewall menu for the package.

The package can be installed using the package manager.
The package can be installed using the package manager.

Configuration

The first tab of the configuration page contains the general package settings. To turn on the blocker you must select the check box 'Enable pfBlocker', otherwise no firewall rules will be created.

I also like to go ahead and enable the logging feature, it's much easier to troubleshoot any problems that may occur if the logs are turned on.

You will also need to configure the inbound and outbound interfaces and their associated actions, below are explanations for each setting.

Inbound Interface(s) - If you intend to block incoming traffic to your network then you should select your WAN interface in this section.

Inbound deny action - I recommend sticking with the default action of 'Block'. Blocked traffic will be silently dropped by the firewall and the source will not be notified with a reset packet or ICMP unreachable message.

Outbound Interface(s) - If you want to block outgoing traffic from within your network select the LAN interface here. This feature is useful if you want to prevent the users on your network from connecting to IP addresses on the block lists.

Outbound deny action - Again the default action here is usually suitable. Reject will notify the source IP with either a reset (RST) packet or an ICMP unreachable message for UDP traffic. A reject is useful for LAN hosts because it can provide applications and users some idea of what is going on with their traffic.

When you're finished with the general settings click on the save button.

Select the inbound and outbound interfaces on the general settings tab.
Select the inbound and outbound interfaces on the general settings tab.

Top Spammers

The Top Spammers tab allows you to quickly block any of the top 10 countries that spam originates from.

If you are hosting a mail server on your network then this feature is an easy way to reduce the amount of spam coming into your network.

Configuration

  1. Select the 'Top Spammers' tab within the configuration page.
  2. Select the countries to block from the list. You can select multiple countries by using CTRL + Click.
  3. Set the action to 'Deny Inbound' to prevent incoming connections from the selected countries.
  4. Click on 'Save' to apply the settings.

If you host a mail server you can easily block the top countries that spam originates from.
If you host a mail server you can easily block the top countries that spam originates from.

Blocking Individual Countries

The package comes pre-loaded with subnet lists for many different countries. You can select individual countries to block by clicking on the continent tabs in pfBlocker.

After selecting a continent page you can choose one or more countries to block. To select multiple countries hold the control button while making your selections.

The default action is 'Disabled' which will not block the countries. You must make a selection of either 'Deny Inbound' , or 'Deny Outbound' to actually block the traffic.

You can whitelist a country by changing the action to one of the permit functions.

Individual countries can be blocked using the continent tabs.
Individual countries can be blocked using the continent tabs.

Adding Block Lists

One of the great features of this package is that you can add your own IP lists. The list feature allows you to specify a URL for a public block list which can be automatically downloaded and updated by the package.

PfBlocker supports lists in either text or gzip format.

The custom list function allows you to specify a list of IP's or networks in CIDR format to add to a blocklist.

Adding a Custom List

  1. Click on the 'Lists' tab.
  2. Enter an Alias Name and optional description for the custom list.
  3. Enter a URL or local file of network addresses in CIDR format. (Select either txt or gzip format). You can add individual networks in the custom list box at the bottom.
  4. Set the list action to deny inbound or outbound. Selecting permit will whitelist traffic to these IP's.
  5. Choose an update frequency if you want pfBlocker to automatically update the list.
  6. Click save to add the custom list.

You can specify your own custom IP lists on the lists tab.
You can specify your own custom IP lists on the lists tab.

Useful IP Block Lists

Block List
Description
URL
SpamHaus.org DROP List
This list contains networks that are known to be operated by professional spammers.
http://www.spamhaus.org/drop/drop.lasso
DShield Most Active Attackers
IP's of the most active attackers on the web. Updated daily.
http://feeds.dshield.org/top10-2.txt
Zues IP Blocklist
IP's currently being tracked by the Zues Tracker. (Command and Control Servers)
https://zeustracker.abuse.ch/blocklist.php?download=ipblocklist
This table contains some of the most popular block lists available on the web. You can find many more at www.iblocklist.com

Managing Custom Lists

After the list custom list has been saved it will appear in the lists tab. If you plan to add multiple custom lists be sure to set a descriptive name so you can keep track of them.

To make changes to the custom list click on the edit button on the right side. To remove the ilst entry click the X symbol.

Once a custom list has been added it will appear in the lists tab.  To add additional lists click on the plus symbol.
Once a custom list has been added it will appear in the lists tab. To add additional lists click on the plus symbol.

Memory Utilization

It's also important to keep in mind that each block list that is enabled will consume system RAM. If your pfSense box doesn't have enough memory then performance can suffer as a result.

You can monitor memory utilization using the system information dashboard widget. If you find that you are operating above 75% memory usage then you should consider adding more RAM to the system.


Checking the Status of pfBlocker

The easiest way to make sure that pfBlocker is functioning is to use the dashboard widget.

The pfBlocker dashboard widget will list the number of CIDR ranges that are loaded for each alias, the number of packets blocked by each list, the status (enabled/disabled) of each list.

To check the status of pfBlocker add the dashboard widget.
To check the status of pfBlocker add the dashboard widget.

Troubleshooting

If pfBlocker doesn't seem to be blocking any traffic there are a few things you can check that may resolve your problems. For additional assistance check out the pfSense forums.

  • Make sure that pfBlocker is enabled on the general settings page. If it's not enabled no firewall rules will be created.
  • Double check the interface selections in the general settings.
  • Check the system logs (make sure logging is enabled first). PfBlocker log entries will be displayed in the main system logs. The system logs can be found in the status menu of the web gui. Filter the logs by 'pfblocker' to see only entries for this package.
  • Make sure the rules were actually created. When pfBlocker is enabled and lists are selected you will see entries on either the WAN or LAN tab of the firewall rules page. They will appear near the top of the page.

Since pfSense is a stateful firewall a new rule will not be applied to existing states.

This means that a rule to block traffic will not affect existing traffic until the state clears. You can manually clear the states by rebooting pfSense, or on states page (diagnostics \ States \ Reset states).

Questions & Answers

    © 2011 Sam Kear

    Comments

      0 of 8192 characters used
      Post Comment

      • ShelleyHeath profile image

        Shelley Heath 

        3 years ago from Birmingham

        Cheers for the super informative piece, nice to see step by step instructions that leave no stone unturned... really helps avoid unnecessary troubleshooting because of a simple missed step.

      • TTGReviews profile image

        TTGReviews 

        3 years ago

        I am bumping what hugpages-user asked, Can you block traffic on specific ports?

      • profile image

        hubpages-user 

        4 years ago

        Is there a way to set the pfsense PFBlocker to just block SMTP port 25 traffic only?

      • Dumbledore profile image

        This Old Guy 

        6 years ago from Somewhere in Ohio

        I believe that administrators should also check their addresses against the various block lists.

      • Goonoo Munawwar profile image

        Goonoo Muhammad Munawwar Muazzam 

        6 years ago from Triolet, Mauritius

        Thanks for sharing this hub with us and thanks also for researching this software for us. I'll be following you from now on!

      working

      This website uses cookies

      As a user in the EEA, your approval is needed on a few things. To provide a better website experience, turbofuture.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

      For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://turbofuture.com/privacy-policy#gdpr

      Show Details
      Necessary
      HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
      LoginThis is necessary to sign in to the HubPages Service.
      Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
      AkismetThis is used to detect comment spam. (Privacy Policy)
      HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
      HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
      Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
      CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
      Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
      Features
      Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
      Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
      Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
      Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
      Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
      VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
      PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
      Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
      MavenThis supports the Maven widget and search functionality. (Privacy Policy)
      Marketing
      Google AdSenseThis is an ad network. (Privacy Policy)
      Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
      Index ExchangeThis is an ad network. (Privacy Policy)
      SovrnThis is an ad network. (Privacy Policy)
      Facebook AdsThis is an ad network. (Privacy Policy)
      Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
      AppNexusThis is an ad network. (Privacy Policy)
      OpenxThis is an ad network. (Privacy Policy)
      Rubicon ProjectThis is an ad network. (Privacy Policy)
      TripleLiftThis is an ad network. (Privacy Policy)
      Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
      Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
      Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
      Statistics
      Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
      ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
      Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)