OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: andrema2 on June 04, 2020, 04:58:28 PM

Title: Geoip and Ntopng
Post by: andrema2 on June 04, 2020, 04:58:28 PM
Hi,

I'm having trouble to make geoip work. I didn't find geoip.conf file to add my key and also the geoipupdate seems to have not been installed.

I installed the version 4 and reverted to 20.1.3 to avoid the issues with the new version. I don't know if it screwed up something else.

Title: Re: Geoip and Ntopng
Post by: hushcoden on June 04, 2020, 08:14:30 PM
Quote from: andrema2 on June 04, 2020, 04:58:28 PM
I'm having trouble to make geoip work. I didn't find geoip.conf file to add my key and also the geoipupdate seems to have not been installed.

I think it's a problem with the latest version of OPNsense and/or ntopng... someone in this forum suggested the following manual steps:

1) Get the following files from MaxMind:

     GeoLite2-ASN.mmdb
     GeoLite2-Country.mmdb
     GeoLite2-City.mmdb

2) Copy those files to /usr/local/share/ntopng/httpdocs/geoip/


3) chmod +x /usr/local/opnsense/scripts/OPNsense/Ntopng/generate_certs.php
Title: Re: Geoip and Ntopng
Post by: mimugmail on June 05, 2020, 07:25:30 AM
Quote from: hushcoden on June 04, 2020, 08:14:30 PM

3) chmod +x /usr/local/opnsense/scripts/OPNsense/Ntopng/generate_certs.php

I dont know the solution, but this one can't be it.
Title: Re: Geoip and Ntopng
Post by: gpb on June 05, 2020, 09:18:54 PM
QuoteI dont know the solution, but this one can't be it.

That was part of the three step solution to enabling GeoIP in a youtube video which solved my problem months ago.  I can't say that chmod step does anything, but copying the files worked.

Ref:  https://youtu.be/MywgacMD_GI?t=178
Title: Re: Geoip and Ntopng
Post by: andrema2 on July 07, 2020, 03:06:32 PM
Hi

I reinstalled everything from the scratch with the 20.1.8_1 and the geoipupdate is not there.
My understanding is that it won't update the databases without it. I can copy the database and it will work with the version I copy but no updates.

Any permanent solution ?
Title: Re: Geoip and Ntopng
Post by: uglymotha on July 28, 2020, 10:29:25 AM
Attached an updated version of ntopng-geoip2update.sh
Replace the script currently in /usr/local/bin
Follow instructions on https://github.com/ntop/ntopng/blob/dev/doc/README.geolocation.md
Copy GeoIP.conf to /usr/local/etc (or any other location and specify it on command line)
Schedule script in cron

add to /usr/local/opnsense/service/conf/actions.d/actions_ntopng.conf to schedule from GUI
[update]
command:/usr/local/bin/ntopng-geoip2update.sh
parameters:
type:script
message:Updating ntopng GeoIP
description:Update ntopng GeoIP Database files
Title: Re: Geoip and Ntopng
Post by: mimugmail on July 28, 2020, 11:37:00 AM
Quote from: uglymotha on July 28, 2020, 10:29:25 AM
Attached an updated version of ntopng-geoip2update.sh
Replace the script currently in /usr/local/bin
Follow instructions on https://github.com/ntop/ntopng/blob/dev/doc/README.geolocation.md
Copy GeoIP.conf to /usr/local/etc (or any other location and specify it on command line)
Schedule script in cron

add to /usr/local/opnsense/service/conf/actions.d/actions_ntopng.conf to schedule from GUI
[update]
command:/usr/local/bin/ntopng-geoip2update.sh
parameters:
type:script
message:Updating ntopng GeoIP
description:Update ntopng GeoIP Database files

Shall we pack this in the plugin itself?
Title: Re: Geoip and Ntopng
Post by: uglymotha on July 28, 2020, 01:38:59 PM
Quote from: mimugmail on July 28, 2020, 11:37:00 AM
Shall we pack this in the plugin itself?

Sure, feel free to do so
Title: Re: Geoip and Ntopng
Post by: nxno on August 16, 2020, 05:38:54 PM
small hint, a newly generated GeoIP.conf from the maxmind website generate a version with an "EditionIDs" string but must be an "ProductIds". After the change everything works great, thanks for the updated script mimugmail.
Title: Re: Geoip and Ntopng
Post by: hushcoden on August 20, 2020, 10:05:28 PM
Maybe silly question, my licence key goes in the script, right ?
Title: Re: Geoip and Ntopng
Post by: marjohn56 on August 21, 2020, 06:04:33 PM
Not silly. I cannot see where you specify the conf file either, I downloaded the Maxmind files manually and it works nicely, would be good to get the script working though. Someone point me in the right direction?