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

    [SOLVED] Ntop GEO MAP

    Scheduled Pinned Locked Moved Traffic Monitoring
    49 Posts 17 Posters 15.9k 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.
    • manjotscM
      manjotsc @dragoangel
      last edited by

      @dragoangel no problem,

      Vendor: HP
      Version: P01 Ver. 02.50
      Release Date: Wed Jul 17 2024
      Boot Method: UEFI
      24.11-RELEASE (amd64)
      FreeBSD 15.0-CURRENT
      CPU Type: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
      Current: 3606 MHz, Max: 3400 MHz
      4 CPUs : 1 package(s) x 4 core(s)

      1 Reply Last reply Reply Quote 0
      • dragoangelD
        dragoangel
        last edited by dragoangel

        How-to fix:
        [UPDATED]:
        Get API key from MaxMind by register at https://www.maxmind.com/en/geolite2/signup
        After this - change CHANGE_ME from #5 in 2 links to your actual API key.

        1. Install System_Patches from Packages.
        2. Go to System => Patches
        3. Add new patch
        4. Give it Description, like: PFSENSE-9211 Fix GeoIP DB
        5. In Patch Contents copy-paste text:
        --- /usr/local/pkg/ntopng.inc
        +++ /usr/local/pkg/ntopng.inc
        @@ -241,16 +241,12 @@
         function ntopng_update_geoip() {
         	global $config;
         	$fetchcmd = "/usr/bin/fetch";
        -	$geolite_city = "https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz";
        -	$geolite_city_v6 = "https://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz";
        -	$geoip_asnum = "https://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz";
        -	$geoip_asnum_v6 = "https://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz";
        +	$geolite_city = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=CHANGE_ME&suffix=tar.gz";
        +	$geoip_asnum = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=CHANGE_ME&suffix=tar.gz";
         	$output_dir = "/usr/local/share/ntopng";
        -
        +	
         	mwexec("{$fetchcmd} -o {$output_dir} -T 5 {$geolite_city}");
        -	mwexec("{$fetchcmd} -o {$output_dir} -T 5 {$geolite_city_v6}");
         	mwexec("{$fetchcmd} -o {$output_dir} -T 5 {$geoip_asnum}");
        -	mwexec("{$fetchcmd} -o {$output_dir} -T 5 {$geoip_asnum_v6}");
         
         	ntopng_fixup_geoip();
         
        @@ -271,16 +267,15 @@
         
         	safe_mkdir($target_dir, 0755);
         
        -	foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) {
        +	foreach(glob("{$source_dir}/Geo*.tar.gz") as $geofile) {
         		/* Decompress if needed. */
        -		if (substr($geofile, -3, 3) == ".gz") {
        -			// keep -f here, otherwise the files will not get updated
        -			mwexec("/usr/bin/gzip -d -f " . escapeshellarg($geofile));
        +		if (substr($geofile, -7, 7) == ".tar.gz") {			
        +			mwexec("tar -C {$source_dir} -f {$geofile} --strip 1 -xz '*.mmdb'");
         		}
         	}
         
         	/* Use a separate glob since the filenames could have changed since the last run */
        -	foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) {
        +	foreach(glob("{$source_dir}/Geo*.mmdb") as $geofile) {
         		$target_file = $target_dir . '/' . basename($geofile);
         		if (!file_exists($target_file)) {
         			symlink($geofile, $target_file);
        
        
        1. Set Path Strip Count to 0
        2. Save it and Click Test
        3. If test done successfully - Apply button will appear.
        4. Apply patch
        5. Go to Status = >Services and Stop Ntop NG
        6. Got to Diagnostics => ntopng Settings and Remove checkbox from Enable ntopng
        7. Go to bottom of ntopng Settings and Update GeoIP Data
        8. Enable ntopng and Save - You will receive error, ignore it.
        9. Go to Status = >Services and Start Ntop NG

        P.S. Revert patch can be done from same way Test -> Revert at System Patches

        Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
        Unifi AP-AC-LR with EAP RADIUS, US-24

        gnitingG 1 Reply Last reply Reply Quote 4
        • G
          gogglespisano
          last edited by

          I had to set the Path Strip Count to 1.

          That will ignore the a/ and b/ path prefixes.

          --- a/usr/local/pkg/ntopng.inc
          +++ b/usr/local/pkg/ntopng.inc

          dragoangelD 1 Reply Last reply Reply Quote 0
          • G
            gogglespisano
            last edited by

            Line 203: function exec_bg undefined

            1 Reply Last reply Reply Quote 0
            • dragoangelD
              dragoangel @gogglespisano
              last edited by dragoangel

              @gogglespisano updated How-to, in your case try reinstall package from scratch and then apply fix

              Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
              Unifi AP-AC-LR with EAP RADIUS, US-24

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

                @dragoangel Reinstalling and re-applying worked. Thanks for the Patch!

                1 Reply Last reply Reply Quote 0
                • R
                  recue @manjotsc
                  last edited by

                  @manjotsc Finally, Thank you

                  1 Reply Last reply Reply Quote 0
                  • N
                    navjot @manjotsc
                    last edited by

                    @manjotsc it's been a while I was screwing my head with this thanksss

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

                      Omg This was awesomeee.

                      Also, my plex server is getting flows categorized as unknown application. Is there a way to create my category for Plex?

                      There's some automated ones like netflix and that kind of stuff.

                      R 1 Reply Last reply Reply Quote 0
                      • A
                        amarcino
                        last edited by

                        Thanks very much for this fix.

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

                          Thanks a lot @dragoangel

                          1 Reply Last reply Reply Quote 0
                          • H
                            Hans from Berlin
                            last edited by

                            Thank you very much dragoangel!

                            1 Reply Last reply Reply Quote 0
                            • R
                              robvanhooren @gacpac
                              last edited by robvanhooren

                              @gacpac said in [SOLVED] Ntop GEO MAP:

                              Omg This was awesomeee.

                              Also, my plex server is getting flows categorized as unknown application. Is there a way to create my category for Plex?

                              There's some automated ones like netflix and that kind of stuff.

                              yes.

                              plex should actually be recognized by ntopng (as of v3.9) but the pfS pkg is 3.8 at the moment.

                              for now you have to do custom protocols by hand.

                              see redmine #9912 for a bit of a howto.

                              (that will get the protocols 'known'; afterwards, you can set them to an appropriate category in the ntop gui).

                              G 1 Reply Last reply Reply Quote 0
                              • G
                                gacpac @robvanhooren
                                last edited by

                                @robvanhooren sorry but redmine #9912 where?

                                1 Reply Last reply Reply Quote 0
                                • R
                                  robvanhooren
                                  last edited by

                                  the bugtracker is in the pfSense menu (top right corner of the GUI)

                                  it opens the redmine site

                                  or, you can go directly to request #9912 here

                                  hope that helps?

                                  R.

                                  1 Reply Last reply Reply Quote 0
                                  • gnitingG
                                    gniting @dragoangel
                                    last edited by gniting

                                    @dragoangel After applying this patch, I am seeing a flood of msgs in the system log with the following text:
                                    As of two days ago, I am seeing a ton of entries in the system log with the following msg:

                                    Attack from "192.168.7.1" on service 100 with danger 10.
                                    Did not receive identification string from 192.168.7.1 port 3736
                                    

                                    192.168.7.1 the IP of the pfsense box itself. If I turn off ntopng, the msgs go away. Any ideas?

                                    dragoangelD 1 Reply Last reply Reply Quote 0
                                    • dragoangelD
                                      dragoangel @gniting
                                      last edited by dragoangel

                                      @ibbetsion this logs not related to patch. They logged without it too if you enable ntopng and do not configure it. Disable alerts in ntopng itself, and please look to all setting).

                                      Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
                                      Unifi AP-AC-LR with EAP RADIUS, US-24

                                      1 Reply Last reply Reply Quote 0
                                      • dragoangelD
                                        dragoangel
                                        last edited by dragoangel

                                        This now broken again due MaxMind require LicenseKeys usage now https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/

                                        Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
                                        Unifi AP-AC-LR with EAP RADIUS, US-24

                                        manjotscM 2 Replies Last reply Reply Quote 0
                                        • manjotscM
                                          manjotsc @dragoangel
                                          last edited by manjotsc

                                          @dragoangel

                                          alt text

                                          Vendor: HP
                                          Version: P01 Ver. 02.50
                                          Release Date: Wed Jul 17 2024
                                          Boot Method: UEFI
                                          24.11-RELEASE (amd64)
                                          FreeBSD 15.0-CURRENT
                                          CPU Type: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
                                          Current: 3606 MHz, Max: 3400 MHz
                                          4 CPUs : 1 package(s) x 4 core(s)

                                          1 Reply Last reply Reply Quote 0
                                          • manjotscM
                                            manjotsc @dragoangel
                                            last edited by manjotsc

                                            @dragoangel As temporary solution I uploaded latest files on web server, and It seems to be working fine again.

                                            ntopng.inc.txt

                                            Vendor: HP
                                            Version: P01 Ver. 02.50
                                            Release Date: Wed Jul 17 2024
                                            Boot Method: UEFI
                                            24.11-RELEASE (amd64)
                                            FreeBSD 15.0-CURRENT
                                            CPU Type: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
                                            Current: 3606 MHz, Max: 3400 MHz
                                            4 CPUs : 1 package(s) x 4 core(s)

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