git: f785779b1bb1 - main - net/ntopng: Fix GeoIP data download script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Jul 2023 09:46:53 UTC
The branch main has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=f785779b1bb16f8315be35d36ab57d17ed8e5560 commit f785779b1bb16f8315be35d36ab57d17ed8e5560 Author: Guido Falsi <madpilot@FreeBSD.org> AuthorDate: 2023-07-28 09:45:10 +0000 Commit: Guido Falsi <madpilot@FreeBSD.org> CommitDate: 2023-07-28 09:45:10 +0000 net/ntopng: Fix GeoIP data download script MaxMind now requires a free account with an API key to access its APIs to download the GeoLite2 datanases. Update scripts to adapt to new API interface and use API key provided via %%LOCALBASE%%/etc/GeoIP.conf Update pkg-message to provide this information. Reported by: thedoctorjtd <76110609+thedoctorjtd@users.noreply.github.com> Obtained from: https://github.com/freebsd/freebsd-ports/pull/182 --- net/ntopng/Makefile | 3 ++- net/ntopng/files/ntopng-geoip2update.sh.in | 7 +++++-- net/ntopng/{pkg-message => files/pkg-message.in} | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/net/ntopng/Makefile b/net/ntopng/Makefile index 64e825b29976..8d7ee91de32f 100644 --- a/net/ntopng/Makefile +++ b/net/ntopng/Makefile @@ -1,5 +1,6 @@ PORTNAME= ntopng PORTVERSION= 5.6.d20230531 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= net @@ -27,7 +28,7 @@ BUILD_DEPENDS= bash:shells/bash USES= autoreconf compiler:c++11-lang cpe gmake ldap libtool localbase \ lua:54 mysql pathfix pkgconfig shebangfix sqlite ssl -SUB_FILES= ntopng-geoip2update.sh pkg-deinstall +SUB_FILES= ntopng-geoip2update.sh pkg-deinstall pkg-message SHEBANG_FILES= httpdocs/misc/ntopng-add-user.sh \ httpdocs/misc/ntopng-utils-manage-config.in GNU_CONFIGURE= yes diff --git a/net/ntopng/files/ntopng-geoip2update.sh.in b/net/ntopng/files/ntopng-geoip2update.sh.in index 1b0302d67856..3d3404647abe 100644 --- a/net/ntopng/files/ntopng-geoip2update.sh.in +++ b/net/ntopng/files/ntopng-geoip2update.sh.in @@ -25,11 +25,14 @@ _fetchextract() { return 0 } +# Get the license key from the GeoIP.conf file +LICENSE_KEY=$(awk -F ' ' '/^#/ {next} $1=="LicenseKey" {print $2}' %%LOCALBASE%%/etc/GeoIP.conf) + echo Fetching GeoLite2-City -_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz' +_fetchextract "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${LICENSE_KEY}&suffix=tar.gz" echo Fetching GeoLite2-ASN -_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz' +_fetchextract "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" mv GeoLite2-*/*.mmdb %%DATADIR%%/httpdocs/geoip diff --git a/net/ntopng/pkg-message b/net/ntopng/files/pkg-message.in similarity index 83% rename from net/ntopng/pkg-message rename to net/ntopng/files/pkg-message.in index f3c46a612b40..02cc4fc9be53 100644 --- a/net/ntopng/pkg-message +++ b/net/ntopng/files/pkg-message.in @@ -10,7 +10,8 @@ remote one. ntopng supports IP geolocation, to enable this you should use the ntopng-geoip2update.sh script to update the maxminddb geolocation -data to the latest version. +data to the latest version. This script requires a maxmind.com +account API key configured in %%LOCALBASE%%/etc/GeoIP.conf to work. To pass a configuration file to ntopng, which overrides any command line arguments, add something like the following to rc.conf: