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

    GeoIP Showing Unk

    pfBlockerNG
    8
    12
    1.8k
    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.
    • L
      LordZohar
      last edited by

      Re: All alerts showing as unk country code.. help

      Hi all,

      I'm trying to set up pfBlockerNG to deny access to certain countries. Everything seems to be working (I can see alerts when things are blocked, firewall aliases and rules are created etc.) but the alerts show everything in the GeoIP column as "Unk":

      pfBlockerNG-Alert.png

      I've read through several other posts and tried various suggestions such as restarting the pfb_filter service after the first download of MaxMind and executing some php commands in the shell to force downloads/updates but nothing seems to be working. It's not a show-stopper for me as the rules are working as intended, but it would be nice to get to the bottom of it and see some proper data in the reports area, so I'd be grateful for any advice.

      Thanks in advance and keep up the excellent work on the product!

      LZ

      Bob.DigB J 2 Replies Last reply Reply Quote 0
      • Bob.DigB
        Bob.Dig LAYER 8 @LordZohar
        last edited by

        @lordzohar Do you have a working MaxMind License Key?

        L 1 Reply Last reply Reply Quote 0
        • L
          LordZohar @Bob.Dig
          last edited by

          @bob-dig Yes, MaxMind seems to have gone through OK and the logs show the database downloads OK.
          MaxMindConfig.png
          MaxMindDownload.png
          The key was generated for 3.1.1 or newer, but I can make and apply a new one if you think the license key is the problem?

          Bob.DigB M 2 Replies Last reply Reply Quote 0
          • Bob.DigB
            Bob.Dig LAYER 8 @LordZohar
            last edited by

            @lordzohar said in GeoIP Showing Unk:

            if you think the license key is the problem?

            No, it was only a wild guess on my side.

            1 Reply Last reply Reply Quote 0
            • M
              manu77 @LordZohar
              last edited by

              @lordzohar
              Hello
              I m also concerned on 2 different install but same version . I looked for a solution but without any success.
              Capture.JPG

              1 Reply Last reply Reply Quote 0
              • J
                jdeloach @LordZohar
                last edited by

                @lordzohar said in GeoIP Showing Unk:

                Re: All alerts showing as unk country code.. help

                Hi all,

                I'm trying to set up pfBlockerNG to deny access to certain countries. Everything seems to be working (I can see alerts when things are blocked, firewall aliases and rules are created etc.) but the alerts show everything in the GeoIP column as "Unk":

                I'm seeing this too. I'm using pfSense 2.6.0 and have noticed this behavior on several of the last versions of pfBlockerNG. I haven't said anything because it has not been that important to me, but it is an issue that folks that use GeoIP most likely would like to see fixed.

                I've also noticed that the date for MaxMind updates more frequently than it use to. It use to only update once a month, but now it updates several times a month. Don't know if that is an issue or not, just something different I've noticed.

                f0718958-a06b-4940-b3dc-fe1bf3b6c678-image.png

                S 1 Reply Last reply Reply Quote 0
                • S
                  serbus @jdeloach
                  last edited by

                  Hello!

                  Running PfB 3.1.0_9 on 22.05...

                  The code to update the GeoLite2-Country.mmdb file appears to be broken. This probably causes to the mmdblookup to fail and results in the Unk.

                  When the .mmdb file is missing (i.e. new install, nuked GeoIP files, etc...) , the update process will download a new GeoLite2-Country.tar.gz.
                  This download seems to work, but the code around lines 4103-4104 in pfblockerng.inc does not properly extract the mmdb file from the tar.gz.

                  exec("/usr/bin/tar -xzf {$file_dwn_esc} --strip=1 -C {$pfb['geoipshare']} >/dev/null 2>&1");
                  

                  Returns :

                  tar: Error opening archive: Failed to open '/usr/local/share/GeoIP/GeoLite2-Country.tar.gz.raw'
                  

                  Looks like it could be renaming and then trying to process the wrong file...?

                  Without the mmdb present, the update process will continually try to download and process the GeoLite2-Country.tar.gz file.

                  To fix, manually extract the mmdb file.

                  cd /usr/local/share/GeoIP
                  /usr/bin/tar -xzf GeoLite2-Country.tar.gz --strip=1
                  

                  This should get you by until the the first Tuesday of next month...

                  ...or the Unk could be from some other problem...

                  John

                  Lex parsimoniae

                  M J L BBcan177B 4 Replies Last reply Reply Quote 2
                  • M
                    michmoor LAYER 8 Rebel Alliance @serbus
                    last edited by

                    @serbus has the maintainer commented on this? Good find !
                    I would open a redmine

                    Firewall: NetGate,Palo Alto-VM,Juniper SRX
                    Routing: Juniper, Arista, Cisco
                    Switching: Juniper, Arista, Cisco
                    Wireless: Unifi, Aruba IAP
                    JNCIP,CCNP Enterprise

                    1 Reply Last reply Reply Quote 0
                    • J
                      johan333 @serbus
                      last edited by

                      @serbus Thank you for finding this as it resolved the issue for me as I can now see the country code in the GeoIP column under the Reports tab of pfBlockerNG. I did have to perform the command as root due to permissions, but it was successful. Cheers!

                      1 Reply Last reply Reply Quote 0
                      • J johan333 referenced this topic on
                      • Y yquirion referenced this topic on
                      • Y yquirion referenced this topic on
                      • R RabidSasquatch referenced this topic on
                      • L
                        LordZohar @serbus
                        last edited by

                        @serbus Sorry for the delay, I've been away over the holiday period. I checked my pfSense installation and the mmdb file already existed, so I renamed it and extracted it again as per the command in your post. After restarting the pfBlockerNG service I started to see country codes appearing in the alerts. I'm still getting the occasional UNK but I'm guessing this must be for some other reason - great find, thank you very much!

                        1 Reply Last reply Reply Quote 0
                        • M
                          manu77
                          last edited by

                          Hello all,

                          I m also confirming now is is OK. I didn't reload the Pfblockerng and country code were already here just after untaring!
                          A big thanks to Serbus !

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

                            @serbus said in GeoIP Showing Unk:

                            Thanks for the report. The problem is that $file_dwn_esc should be $file_download. Will get this fixed in the next version.

                            exec("/usr/bin/tar -xzf {$file_dwn_esc} --strip=1 -C {$pfb['geoipshare']} >/dev/null 2>&1");
                            

                            "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 2
                            • Y yorke referenced this topic on
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.