Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PfBlockerNG v2.0 w/DNSBL

    Scheduled Pinned Locked Moved pfBlockerNG
    1.1k Posts 192 Posters 1.6m Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Panja
      last edited by

      Thanks fellow Dutchman.  ;D
      I have created an alias with the admin ports now as well.
      See post above –> [UPDATE]

      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned
        last edited by

        @Jamerson:

        Guys, any suggestions why the webserver is not starting ?
        pfBlockerNG DNSBL Web Server is not starting,

        Yes. Because a variable is undefined on install (see the first line in the code below), so it creates a broken /usr/local/etc/rc.d/dnsbl.sh with missing path to the lighttpd config file.

        Copy and paste this to Diagnostics - Command Prompt - PHP Execute, click the 'Execute' button and problem fixed.

        
        $pfb['dnsbl_conf'] = '/var/unbound/pfb_dnsbl_lighty.conf';
        $rc = array();
        $rc['file'] = 'dnsbl.sh';
        $rc['start'] = << <eof<br># Start DNSBL Lighttpd webserver
        	if [ -f '{$pfb['dnsbl_conf']}' ]; then
        		/usr/local/sbin/lighttpd_pfb -f '{$pfb['dnsbl_conf']}'
        	fi
        
        	# Terminate DNSBL HTTPS Daemon if found
        	pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
        	if [ ! -z "\${pidnum}" ]; then
        		/bin/kill -9 "\${pidnum}"
        		/bin/sleep 2
        	fi
        
        	# Start DNSBL HTTPS Daemon
        	/usr/local/bin/php -f /usr/local/pkg/pfblockerng/pfblockerng.inc dnsbl &
        
        EOF;
        
        $rc['stop'] = << <eof<br># Terminate DNSBL Lighttpd webserver, if found.
        	pidnum="$(/bin/pgrep lighttpd_pfb)"
        	if [ ! -z "\${pidnum}" ]; then
        		/usr/bin/killall lighttpd_pfb
        	fi
        
        	# Terminate DNSBL HTTPS Daemon, if found.
        	pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
        	if [ ! -z "\${pidnum}" ]; then
        		/bin/kill -9 "\${pidnum}"
        		/bin/sleep 2
        	fi
        
        EOF;
        
        write_rcfile($rc);
        
        mwexec("/usr/bin/sed -i -e 's/\r//g' /usr/local/etc/rc.d/dnsbl.sh");
        mwexec_bg("/usr/local/etc/rc.d/dnsbl.sh start");</eof<br></eof<br> 
        
        1 Reply Last reply Reply Quote 0
        • P
          Panja
          last edited by

          Is there a way, or will there be a way (in a future release) to add our own EasyList?
          As a Dutchman, I would like to add the Dutch EasyList, to block elements specially found on Dutch websites.

          Thanks

          1 Reply Last reply Reply Quote 0
          • J
            Jamerson
            last edited by

            @doktornotor:

            @Jamerson:

            Guys, any suggestions why the webserver is not starting ?
            pfBlockerNG DNSBL Web Server is not starting,

            Yes. Because a variable is undefined on install (see the first line in the code below), so it creates a broken /usr/local/etc/rc.d/dnsbl.sh with missing path to the lighttpd config file.

            Copy and paste this to Diagnostics - Command Prompt - PHP Execute, click the 'Execute' button and problem fixed.

            
            $pfb['dnsbl_conf'] = '/var/unbound/pfb_dnsbl_lighty.conf';
            $rc = array();
            $rc['file'] = 'dnsbl.sh';
            $rc['start'] = << <eof<br># Start DNSBL Lighttpd webserver
            	if [ -f '{$pfb['dnsbl_conf']}' ]; then
            		/usr/local/sbin/lighttpd_pfb -f '{$pfb['dnsbl_conf']}'
            	fi
            
            	# Terminate DNSBL HTTPS Daemon if found
            	pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
            	if [ ! -z "\${pidnum}" ]; then
            		/bin/kill -9 "\${pidnum}"
            		/bin/sleep 2
            	fi
            
            	# Start DNSBL HTTPS Daemon
            	/usr/local/bin/php -f /usr/local/pkg/pfblockerng/pfblockerng.inc dnsbl &
            
            EOF;
            
            $rc['stop'] = << <eof<br># Terminate DNSBL Lighttpd webserver, if found.
            	pidnum="$(/bin/pgrep lighttpd_pfb)"
            	if [ ! -z "\${pidnum}" ]; then
            		/usr/bin/killall lighttpd_pfb
            	fi
            
            	# Terminate DNSBL HTTPS Daemon, if found.
            	pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
            	if [ ! -z "\${pidnum}" ]; then
            		/bin/kill -9 "\${pidnum}"
            		/bin/sleep 2
            	fi
            
            EOF;
            
            write_rcfile($rc);
            
            mwexec("/usr/bin/sed -i -e 's/\r//g' /usr/local/etc/rc.d/dnsbl.sh");
            mwexec_bg("/usr/local/etc/rc.d/dnsbl.sh start");</eof<br></eof<br> 
            

            thank you mate,
            runned the php code but nothing happens .

            I get this error

            Diagnostics: Execute command help

            Note: this function is unsupported. Use it on your own risk!

            rebooted the firewall but the services still not starting

            1 Reply Last reply Reply Quote 0
            • D
              doktornotor Banned
              last edited by

              And what exactly did you expect to happen? Check that the service is running. If not, post the output of

              
              /usr/local/etc/rc.d/dnsbl.sh start
              
              

              here. And post the entire file here as attachment.

              1 Reply Last reply Reply Quote 0
              • J
                Jamerson
                last edited by

                @doktornotor:

                And what exactly did you expect to happen? Check that the service is running. If not, post the output of

                
                /usr/local/etc/rc.d/dnsbl.sh start
                
                

                here. And post the entire file here as attachment.

                thank you for your answer,
                I was expecting the service would start after I run the command.
                isn't that the aim ?
                when I run the command the firewall doesn't respond at all !
                i'v tired different command to check if it will responde and it does.

                the command

                [2.2.5-RELEASE][root@firewall]/root: /usr/local/etc/rc.d/dnsbl.sh start

                [2.2.5-RELEASE][root@Pfsense]/root:
                [2.2.5-RELEASE][root@Pfsense]/root:

                is not responding at all.

                1 Reply Last reply Reply Quote 0
                • D
                  doktornotor Banned
                  last edited by

                  Uhm??? And what output exactly are you expecting? This is NORMAL! If there are no errors, there won't be any output. How exactly are you determining that your service is NOT running?

                  1 Reply Last reply Reply Quote 0
                  • J
                    Jamerson
                    last edited by

                    Than you for your answer,
                    attached picture is showing that the services is not running .
                    when i try to run the service manually it said it started but nothings happend

                    thank you

                    ![Screen Shot 2015-11-25 at 9.13.32 PM.png](/public/imported_attachments/1/Screen Shot 2015-11-25 at 9.13.32 PM.png)
                    ![Screen Shot 2015-11-25 at 9.13.32 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2015-11-25 at 9.13.32 PM.png_thumb)

                    1 Reply Last reply Reply Quote 0
                    • S
                      schnubert
                      last edited by

                      Hi!

                      I am having a short question to the different aliases for the different lists as suggested here https://forum.pfsense.org/index.php?topic=102470.msg573159#msg573159.
                      So, apart from having the possibility to set a different update-interval is thtere another benefitout of it?

                      thanks in advance and many thanks to BBCan177  :)!

                      1 Reply Last reply Reply Quote 0
                      • D
                        doktornotor Banned
                        last edited by

                        V@schnubert:

                        So, apart from having the possibility to set a different update-interval is thtere another benefitout of it?

                        The Alexa whitelisting is also per-alias. (You normally do NOT want to whitelist most "popular" advertising sites…)

                        1 Reply Last reply Reply Quote 0
                        • S
                          schnubert
                          last edited by

                          Valid point…  ;)

                          I wasnt investing Alexa so far, it seems I should!

                          thanks!  :D

                          1 Reply Last reply Reply Quote 0
                          • G
                            Gerard64
                            last edited by

                            Today I updated PfblockerNG to version 2.0.1 and enabled and configured DNSBL like BBcan177 explained at https://forum.pfsense.org/index.php?topic=102470.msg572943#msg572943 after some fiddling around (I exchanged dnsforwarder with dnsresolver) it started. But now I have another problem I can't solve. I have a local domain at a local bind9 I override my local domain in dnsresolver like I did before with dnsforwarder but now I can't do reverse lookups anymore.

                            How can I make reverse lookups work again?

                            1 Reply Last reply Reply Quote 0
                            • BBcan177B
                              BBcan177 Moderator
                              last edited by

                              @trinidadrancheria:

                              I was thinking about using the new features of pfBlockerNG 2.0 to stop spam at the firewall since the current version of PostFix does not yet support DNSBL out of the box..

                              IP lists and DNSBL feeds can protect a Mail server, but it won't replace DNS RBL functionality of Postfix/SpamAssassin etc…

                              @AndrewZ:

                              Re-installed and re-configured from scratch, nothing helps, the warning is still there.
                              No error in the log.
                              /var/db/pfblockerng/deny is empty (I have permit aliases only).

                              @AndrewZ,
                              De-duplication is only used for Deny rules. So just disable dedup to clear that warning message.

                              @ha11oga11o:

                              Dear BBcan177 i just want to express my huge gratitude to you incorporating DNSBL. Im using it for couple of days so far. It is insane how god is behave on my network. It is really insane how good it is. It simply work and it blocks so much garbage that is almost impossible to believe.

                              THANK YOU!

                              Thanks!

                              @doktornotor:

                              Yes. Because a variable is undefined on install (see the first line in the code below), so it creates a broken /usr/local/etc/rc.d/dnsbl.sh with missing path to the lighttpd config file.

                              Thanks Dok… I will get that variable fixed asap.

                              @schnubert:

                              So, apart from having the possibility to set a different update-interval is there another benefit out of it?

                              @schnubert,
                              Most DNSBL lists are updated on a daily basis… hpHosts has a partial feed that updates more frequently. You can see the last updated timestamp for IP/DNSBL Lists/feeds at the end of the pfBlockerng.log after any Cron event.

                              @Gé:

                              I have a local domain at a local bind9 I override my local domain in dnsresolver like I did before with dnsforwarder but now I can't do reverse lookups anymore.

                              Probably best to ask for help in the DNS forum section for this issue.

                              @Jamerson:

                              Than you for your answer, attached picture is showing that the services is not running .
                              when i try to run the service manually it said it started but nothings happened

                              @Jamerson,
                              Please edit the following file  /usr/local/etc/rc.d/dnsbl.sh

                              and add the line in red as shown below:

                              186 update_static_output(" done.\nCreating DNSBL web server start-up script…");
                                    $pfb['dnsbl_conf'] = '/var/unbound/pfb_dnsbl_lighty.conf';
                              187 $rc = array();

                              Then run:

                              /usr/local/etc/rc.d/dnsbl.sh start
                              

                              Also did you follow the checklist here:
                              https://forum.pfsense.org/index.php?topic=102470.msg573776#msg573776

                              "Experience is something you don't get until just after you need it."

                              Website: http://pfBlockerNG.com
                              Twitter: @BBcan177  #pfBlockerNG
                              Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                              1 Reply Last reply Reply Quote 0
                              • P
                                Panja
                                last edited by

                                @Panja:

                                Is there a way, or will there be a way (in a future release) to add our own EasyList?
                                As a Dutchman, I would like to add the Dutch EasyList, to block elements specially found on Dutch websites.

                                Thanks

                                Can this be done?

                                1 Reply Last reply Reply Quote 0
                                • G
                                  Gerard64
                                  last edited by

                                  @BBcan177:

                                  @Gé:

                                  I have a local domain at a local bind9 I override my local domain in dnsresolver like I did before with dnsforwarder but now I can't do reverse lookups anymore.

                                  Probably best to ask for help in the DNS forum section for this issue.

                                  I could do that. This morning wen i woke up several wlan users complained they couldn't get on the internet. i can't see anything wrong in pfsense everything seems to work but i can't get to internet on wlan. To many trouble with DNSBL so i'm going to disable DNSBL and start using dns-forwarder again and pfblocker without dnsbl. I also had to stop using ram file system for /var and /tmp because here also trouble because /var was full all the time wen i use dnsbl. anyway to much problems.

                                  Edit: Wlan problems seem to be that pfsense local freeradius server can't be reached anymore.

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    Jamerson
                                    last edited by

                                    @Jamerson,
                                    Please edit the following file  /usr/local/etc/rc.d/dnsbl.sh

                                    and add the line in red as shown below:

                                    186 update_static_output(" done.\nCreating DNSBL web server start-up script…");
                                          $pfb['dnsbl_conf'] = '/var/unbound/pfb_dnsbl_lighty.conf';
                                    187 $rc = array();

                                    Then run:

                                    /usr/local/etc/rc.d/dnsbl.sh start
                                    

                                    Also did you follow the checklist here:
                                    https://forum.pfsense.org/index.php?topic=102470.msg573776#msg573776

                                    thank you so much for your answer,
                                    the check list is already enabled ,
                                    I've checked the as show but can't seem the find the location on the code to add the red line
                                    below is what it shows on the dnsbl.sh file

                                    #!/bin/sh

                                    This file was automatically generated

                                    by the pfSense service handler.

                                    rc_start() {

                                    Start DNSBL Lighttpd webserver

                                    if [ -f '/var/unbound/pfb_dnsbl_lighty.conf' ]; then
                                    /usr/local/sbin/lighttpd_pfb -f '/var/unbound/pfb_dnsbl_lighty.conf'
                                    fi

                                    Terminate DNSBL HTTPS Daemon if found

                                    pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
                                    if [ ! -z "${pidnum}" ]; then
                                    /bin/kill -9 "${pidnum}"
                                    /bin/sleep 2
                                    fi

                                    Start DNSBL HTTPS Daemon

                                    /usr/local/bin/php -f /usr/local/pkg/pfblockerng/pfblockerng.inc dnsbl &

                                    }

                                    rc_stop() {

                                    Terminate DNSBL Lighttpd webserver, if found.

                                    pidnum="$(/bin/pgrep lighttpd_pfb)"
                                    if [ ! -z "${pidnum}" ]; then
                                    /usr/bin/killall lighttpd_pfb
                                    fi

                                    Terminate DNSBL HTTPS Daemon, if found.

                                    pidnum="$(/bin/ps -wax | /usr/bin/grep '[p]fblockerng.inc dnsbl' | /usr/bin/awk '{print $1}')"
                                    if [ ! -z "${pidnum}" ]; then
                                    /bin/kill -9 "${pidnum}"
                                    /bin/sleep 2
                                    fi

                                    }

                                    case $1 in
                                    start)
                                    rc_start
                                    ;;
                                    stop)
                                    rc_stop
                                    ;;
                                    restart)
                                    rc_stop
                                    rc_start
                                    ;;
                                    esac

                                    1 Reply Last reply Reply Quote 0
                                    • I
                                      Ibor Daru
                                      last edited by

                                      @Panja:

                                      Is there a way, or will there be a way (in a future release) to add our own EasyList?
                                      As a Dutchman, I would like to add the Dutch EasyList, to block elements specially found on Dutch websites.

                                      Thanks

                                      Concur to that as well!

                                      1 Reply Last reply Reply Quote 0
                                      • BBcan177B
                                        BBcan177 Moderator
                                        last edited by

                                        @Ibor:

                                        @Panja:

                                        Is there a way, or will there be a way (in a future release) to add our own EasyList?
                                        As a Dutchman, I would like to add the Dutch EasyList, to block elements specially found on Dutch websites.

                                        Thanks

                                        Concur to that as well!

                                        @Panja @Ibor Daru,

                                        Yes this can be done. However, I am working on porting the package to 2.3 (Bootstrap) and trying to manage day-to-day life at the same time…  :)

                                        ADBlock works differently than DNSBL... ADBlock can filter domains as follows:

                                        www.cnn.com/banners/example.com

                                        AdBlock will filter any domain listed in the /banners folder, but DNSBL will need to know explicitly which Domains to block. ADBlock also has subdomains which if used in DNSBL will cause severe False Positives.

                                        So to use any of the other ADBlock EasyList feeds (Dutch, Chinese, German etc...) I have to know which categories are the actual ADvert domains. Not all of the ADBlock EasyList Feeds can be used...

                                        If you look at the DNSBL EasyList Tab, you can see which categories are being used for EasyList (w/o Elements) and EasyList Privacy.. You can compare this to the raw EasyList file and manually add the Dutch EasyList ADvert domains and add those to a Custom List for DNSBL. Just make sure that its formatted to one domain per line.

                                        It is something that I would like to do... Just need to find some time... But it will be added :)

                                        "Experience is something you don't get until just after you need it."

                                        Website: http://pfBlockerNG.com
                                        Twitter: @BBcan177  #pfBlockerNG
                                        Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                                        1 Reply Last reply Reply Quote 0
                                        • BBcan177B
                                          BBcan177 Moderator
                                          last edited by

                                          @Gé:

                                          @BBcan177:

                                          @Gé:

                                          I have a local domain at a local bind9 I override my local domain in dnsresolver like I did before with dnsforwarder but now I can't do reverse lookups anymore.

                                          Probably best to ask for help in the DNS forum section for this issue.

                                          I could do that. This morning wen i woke up several wlan users complained they couldn't get on the internet. i can't see anything wrong in pfsense everything seems to work but i can't get to internet on wlan. To many trouble with DNSBL so i'm going to disable DNSBL and start using dns-forwarder again and pfblocker without dnsbl. I also had to stop using ram file system for /var and /tmp because here also trouble because /var was full all the time wen i use dnsbl. anyway to much problems.

                                          Edit: Wlan problems seem to be that pfsense local freeradius server can't be reached anymore.

                                          Sorry to hear that… Did you have DHCP registration enabled in the Resolver? There seems to be some underlying issues with that feature in the Resolver. DNSBL just does a Resolver reload to get its updates into the Resolver. Take a look at the resolver.log and the system.log to see what the error messages were... I added notes about this in the instructions posted in this thread.

                                          I do not have a lot of extra configuration in the Resolver for overrides and thats why I suggest you ask in the DNS forum as those guys live that stuff every day and can better reply to that particular issue...

                                          In regards to your issue with WLANs, make sure that those other LAN segments can see the DNSBL VIP or else DNSBL will not function. You can click the checkbox in the DNSBL tab to auto create a Floating firewall rule for that... But also make sure there are no other rules that can block access to the DNSBL VIP. Try to ping the DNSBL IP from thhe WLAN as a test...

                                          On another note: Seems someone recently gave a negative smite….  ???

                                          "Experience is something you don't get until just after you need it."

                                          Website: http://pfBlockerNG.com
                                          Twitter: @BBcan177  #pfBlockerNG
                                          Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                                          1 Reply Last reply Reply Quote 0
                                          • BBcan177B
                                            BBcan177 Moderator
                                            last edited by

                                            @Jamerson:

                                            thank you so much for your answer,
                                            the check list is already enabled ,
                                            I've checked the as show but can't seem the find the location on the code to add the red line
                                            below is what it shows on the dnsbl.sh file

                                            Jamerson,  sorry about that… you can disregard those instructions... The key point here is that these lines in the dnsbl.sh file (in red) file are correct...

                                            if [ -f '[color=red]/var/unbound/pfb_dnsbl_lighty.conf' ]; then
                                                  /usr/local/sbin/lighttpd_pfb -f '/var/unbound/pfb_dnsbl_lighty.conf'
                                            fi

                                            I sent you a PM to see if we can work out this issue offline, and I can go from there… Thanks!

                                            "Experience is something you don't get until just after you need it."

                                            Website: http://pfBlockerNG.com
                                            Twitter: @BBcan177  #pfBlockerNG
                                            Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.