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

    Null blocking SERVFAIL

    pfBlockerNG
    3
    18
    900
    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.
    • T
      tibere86
      last edited by

      I have experienced the same thing when running pfBlockerNG with IPv6 DNSBL enabled along with null blocking. What I believe is occurring is that IPv4 sourced requests are null blocked (0.0.0.0 (A) /:: (AAAA)) properly, but IPv6 sourced requests are sent to the DNSBL webserver which then returns SERVFAIL due to cert issue. I posted recently (past month) in the Reddit pfBlockerNG thread about this issue, but have not received a response.

      GertjanG 1 Reply Last reply Reply Quote 1
      • GertjanG
        Gertjan @tibere86
        last edited by

        @tibere86 said in Null blocking SERVFAIL:

        but IPv6 sourced requests are sent to the DNSBL webserver which then returns SERVFAIL

        If a LAN device, a browser wants to visit www.google.com, it will do a DNS lookup first.
        Let's imagine IPv6 and IPv4 is avaible for IP traffic : your pfSense, and your ISP, is full dual stack = can route IPv4 and IPv6.
        Your browser, probably the DNS forwarder in your device, will send the request to the default DNS.
        This can be over IPv4 or IPv6.
        It will ask for an A and an AAAA record if IPv6 is available. It's normal to see your device asking for an AAAA record even when there is no IPv6 gateway (so the AAAA answer can't be used - don't ask me why ^^)

        If "www.google.com" was listed in a DNSBL 'v4', then 10.10.10.1 or 0.0.0.0 will be return by pfBlockerng.
        If "www.google.com" was listed in a DNSBL 'v6', then ::10.10.10.1 or :: will be return by pfBlockerng.
        In both cases, it will be this local IP (10.10.10.1 or 0.0.0.0 or the IPv6 counterpart), or the resolved A = IPv4 or AAA = IPv6 - but not SERVFAIL, as this means there was an error somewhere, like the resolver (unbound) couldn't resolve the DNS request.
        reasons could be : Uplink (WAN) down or unbound wasn't running ...

        @tibere86 said in Null blocking SERVFAIL:

        DNSBL webserver

        If you fully understood what https is, you wouldn't use the "DNSBL webserver" or 10.10.10.1
        This DNSBL webserver was nice to have when everything was http (http can redirected).
        https can not be redirect.

        So : use :

        b8676603-ce6d-4987-8f55-21005a6823bf-image.png

        and call it a day.

        If this (example) would show up :
        123f70c1-d050-4088-bd9e-ca9fddcb0326-image.png

        the browser was authorized to show insecure pages.
        That is, TLS was till used, but the browser was asking for this cert :

        a96fd240-ca4f-4c2c-b25d-170275ad93ef-image.png

        or it got back :

        e8abb0b7-ae9e-4865-8c82-6e1b9055d38c-image.png

        Normally, a browser shouldn't show anything - or just this :

        ead6d4ec-c536-4616-99bf-27b794a1f42c-image.png

        as everybody knows an important security issue happened. They will bail out. They will be safe.

        if a web page was showing up, like this one :

        d8ff7356-fa5a-4272-beb4-1b3a71f9b45c-image.png

        then their browser was accepting https redirection.
        That's a major security risk (for this user, his device, your network ...).

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        T 1 Reply Last reply Reply Quote 0
        • T
          tibere86 @Gertjan
          last edited by

          @Gertjan Thanks for the reply and information. Can you confirm that even with NULL BLOCK enabled, DNSBL v6 returns :: for sites on block list?
          This is not what's occuring for me. When I have NULL BLOCK enabled, DNSBL v6 returns SERVFAIL instead of ::

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan @tibere86
            last edited by

            @tibere86 said in Null blocking SERVFAIL:

            When I have NULL BLOCK enabled, DNSBL v6 returns SERVFAIL instead of ::

            Hummmm.

            I just tested with "006.freecounters.co.uk" which is part of DNSBL_ADs_Basic.

            When I test with

            ca23059c-ccd3-441a-9434-b918db763d10-image.png
            I saw also a "ServFail".

            Then I started to "play" with the python script ... and now I see :
            (adding logs lines on what I think are interesting places ), like on line 1614:

                                log_info("{} Blocked {} Returned IP {} {}".format(q_name, b_ip, q_type_str, q_type))
            

            I saw :

            <30>1 2025-01-29T17:56:09.484605+01:00 pfSense.hf.tld unbound 13346 - - [13346:0] info: 006.freecounters.co.uk Blocked :: AAAA 28
            

            98421505-6341-4765-9a80-f261744be26f-image.png

            ... But then humm again.
            If unbound return "::" then what can the browser do with this ?
            It should be the, to be useful, an IPv6 GUA of pfSense .....
            And &@/{#, as I'm in null blocking mode ...
            Done. back to Web server mode.

            Now I see :

            info: 006.freecounters.co.uk Blocked ::10.10.10.1 Returned IP AAAA 28
            

            But https://[::10.10.10.1]:443 doesn't really work.

            Also : https://serverfault.com/questions/698369/what-is-the-ipv6-equivalent-of-0-0-0-0-0

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 0
            • F
              fenichelar
              last edited by

              Okay, so I have made some progress diagnosing the bug. The issue is occurring here:

              msg = DNSMessage(qstate.qinfo.qname_str, q_type, RR_CLASS_IN, PKT_QR | PKT_RA)
              msg.answer.append("{}. 60 IN {} {}" .format(q_name, q_type_str, b_ip))
              
              msg.set_return_msg(qstate)
              if msg is None or not msg.set_return_msg(qstate):
                  qstate.ext_state[id] = MODULE_ERROR
                  return True
              

              https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfb_unbound.py#L1617-L1623

              Specifically, there is a mismatch between q_type_str and b_ip.

              If the first DNS lookup is for type A, then b_ip will be 0.0.0.0. If an AAAA lookup then comes in, b_ip is still 0.0.0.0, which is wrong.

              If the first DNS lookup is for type AAAA, then b_ip will be ::. If an A lookup then comes in, b_ip is still ::, which is wrong.

              This is why the issue is inconsistent and restarting Unbound seems to resolve it.

              More detail to come.

              1 Reply Last reply Reply Quote 1
              • F
                fenichelar
                last edited by fenichelar

                I haven't thoroughly tested yet, but here is my first pass at a fix:
                https://github.com/pfsense/FreeBSD-ports/pull/1407/files.

                • Instead of saving the answer in the previously blocked domain details dictionary, a boolean for null blocking is saved. Then based on the query type, the appropriate answer is returned.
                • I also fixed an issue where SERVFAIL was being returned because the answer (an IP address) was not valid for the query type. An answer is now only included for A, AAAA, or ANY queries.
                • In addition, instead of ANY queries defaulting to A, they now default to both A and AAAA.
                • Lastly, I increased the TTL from 60 (1 minute) to 3600 (1 hour) to reduce DNS load.
                GertjanG 1 Reply Last reply Reply Quote 1
                • GertjanG
                  Gertjan @fenichelar
                  last edited by

                  @fenichelar

                  I copied pasted your diff, and will test it for a while.

                  @fenichelar said in Null blocking SERVFAIL:

                  Lastly, I increased the TTL from 60 (1 minute) to 3600 (1 hour) to reduce DNS load.

                  If I get it right, this is where the DNS reply "here is a 0.0.0.0 for you" created for the requesting device, if the host name was found in a blocking list (or regex, etc).
                  Instead of having the client device retry again one minute later as the TTL was low (60) - and if the client device respected the delay (now 3600), then yeah, way less DNS requesting should happen.
                  That is, if the client accepts 'NO' or 0.0.0.0 as an answer, and it respects the TTL delay.

                  No "help me" PM's please. Use the forum, the community will thank you.
                  Edit : and where are the logs ??

                  F 1 Reply Last reply Reply Quote 0
                  • F
                    fenichelar @Gertjan
                    last edited by

                    @Gertjan Exactly, the intention is to increase the amount of time that the client caches the block response; either null blocking ("0.0.0.0" / "::") or webserver blocking.

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @fenichelar
                      last edited by

                      @fenichelar

                      I've this - shows what my pfSense unbound is doing. Lets see what changes. I'm in now for 12 hours.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      F 1 Reply Last reply Reply Quote 0
                      • F
                        fenichelar @Gertjan
                        last edited by

                        I have been running this since I submitted the PR. I am using null blocking with no logging. No issues. @Gertjan are you using null blocking? What about logging?

                        GertjanG 1 Reply Last reply Reply Quote 0
                        • GertjanG
                          Gertjan @fenichelar
                          last edited by

                          @fenichelar
                          Don't ask me 😊
                          Ask my visual logs, look for yourself: day stats, weeks stats, month stats and year stats.

                          Since I applied the patch published above, for a week now, the servfail return code (purple ?) vanished, nearly not there anymore.

                          And of course I Null-log (default answer 0.0.0.0) everything, as the DNSBL-Webserver-log (default answer 10.10.10.1) is totally useless.
                          After all : who uses http these ? There are no public sites anymore that use http. Browsers don't want to use http anymore. http is by nature non secured. http is a thing of the past. And pfBlockerng can't redirect https to DNSBL-Webserver-log (the server page) as it can't, by law, redirect https.

                          No "help me" PM's please. Use the forum, the community will thank you.
                          Edit : and where are the logs ??

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            fenichelar @Gertjan
                            last edited by

                            @Gertjan So just to confirm, you have null blocking with logging?

                            There are 3 configurations:

                            1. Null blocking without logging
                            2. Null blocking with logging
                            3. Web server

                            I agreed, web server is not a good idea, but it is an option that should work. I have tested configuration #1. It sounds like you have tested #2 if I understood correctly. While I am fairly confident the patch will work for #3, I haven't actually tested it yet; so I will work on it over the next few days.

                            GertjanG 1 Reply Last reply Reply Quote 0
                            • GertjanG
                              Gertjan @fenichelar
                              last edited by

                              @fenichelar said in Null blocking SERVFAIL:

                              So just to confirm, you have null blocking with logging?

                              well .. you got me there.
                              I did use, since yesterday 11/02, switch my two DNSBL feeds to :

                              5c7ae6be-e1c5-45f8-af95-0b3a3aa2acb8-image.png

                              as I wanted to test with these settings for a while. And of course forgot about it already.
                              Btw : I didn't saw the pfBlockerng Blocked DNSBL page.
                              I nearly never visit web sites that are loaded with adds and stuff like that. So, pfBlockerng has nothing to do if it was just. I'm also sharing my connection with an entire hotel, loaded with clients (they are the real testers ^^) . Dono what they do, what they saw. If things went bad, they would have come to the reception to complain about the free service ^^
                              I know they do, as they also yell that there is nothing worth watching on the TV in their room (the 30 or so national channels - it's all publicity 24/24h and I don't block that (yet)).

                              I'm back at :

                              7dc95f9a-79d6-4a6c-9b62-7598cd9c01c9-image.png

                              @fenichelar said in Null blocking SERVFAIL:

                              but it is an option that should work

                              It does.
                              It woks well for we browser requests that are made with "http".
                              It can't - and you don't want to - work for https requests.
                              Added to what I've said above : let's do the test, and I propose this fact check method :
                              a new LAN pass rule :

                              85dd531f-1830-49ad-8e04-5049d72ca15d-image.png

                              Now I can see over time how often port 80 is used.
                              I'm curious ....

                              If most web server requests are https, which presume, then the "DNSBL-Webserver-log" can't work. It won't show up. At best, an browser error page shows up : as the "DNSBL-Webserver-log" certificate wasn't the one that the browser was waiting for.
                              Nothing is broken, imho, all is by design ^^ TLS (=https) behavior can't be patched easily.

                              No "help me" PM's please. Use the forum, the community will thank you.
                              Edit : and where are the logs ??

                              1 Reply Last reply Reply Quote 0
                              • GertjanG Gertjan referenced this topic on
                              • First post
                                Last post
                              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.