PfBlocker



  • just updated to new version and there is a problem with widget

    enabling it will cause other widgets (not all) not to be displayed (ex : interface statistics)


  • Netgate Administrator

    Congratulations guys!  :)
    This looks like an outstanding package. Genuinely useful.

    Steve



  • @hubsd:

    just updated to new version and there is a problem with widget

    enabling it will cause other widgets (not all) not to be displayed (ex : interface statistics)

    I will take a look.

    EDIT

    Fixed. Reinstall package in about 15 minutes to get fixed widget file.



  • nice work!!! its working nicely on my 2.1-dev box



  • After a reboot, I did receive an error alert but the list still loaded:

    There were error(s) loading the rules:
    /tmp/rules.debug:21: cannot load "/var/db/aliastables/pfBlockerTopSpammers.txt": No such file or directory
    /tmp/rules.debug:23: cannot load "/var/db/aliastablespfBlockerBadGuys.txt": No such file or directory
    pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [21]: table <pfblockertopspammers>persist file "/var/db/aliastables/pfBlockerTopSpammers.txt"</pfblockertopspammers> 
    


  • This happens when pfBlocker is running While filter reloads. Boot is one of these cases.

    This is not a big deal as pfBlocker call filter reload when finish.



  • I figured it would be normal but wanted to share just in-case



  • I would recommend you to detect that you are at boot phase and do not don anything.

    I generally do not like that packages call filter_configure() but rather would like packages to go and use pfctl themselves and exploit the anchors, though it needs more familiarity with pfctl.



  • @marcelloc:

    @hubsd:

    just updated to new version and there is a problem with widget

    enabling it will cause other widgets (not all) not to be displayed (ex : interface statistics)

    I will take a look.

    EDIT

    Fixed. Reinstall package in about 15 minutes to get fixed widget file.

    thx, I confirm that it works now !



  • @ermal:

    I would recommend you to detect that you are at boot phase and do not don anything.

    OK, I will find a way.

    @ermal:

    I generally do not like that packages call filter_configure() but rather would like packages to go and use pfctl themselves and exploit the anchors, though it needs more familiarity with pfctl.

    The first generation of this package (countryblock) was editing /tmp/rules.debug. cmd asked tommyboy to change the way package apply rules.
    The fist idea to improve stability was using pfsense 2.0 native options to edit rules. So current version of pfblocker create aliases, rules and then apply with filter_configure(). This was the best way I found to apply rules when users saves pfBlocker's conf.



  • Great package. I have installed the latest version and I am wondering what happened to the deny inbound/outbound option? There are cases where you may block traffic to and from these countries (like countries which both do a lot of attacks, spam etc and host a lot of malware you do not want your users contacting. Is it possible to put that back in please? Thank you



  • Re-Installed 0.1.4 working fine
    one detail … Package Info link still points to Country Block http://forum.pfsense.org/index.php/topic,25732.0.html



  • I try to update very large blocklist and I get error:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10106374 bytes) in /usr/local/pkg/pfblocker.inc on line 248

    Same list work with IP-blocklist.

    And after I put some smaller bloclist I get another error:

    php: : There were error(s) loading the rules: /tmp/rules.debug:21: cannot define table pfBlockerblocklist: Cannot allocate memory pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [21]: table <pfblockerblocklist>persist file "/var/db/aliastables/pfBlockerblocklist.txt"</pfblockerblocklist>



  • @kevross33:

    Great package. I have installed the latest version and I am wondering what happened to the deny inbound/outbound option? There are cases where you may block traffic to and from these countries (like countries which both do a lot of attacks, spam etc and host a lot of malware you do not want your users contacting.

    In special cases, you can choose alias only option and create your own rule using alias pfBlocker created.

    You can also add this list into two aliases and block inbound one and block outbound other.

    @kevross33:

    Is it possible to put that back in please?

    Not sure but I'll take a note.



  • @firbc:

    I try to update very large blocklist and I get error:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10106374 bytes) in /usr/local/pkg/pfblocker.inc on line 248

    Same list work with IP-blocklist.

    The way pfBlocker downloads list is different then ipblocklist.
    To increase php memory limit, edit php.ini:

    php.ini location path is:
    /usr/local/lib/php.ini or
    /usr/local/etc/php.ini

    Edit the memory_limit cvar to 256
    ie. memory_limit = 256

    save file and reboot

    @firbc:

    And after I put some smaller bloclist I get another error:
    php: : There were error(s) loading the rules: /tmp/rules.debug:21: cannot define table pfBlockerblocklist: Cannot allocate memory pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [21]: table <pfblockerblocklist>persist file "/var/db/aliastables/pfBlockerblocklist.txt"</pfblockerblocklist>

    check this:

    • Increase even more Firewall Maximum Table Entries

    • clear ipblocklist table in diagnostics-> table

    • check if the value of table-entries in /tmp/rules.debug is the same in Firewall Maximum Table Entries

    • check also if table-entries is declared twice in /tmp/rules.debug

    BUT
    The most important thing is: read list description you are including and see if it is realy a bad guys or nasty list.

    One example of not bad list is leve1 ip-blocklist file.
    See its description:
    Author's description:
    Companies or organizations who are clearly involved with trying to stop filesharing.
    Companies which anti-p2p activity has been seen from.
    Companies that produce or have a strong financial interest in copyrighted material.
    Government ranges or companies that have a strong financial interest in doing work for governments.
    Legal industry ranges.
    IPs or ranges of ISPs from which anti-p2p activity has been observed.



  • @RonpfS:

    Re-Installed 0.1.4 working fine
    one detail … Package Info link still points to Country Block http://forum.pfsense.org/index.php/topic,25732.0.html

    Thanks, I'll fix it.

    Ok, package info fixed.

    Thank's for your feedback



  • @marcelloc:

    In special cases, you can choose alias only option and create your own rule using alias pfBlocker created.

    You can also add this list into two aliases and block inbound one and block outbound other.

    Great if we use the same table inbound and outbound, we can just use one list ;o) and create a FW rule with that list aliasname ;o)



  • Nice going guys. :) Having trouble having lists work. I get this when the filter reloads.

    There were error(s) loading the rules: /tmp/rules.debug:17: cannot define table pfBlockerantitorrentin: Cannot allocate memory/tmp/rules.debug:19: cannot define table pfBlockerantitorrentout: Cannot allocate memory pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [17]: table persist file "/var/db/aliastables/pfBlockerantitorrentin.txt" …

    Going to try the fixes I see in the thread and report back. Thanks again!



  • After doing tests, don't forget to save pfBlocker config again.



  • Reinstalled after the max tables resize and it works a treat. Thanks! :)



  • I am getting this from time to time: 404 - Not Found



  • Can you paste the url that gets 404 error?



  • https://12.34.56.78/pkg_edit.php?xml=pfblocker.xml

    this happened at the same time as snort was misbehaving … I removed snort now



  • the url is fine.

    while using some packages, the menu url is prefixed with /packages/something/.
    when you choose other url in menu, this prefix persists, and then a 404 error occur.

    This is not a problem related to pfBlocker.



  • I discovered a new problem today, pfsense takes more than 1 minute to finish boot (9 minutes to be accurate !)
    I noticed that it's blocked most on the time on "Configuring firewall" step.

    Without plugin, no problem so…

    There is also that usual "Warning message" in webgui after reboot in webgui (then need to "acknowledge all")

    Setup is Alix 2c3 + pfsense nanobsd + compact flash 2 GB

    Widget and lists :

    RAM/CPU/TABLE usage

    Packages used

    log side, I have this messages (x10)

    php: : New alert found: There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data no IP address found for grep: /tmp/rules.debug:20: file "/var/db/aliastables/pfBlockerInternetTrash.txt" contains bad data no IP address found for grep: /tmp/rules.debug:22: file "/var/db/aliastables/pfBlockerBlizzard.txt" contains bad data no IP address found for grep: /tmp/rules.debug:24: file "/var/db/aliastables/pfBlockeripfilterX.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded The line in question reads [ /tmp/rules.debug]:

    php: : The command '/sbin/pfctl -o basic -f /tmp/rules.debug' returned exit code '1', the output was 'no IP address found for grep: /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data no IP address found for grep: /tmp/rules.debug:20: file "/var/db/aliastables/pfBlockerInternetTrash.txt" contains bad data no IP address found for grep: /tmp/rules.debug:22: file "/var/db/aliastables/pfBlockerBlizzard.txt" contains bad data no IP address found for grep: /tmp/rules.debug:24: file "/var/db/aliastables/pfBlockeripfilterX.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded'



  • @hubsd:

    I discovered a new problem today, pfsense takes more than 1 minute to finish boot (9 minutes to be accurate !)

    Setup is Alix 2c3 + pfsense nanobsd + compact flash 2 GB

    Same here - massive issues on 2.0 embedded (Countryblock works apart from logging though). I see loads of:

    Nov 4 14:14:29 	php: : There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:24: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data no IP address found for grep: /tmp/rules.debug:26: file "/var/db/aliastables/pfBlockerNorthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:28: file "/var/db/aliastables/pfBlockerOceania.txt" contains bad data no IP address found for grep: /tmp/rules.debug:30: file "/var/db/aliastables/pfBlockerSouthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:32: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [ /tmp/rules.debug]:
    Nov 4 14:14:29 	php: : New alert found: There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:24: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data no IP address found for grep: /tmp/rules.debug:26: file "/var/db/aliastables/pfBlockerNorthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:28: file "/var/db/aliastables/pfBlockerOceania.txt" contains bad data no IP address found for grep: /tmp/rules.debug:30: file "/var/db/aliastables/pfBlockerSouthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:32: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded The line in question reads [ /tmp/rules.debug]:
    Nov 4 14:14:28 	php: : The command '/sbin/pfctl -o basic -f /tmp/rules.debug' returned exit code '1', the output was 'no IP address found for grep: /tmp/rules.debug:24: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data no IP address found for grep: /tmp/rules.debug:26: file "/var/db/aliastables/pfBlockerNorthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:28: file "/var/db/aliastables/pfBlockerOceania.txt" contains bad data no IP address found for grep: /tmp/rules.debug:30: file "/var/db/aliastables/pfBlockerSouthAmerica.txt" contains bad data no IP address found for grep: /tmp/rules.debug:32: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded'
    

    The firewall seems to be blocked then altogether. I guess there's an issue with rw mounting nanobsd…
    Went back to Countryblock for the time being.
    Featurewise pfBlocker seems great though!



  • I found a fetch issue While booting and on url table pfblocker get file function. I'm fixing it today.

    EDIT

    version 0.1.4.1 released with fixes in:

    • boot process

    • embedded platform

    • url table get file package function

    Many thanks for all of you that are helping us with this package.



  • Very nice package, indeed. No errors to report so far. pfsense 2.0 release amd64.



  • ok, now it takes 3/4 minutes to finish boot (better than 9 minutes)

    I still have those warning messages

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:

    There were error(s) loading the rules: no IP address found for grep:
    /tmp/rules.debug:18: file "/var/db/aliastables/pfBlockerEurope.txt" contains bad data
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [
    /tmp/rules.debug]:



  • what version are you using?

    I have no embedded hardware to test it, I'm looking a way to do this using virtualbox.



  • pfSense 2.0-RELEASE (i386) / nanobsd on Compact Flash 2 Gb
    pfBlocker-dev 0.1.4.1

    I have a 4 Gb microdrive somewhere, should I give it a try ?



  • I' ve tested virtualbox + pfsense 2.0 amd64 embedded kernel with no issues.

    I'm not sure if embedded kernel will work the same way nanobsd on Compact Flash 2 Gb will do.

    I found some posts on forum saying that is not easy to run nanobsd img on virtualbox, but I'm still trying..



  • hubsd,

    Second test, first problem:

    I've changed /etc/platform to nanobsd.
    after a reboot mount -a returns:

    /dev/ad0s1a on / (ufs, local, noatime, read-only, synchronous)
    devfs on /dev (devfs, local)
    /dev/md0 on /tmp (ufs, local)
    /dev/md1 on /var (ufs, local)
    
    

    So, read-only file system.

    installed and configured pfblocker with no issues.

    after a reboot,
    I got the same error:

    
    php: : The command '/sbin/pfctl -o basic -f /tmp/rules.debug' returned exit code '1', the output was 'no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded'
    php: : New alert found: There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded The line in question reads [ /tmp/rules.debug]:
    php: : There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [ /tmp/rules.debug]:
    

    But, without saving any new config, I've looked at diagnostics-> table and pfBlockerTopSpammers was filled up normally, alias was there and firewall rules too.

    So, Isn't it just a 'until boot finishes issue'?

    Can you check if it happens the same way on your installation?

    I know system alerts are annoying and have to be fixed but if package is still working, isn't it a minor issue?

    Second problem:
    boot takes 3 to 4 minutes.
    it's a problem in fetch call that has no time out(or 01:15 timeout), I'll include a timeout patch to pfsense-tools.inc file on next release.



  • Quick update, i exported my nanobsd config and imported it in a microdrive + classic embedded installation (so no nanobsd)

    I can confirm that I have zero issue now and boot time takes 2 minutes.

    So the problems I noticed are only while using nanobsd.



  • @marcelloc:

    hubsd,

    Second test, first problem:

    I've changed /etc/platform to nanobsd.
    after a reboot mount -a returns:

    /dev/ad0s1a on / (ufs, local, noatime, read-only, synchronous)
    devfs on /dev (devfs, local)
    /dev/md0 on /tmp (ufs, local)
    /dev/md1 on /var (ufs, local)
    
    

    So, read-only file system.

    installed and configured pfblocker with no issues.

    after a reboot,
    I got the same error:

    
    php: : The command '/sbin/pfctl -o basic -f /tmp/rules.debug' returned exit code '1', the output was 'no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded'
    php: : New alert found: There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded The line in question reads [ /tmp/rules.debug]:
    php: : There were error(s) loading the rules: no IP address found for grep: /tmp/rules.debug:15: file "/var/db/aliastables/pfBlockerTopSpammers.txt" contains bad data pfctl: Syntax error in config file: pf rules not loaded - The line in question reads [ /tmp/rules.debug]:
    

    But, without saving any new config, I've looked at diagnostics-> table and pfBlockerTopSpammers was filled up normally, alias was there and firewall rules too.

    So, Isn't it just a 'until boot finishes issue'?

    Can you check if it happens the same way on your installation?

    I know system alerts are annoying and have to be fixed but if package is still working, isn't it a minor issue?

    Second problem:
    boot takes 3 to 4 minutes.
    it's a problem in fetch call that has no time out(or 01:15 timeout), I'll include a timeout patch to pfsense-tools.inc file on next release.

    Just saw your answer, well the problem is only until boot finishes issue yes ! It slow down boot time + spam warning messages. pfBlocker works fine so yes it's not a major issue and is because of nanobsd …



  • Version 0.1.4.2 includes fixes to 3-9 minutes boot on embedded systems.



  • thanks !



  • just installed pfsense and this tonight…. getting emails of this:

    There were error(s) loading the rules: /tmp/rules.debug:17: cannot define table pfBlockerAfrica: Cannot allocate memory
    /tmp/rules.debug:19: cannot define table pfBlockerAsia: Cannot allocate memory
    /tmp/rules.debug:21: cannot define table pfBlockerEurope: Cannot allocate memory
    /tmp/rules.debug:23: cannot define table pfBlockerNorthAmerica: Cannot allocate memory
    /tmp/rules.debug:25: cannot define table pfBlockerOceania: Cannot allocate memory
    /tmp/rules.debug:27: cannot define table pfBlockerSouthAmerica: Cannot allocate memory
    /tmp/rules.debug:29: cannot define table pfBlockerTopSpammers: Cannot allocate memory
    /tmp/rules.debug:31: cannot define table pfBlockerBlockedLists: Cannot allocate memory
    pfctl: Syntax error in config file: pf rules not loaded The line in question reads [17]: table <pfblockerafrica>persist file "/var/db/aliastables/pfBlockerAfrica.txt"

    :( how do I fix?

    edit just figured out how to up my tables size. Upped it to 100mil.

    I'm testing the ad blocking lists and they aren't blocking anything. All I've done was add the lists and tell it to deny_inbound. Is there anything else I should be doing to make this work? Thanks.

    Also if anyone knows of any great ad lists to help me block all the advertisements I possibly can please do let me know! :)</pfblockerafrica>



  • While blocking adwares, proxies, spywares the default way is outbound

    Take a look in ipblocklist, the are many lists there.

    Also pay attention on direction.
    If you want to do not access somewhere, the action is deny outbound.
    If you want that someone in somewhere do not access your network, the action is deny inbound.

    If 100mil means you Speaker portuguese, there is also a pfBlocker topic in portuguese forum.



  • @marcelloc:

    While blocking adwares, proxies, spywares the default way is outbound

    Take a look in ipblocklist, the are many lists there.

    Also pay attention on direction.
    If you want to do not access somewhere, the action is deny outbound.
    If you want that someone in somewhere do not access your network, the action is deny inbound.

    If 100mil means you Speaker portuguese, there is also a pfBlocker topic in portuguese forum.

    I'm American. Thanks for the clarification. I was up till 3am last night playing with this, tweaking and fixing several small issues. Still got a few left, but so far I am amazed at pfsense. This is way better than Mikrotik for my needs and its FREE. :)


Log in to reply