aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Falsi <madpilot@FreeBSD.org>2023-07-28 09:45:10 +0000
committerGuido Falsi <madpilot@FreeBSD.org>2023-07-28 09:45:10 +0000
commitf785779b1bb16f8315be35d36ab57d17ed8e5560 (patch)
tree3abc99ae11b05719b55a66df785f166d0ce14444
parent959ab8d38f30cb0e87e153bec93f1d000b3298c8 (diff)
downloadports-f785779b1bb16f8315be35d36ab57d17ed8e5560.tar.gz
ports-f785779b1bb16f8315be35d36ab57d17ed8e5560.zip
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
-rw-r--r--net/ntopng/Makefile3
-rw-r--r--net/ntopng/files/ntopng-geoip2update.sh.in7
-rw-r--r--net/ntopng/files/pkg-message.in (renamed from net/ntopng/pkg-message)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
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: