1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

- Update ntopng to latest upstream snapshot

- Enable again IP geolocation by using the maxminddb. Rename script
  which downloads the data to reflect the change
This commit is contained in:
Guido Falsi 2019-01-15 18:16:34 +00:00
parent 0f8fe3f5d0
commit 9d7e78cad2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=490396
7 changed files with 58 additions and 53 deletions

View File

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= ntopng
PORTVERSION= 3.8.d20181221
PORTREVISION= 2
PORTVERSION= 3.8.d20190111
PORTEPOCH= 1
CATEGORIES= net
@ -25,7 +24,7 @@ BUILD_DEPENDS= bash:shells/bash
USES= autoreconf compiler:c++11-lang cpe gmake libtool localbase \
mysql pathfix pkgconfig shebangfix sqlite ssl
SUB_FILES= pkg-deinstall
SUB_FILES= ntopng-geoip2update.sh pkg-deinstall
SHEBANG_FILES= httpdocs/misc/ntopng-add-user.sh \
httpdocs/misc/ntopng-utils-manage-config.in
GNU_CONFIGURE= yes
@ -37,11 +36,11 @@ PLIST_SUB= NTOPNGUSER="${USERS}" NTOPNGROUP="${GROUPS}"
USE_GITHUB= yes
GH_ACCOUNT= ntop
GH_TAGNAME= e7503c7
GH_TAGNAME= 3c2d3bf
CPE_VENDOR= ntop
OPTIONS_DEFINE= NLS
OPTIONS_DEFINE= NLS
OPTIONS_SUB= yes
@ -57,5 +56,6 @@ post-patch:
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/ntopng
${MKDIR} ${STAGEDIR}/var/db/ntopng
${INSTALL_SCRIPT} ${WRKDIR}/ntopng-geoip2update.sh ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1545486562
SHA256 (ntop-ntopng-3.8.d20181221-e7503c7_GH0.tar.gz) = 24513419f03079f6e1dbe2f8971094f8686443e73a0ae752c88fdbac41673c5d
SIZE (ntop-ntopng-3.8.d20181221-e7503c7_GH0.tar.gz) = 33912235
TIMESTAMP = 1547564923
SHA256 (ntop-ntopng-3.8.d20190111-3c2d3bf_GH0.tar.gz) = 1da7581a66fdd405574d0f914ed319c90d15c6e7886e14973c32ebc6ba0b35d1
SIZE (ntop-ntopng-3.8.d20190111-3c2d3bf_GH0.tar.gz) = 33912860

View File

@ -0,0 +1,44 @@
#!/bin/sh
set -eu
mkdir -p "%%DATADIR%%/httpdocs/geoip"
TEMPDIR="$(mktemp -d "%%DATADIR%%/httpdocs/geoip/MMDB-XXXXXX")"
trap 'rc=$? ; set +e ; rm -rf "'"$TEMPDIR"'" ; exit $rc' 0
cd "${TEMPDIR}"
# arguments:
# $1 URL
# $2 filename
_fetchextract() {
url="$1"
file="$(basename "${url}")"
if fetch "${url}"; then
tar xzf "${file}"
else
echo "${file} download failed"
return 1
fi
return 0
}
echo Fetching GeoLite2-City
_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'
echo Fetching GeoLite2-ASN
_fetchextract 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz'
mv GeoLite2-*/*.mmdb %%DATADIR%%/httpdocs/geoip
cd %%DATADIR%%/httpdocs/geoip
rm -rf "${TEMPDIR}"
chown root:wheel *.mmdb
chmod 444 *.mmdb
trap - 0
return 0

View File

@ -1,39 +0,0 @@
#!/bin/sh
set -eu
mkdir -p "%%DATADIR%%/httpdocs/geoip"
# arguments:
# $1 URL
# $2 output file name
_fetch() {
url="$1"
out="$2"
TEMPFILE="$(mktemp "%%DATADIR%%/httpdocs/geoip/GeoIP.dat-XXXXXX")"
trap 'rc=$? ; set +e ; rm -f "'"$TEMPFILE"'" ; exit $rc' 0
if fetch -o - "$url" | gunzip >> "$TEMPFILE" ; then
chmod 444 "$TEMPFILE"
if ! mv -f "$TEMPFILE" "%%DATADIR%%/httpdocs/geoip/$2" ; then
echo "Unable to replace %%DATADIR%%/httpdocs/geoip/$2"
return 2
fi
else
echo "$2 download failed"
return 1
fi
rm -f "$TEMPFILE"
trap - 0
return 0
}
echo Fetching GeoLiteCity.dat...
_fetch "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" GeoLiteCity.dat
echo Fetching GeoLiteCityv6.dat...
_fetch "http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz" GeoLiteCityv6.dat
echo Fetching GeoIPASNum.dat...
_fetch "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz" GeoIPASNum.dat.gz
echo Fetching GeoIPASNumv6.dat...
_fetch "http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz" GeoIPASNumv6.dat.gz

View File

@ -4,8 +4,6 @@
[ "$2" != "DEINSTALL" ] && exit 0
[ -f "%%DATADIR%%/httpdocs/geoip/GeoLiteCity.dat" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLiteCity.dat"
[ -f "%%DATADIR%%/httpdocs/geoip/GeoLiteCityv6.dat" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLiteCityv6.dat"
[ -f "%%DATADIR%%/httpdocs/geoip/GeoIPASNum.dat.gz" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoIPASNum.dat.gz"
[ -f "%%DATADIR%%/httpdocs/geoip/GeoIPASNumv6.dat.gz" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoIPASNumv6.dat.gz"
[ -f "%%DATADIR%%/httpdocs/geoip/GeoLite2-City.mmdb" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLite2-City.mmdb"
[ -f "%%DATADIR%%/httpdocs/geoip/GeoLite2-ASN.mmdb" ] && /bin/rm "%%DATADIR%%/httpdocs/geoip/GeoLite2-ASN.mmdb"
[ -d "%%DATADIR%%/httpdocs/geoip" ] && /usr/bin/find "%%DATADIR%%/httpdocs/geoip" -type d -empty -delete

View File

@ -8,8 +8,9 @@ ntopng requires to connect to a redis server to work. Please install redis
server from databases/redis or use -r option via ntopng_flags to specify a
remote one.
If you enabled GeoIP support(the default), please use ntopng-geoipupdate.sh
to update GeoIP database to the latest available data.
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.
To pass a configuration file to ntopng, which overrides any command
line arguments, add something like the following to rc.conf:

View File

@ -1,4 +1,5 @@
bin/ntopng
bin/ntopng-geoip2update.sh
man/man8/ntopng.8.gz
%%DATADIR%%/httpdocs/bootstrap/css/bootstrap-theme.css
%%DATADIR%%/httpdocs/bootstrap/css/bootstrap-theme.css.map