How to Configure pfBlocker: An IP List and Country Block Package for pfSense
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 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.
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.
- Select the 'Top Spammers' tab within the configuration page.
- Select the countries to block from the list. You can select multiple countries by using CTRL + Click.
- Set the action to 'Deny Inbound' to prevent incoming connections from the selected countries.
- Click on 'Save' to apply the settings.
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.
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
- Click on the 'Lists' tab.
- Enter an Alias Name and optional description for the custom list.
- 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.
- Set the list action to deny inbound or outbound. Selecting permit will whitelist traffic to these IP's.
- Choose an update frequency if you want pfBlocker to automatically update the list.
- Click save to add the custom list.
Useful IP Block Lists
SpamHaus.org DROP List
This list contains networks that are known to be operated by professional spammers.
DShield Most Active Attackers
IP's of the most active attackers on the web. Updated daily.
Zues IP Blocklist
IP's currently being tracked by the Zues Tracker. (Command and Control Servers)
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.
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.
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).
© 2011 Sam Kear