PfBlockerNG v2.0 w/DNSBL
-
Here is a fix for the MaxMind errors https://forum.pfsense.org/index.php?topic=116307.msg644910#msg644910
please use that thread for this issueSolving the problem by throwing more memory at it worries me a bit. I hate to sound old-school, but 1GB or RAM on a router/firewall is a lot of memory. Allocating upwards of 300MB for one particular function, if that is on exclusive basis, would worry me that the implementation of that function is less than optimal.
As for the installation issue, it is still there. I can no longer install the latest version of pfBlockerNG; although pfSense claims that it's installed it doesn't show anywhere in the menus.
-
@Gé:
Thank you again Ronpfs.
I did what you suggested on that other thread it did not work. I increased to 750M but no joy :(The patch was made for someone with pfBlockerNG installed. You could probably revert it.
I posted another similar patch for the case when pfBlockerNG isn't installed. -
@haleakalas:
Here is a fix for the MaxMind errors https://forum.pfsense.org/index.php?topic=116307.msg644910#msg644910
please use that thread for this issueSolving the problem by throwing more memory at it worries me a bit. I hate to sound old-school, but 1GB or RAM on a router/firewall is a lot of memory. Allocating upwards of 300MB for one particular function, if that is on exclusive basis, would worry me that the implementation of that function is less than optimal.
As for the installation issue, it is still there. I can no longer install the latest version of pfBlockerNG; although pfSense claims that it's installed it doesn't show anywhere in the menus.
We are just trying to get a fix until BBcan177 can find a proper fix when he comes back.
there is a thread for the installation failure https://forum.pfsense.org/index.php?topic=115966.0
pfBlockerNG with DNSBL requires load of memory as it handle 1M+ table. So 1GB is really not that much memory for this kind or usage.
-
The patch was made for someone with pfBlockerNG installed. You could probably revert it.
I posted another similar patch for the case when pfBlockerNG isn't installed.Oke I tried that mod and went up to 1500M but no success I can't install Pfblocker.
Oh and BTW i have a 64bit system with 4GB ram.>>> Installing pfSense-pkg-pfBlockerNG... Updating pfSense-core repository catalogue... pfSense-core repository is up-to-date. Updating pfSense repository catalogue... pfSense repository is up-to-date. All repositories are up-to-date. Checking integrity... done (0 conflicting) The following 5 package(s) will be affected (of 0 checked): New packages to be INSTALLED: pfSense-pkg-pfBlockerNG: 2.1.1_2 [pfSense] whois: 5.1.5 [pfSense] lighttpd: 1.4.39_1 [pfSense] grepcidr: 2.0 [pfSense] aggregate: 1.6_1 [pfSense] Number of packages to be installed: 5 The process will require 2 MiB more space. [1/5] Installing whois-5.1.5... [1/5] Extracting whois-5.1.5: .......... done [2/5] Installing lighttpd-1.4.39_1... [2/5] Extracting lighttpd-1.4.39_1: .......... done [3/5] Installing grepcidr-2.0... [3/5] Extracting grepcidr-2.0: ..... done [4/5] Installing aggregate-1.6_1... [4/5] Extracting aggregate-1.6_1: .... done [5/5] Installing pfSense-pkg-pfBlockerNG-2.1.1_2... [5/5] Extracting pfSense-pkg-pfBlockerNG-2.1.1_2: .......... done Saving updated package information... done. Loading package configuration... done. Configuring package components... Loading package instructions... Custom commands... Executing custom_php_install_command()... MaxMind GeoIP databases previously downloaded. Adding pfBlockerNG Widget to the Dashboard... done. Remove any existing and create link for DNSBL lighttpd executable... done. Creating DNSBL web server start-up script... done. Creating DNSBL web server config ... done. Starting DNSBL Service... done. Upgrading Adv. Inbound firewall rule settings ... no changes required ... done. Custom commands completed ... done. Executing custom_php_resync_config_command()...1 table created. 1/1 addresses added. pkg: POST-INSTALL script failed >>> Cleaning up cache... done. Success
-
Well it doesn't fail at the GeoIP step …
can you run from the shell
php /usr/local/www/pfblockerng/pfblockerng.php dc
then try the reinstall ?
-
Sadely no success.
Still the same problem :( -
@Gé:
Sadely no success.
Still the same problem :(Did you read your messages ?
-
@Gé:
Sadely no success.
Still the same problem :(It looks like you are on a x64 system … so it maybe related to something else.
-
Did you read your messages ?
Sorry didn´t saw you pm me.
Gonna do that now what you suggested in the pm.
Thanks man, you´re awesome! -
@haleakalas:
Here is a fix for the MaxMind errors https://forum.pfsense.org/index.php?topic=116307.msg644910#msg644910
please use that thread for this issueSolving the problem by throwing more memory at it worries me a bit. I hate to sound old-school, but 1GB or RAM on a router/firewall is a lot of memory. Allocating upwards of 300MB for one particular function, if that is on exclusive basis, would worry me that the implementation of that function is less than optimal.
As for the installation issue, it is still there. I can no longer install the latest version of pfBlockerNG; although pfSense claims that it's installed it doesn't show anywhere in the menus.
We are just trying to get a fix until BBcan177 can find a proper fix when he comes back.
there is a thread for the installation failure https://forum.pfsense.org/index.php?topic=115966.0
pfBlockerNG with DNSBL requires load of memory as it handle 1M+ table. So 1GB is really not that much memory for this kind or usage.
Thanks @RonpfS setting the memory_limit on line 236 to 300M fixed it. :)
php /usr/local/www/pfblockerng/pfblockerng.php dc
Country code update Start [ 08/04/16 8:02:02 ]
Converting MaxMind Country databases for pfBlockerNG.
Processing ISO IPv4 Continent/Country Data
Processing ISO IPv6 Continent/Country Data
Creating pfBlockerNG Continent XML files
IPv4 Africa
IPv6 Africa
IPv4 Antarctica
IPv6 Antarctica
IPv4 Asia
IPv6 Asia
IPv4 Europe
IPv6 Europe
IPv4 North America
IPv6 North America
IPv4 Oceania
IPv6 Oceania
IPv4 South America
IPv6 South America
IPv4 Proxy and Satellite
IPv6 Proxy and Satellite
IPv4 TOP 20
IPv6 TOP 20
Saving pfBlockerNG Reputation TAB
Country Code Update Ended - [ 08/04/16 8.10:13 ] -
Thanks for the response. Are you saying that I should change the…
Firewall Maximum Table Entries: 2000000
to
Firewall Maximum Table Entries: 4000000
I just wanted to make sure I'm changing the right thing.
This looks like it ;)
Firewall Maximum Table Entries : Maximum number of table entries for systems such as aliases, sshlockout, snort, etc, combined.Also, when the cron jobs were running, I saw something with some large numbers of maybe the 200000 and I was at something like 150000… Sorry I didn't make note of it.
Thanks!
You can review the log file by going to the Firewall/pfBlockerNG/Log Browser tab
Thanks. I saw that 20000 number get changed to 40000-something so I think it's working. Hopefully this will fix it!
I've been having some issues lately so I'm hoping that maybe this clears up some of the problems. I think it's snort related, as the problems ceased when I stopped snort for a few days.
Hi! I've been having another strange problem. I modified that parameter to the 40000-something the other day and rebooted pfsense. It's been running OK now for maybe 3 or 4 days and this-morning, I am receiving the same message and a crash report…
Crash report begins. Anonymous machine information: amd64 10.3-RELEASE-p5 FreeBSD 10.3-RELEASE-p5 #0 7307492(RELENG_2_3_2): Tue Jul 19 13:29:35 CDT 2016 root@ce23-amd64-builder:/builder/pfsense-232/tmp/obj/builder/pfsense-232/tmp/FreeBSD-src/sys/pfSense Crash report details: PHP Errors: [04-Aug-2016 00:18:40 America/Chicago] PHP Fatal error: Allowed memory size of 402653184 bytes exhausted (tried to allocate 72 bytes) in /usr/local/pkg/pfblockerng/pfblockerng.inc on line 3868 [04-Aug-2016 00:18:40 America/Chicago] PHP Stack trace: [04-Aug-2016 00:18:40 America/Chicago] PHP 1\. {main}() /etc/rc.start_packages:0 [04-Aug-2016 00:18:40 America/Chicago] PHP 2\. sync_package() /etc/rc.start_packages:90 [04-Aug-2016 00:18:40 America/Chicago] PHP 3\. eval() /etc/inc/pkg-utils.inc:631 [04-Aug-2016 00:18:40 America/Chicago] PHP 4\. sync_package_pfblockerng() /etc/inc/pkg-utils.inc(631) : eval()'d code:3 [04-Aug-2016 00:18:40 America/Chicago] PHP 5\. array_merge() /usr/local/pkg/pfblockerng/pfblockerng.inc:3868 Filename: /var/crash/minfree 2048
On the dashboard, I have "49% of 2gb" for the memory and 0% swap used.
I'm wondering if my pfsense install is borked because it's been running kind of slow and php-fpm has about 90% utilization when browsing the web interface after an upgrade.
-
I'm actually going to move over to the memory posting in this forum since it sounds like there's others with similar issues…
-
I'm giving another go.
My pfBlockerNG installation gives me this:
Installing pfSense-pkg-pfBlockerNG…
Updating pfSense-core repository catalogue...
pfSense-core repository is up-to-date.
Updating pfSense repository catalogue...
pfSense repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 6 package(s) will be affected (of 0 checked):New packages to be INSTALLED:
pfSense-pkg-pfBlockerNG: 2.1.1_2 [pfSense]
whois: 5.1.5 [pfSense]
GeoIP: 1.6.9 [pfSense]
lighttpd: 1.4.39_1 [pfSense]
grepcidr: 2.0 [pfSense]
aggregate: 1.6_1 [pfSense]Number of packages to be installed: 6
The process will require 2 MiB more space.
[1/6] Installing whois-5.1.5…
[1/6] Extracting whois-5.1.5: …....... done
[2/6] Installing GeoIP-1.6.9…
[2/6] Extracting GeoIP-1.6.9: …....... done
[3/6] Installing lighttpd-1.4.39_1…
[3/6] Extracting lighttpd-1.4.39_1: …....... done
[4/6] Installing grepcidr-2.0…
[4/6] Extracting grepcidr-2.0: ….. done
[5/6] Installing aggregate-1.6_1…
[5/6] Extracting aggregate-1.6_1: …. done
[6/6] Installing pfSense-pkg-pfBlockerNG-2.1.1_2…
[6/6] Extracting pfSense-pkg-pfBlockerNG-2.1.1_2: …....... done
Saving updated package information...
done.
Loading package configuration... done.
Configuring package components...
Loading package instructions...
Custom commands...
Executing custom_php_install_command()...
MaxMind GeoIP databases previously downloaded.
Adding pfBlockerNG Widget to the Dashboard... done.
Remove any existing and create link for DNSBL lighttpd executable... done.
Creating DNSBL web server start-up script... done.
Upgrading Adv. Inbound firewall rule settings ... no changes required ... done.
Custom commands completed ... done.
Executing custom_php_resync_config_command()...pkg: POST-INSTALL script failed
Message from GeoIP-1.6.9:
GeoIP does not ship with the actual data files. You must download
them yourself! Please run:/usr/local/bin/geoipupdate.sh
Cleaning up cache... done.
SuccessYet, still nothing shows up under the Firewall menu, but I keep going with the following steps:
Diagnostics/EditFile : /usr/local/pkg/pfblockerng/pfblockerng.inc
Search for:
"pfb_global();// DNSBL Lighttpd HTTPS ..."
Insert "ini_set('memory_limit', '300M');" on the empty line.
Save the file.
Diagnostics/CommandPrompt/Shell : php /usr/local/www/pfblockerng/pfblockerng.php dc
Let it crunch for a while, browser timeout so I can't see the result of the php command!
Wait another 10mn and relogin into pfsense. pfblockerng still not in the menu.Reboot pfsense with hope that it will show up.
But it doesn't. Find error message in the system log file:
"rc.bootup: New alert found: There were error(s) loading the rules: /tmp/rules.debug:35: cannot define table pfB_Europe_v6: Cannot allocate memory - The line in question reads [35]: table <pfb_europe_v6>persist file "/var/db/aliastables/pfB_Europe_v6.txt"I tried the whole thing with 500MB, still the same result.
What else to try?Is there a way I can "force" the menu to show up pfblockerng. If I can access it I could at least turn on the package logs and get maybe more info on what's going on deep down…</pfb_europe_v6>
-
Follow up on my own earlier post.
It turns out that the php command is not executed at all, that's probably why my browser times out after a few minutes.When I run the same command (php /usr/local/www/pfblockerng/pfblockerng.php dc) in a "php command window" (without the php part) I get the following message:
Parse error: syntax error, unexpected '/' in /tmp/V7fSSN on line 5I reinstalled pfblockerng once again thinking that maybe i damaged something during my file edit earlier, but same things have happened.
The install seems to go through. The package doesn't show up in the menu.If only pfsense would allow to go back to an earlier version of a package…
-
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /usr/local/pkg/pfblockerng/pfblockerng.inc on line 3874 Call Stack: 0.0000 250096 1. {main}() /usr/local/www/pkg_edit.php:0 0.1150 2023904 2. eval('global $pfb; $pfb['save'] = TRUE; sync_package_pfblockerng();') /usr/local/www/pkg_edit.php:253 0.1150 2024816 3. sync_package_pfblockerng() /usr/local/www/pkg_edit.php(253) : eval()'d code:3 9.7837 279349272 4. file() /usr/local/pkg/pfblockerng/pfblockerng.inc:3874 PHP ERROR: Type: 1, File: /usr/local/pkg/pfblockerng/pfblockerng.inc, Line: 3874, Message: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes)
-
Seems like the code is bugged, reinstalling the package doesnt even work, the post install script fails and the pfblocker interface doesnt show up in the firewall tab.
-
@haleakalas:
Follow up on my own earlier post.
It turns out that the php command is not executed at all, that's probably why my browser times out after a few minutes.When I run the same command (php /usr/local/www/pfblockerng/pfblockerng.php dc) in a "php command window" (without the php part) I get the following message:
Parse error: syntax error, unexpected '/' in /tmp/V7fSSN on line 5I reinstalled pfblockerng once again thinking that maybe i damaged something during my file edit earlier, but same things have happened.
The install seems to go through. The package doesn't show up in the menu.If only pfsense would allow to go back to an earlier version of a package…
Going back to an earlier will not work as the MaxMind GeoIP database changes since.
Before the db was in range format, now it is in CIDR format. BBcan177 will fix this in a week or so. In the meantime we are try to get thing going by raising the php memory limit.Can you retry the php /usr/local/www/pfblockerng/pfblockerng.php dc command from the shell (option 8 or SSH) to see if it succeeds.
Once this works, there is no need to re-run it. The next change to the DB will in a month.Did you read https://forum.pfsense.org/index.php?topic=116307 ? Please reply in that post for the memory issue.
-
Seems like the code is bugged, reinstalling the package doesnt even work, the post install script fails and the pfblocker interface doesnt show up in the firewall tab.
Installation might fail at the MaxMind GeoIP step, the memory issue is discussed here https://forum.pfsense.org/index.php?topic=116307
-
@haleakalas:
Follow up on my own earlier post.
It turns out that the php command is not executed at all, that's probably why my browser times out after a few minutes.When I run the same command (php /usr/local/www/pfblockerng/pfblockerng.php dc) in a "php command window" (without the php part) I get the following message:
Parse error: syntax error, unexpected '/' in /tmp/V7fSSN on line 5I reinstalled pfblockerng once again thinking that maybe i damaged something during my file edit earlier, but same things have happened.
The install seems to go through. The package doesn't show up in the menu.If only pfsense would allow to go back to an earlier version of a package…
Hi did you look at RonpfS remark #26 in the thread below?
https://forum.pfsense.org/index.php?topic=116307.15
-
One consequence of the MaxMind GeoIP change is that IPV6 table are much bigger than before.
So if you are blocking loads of Country, you might ran out of memory processing the feeds and loading the rules.For some users, you may have to fix the pfblockerng.inc file.
You may also have to change the Firewall Maximum Table Entries.There is a note under GeoIP
Note: pfSense by default implicitly blocks all unsolicited inbound traffic to the WAN interface.
Therefore adding GeoIP based firewall rules to the WAN will not provide any benefit, unless there are open WAN ports.It's also not recommended to block the 'world', instead consider rules to 'Permit' traffic from selected Countries only.
Also consider protecting just the specific open WAN ports and it's just as important to protect the outbound LAN traffic.Some users change from blocking the "World" to allowing specific countries and that fixes the memory issues.
You can read the following topic Taming the beasts… aka suricata blueprint. It explain the concept of setting up a Firewall. Some information is outdated, but the concepts are still actual.