aboutsummaryrefslogtreecommitdiffstats
path: root/config/ntopng/ntopng.xml
diff options
context:
space:
mode:
Diffstat (limited to 'config/ntopng/ntopng.xml')
-rw-r--r--config/ntopng/ntopng.xml28
1 files changed, 24 insertions, 4 deletions
diff --git a/config/ntopng/ntopng.xml b/config/ntopng/ntopng.xml
index 778881e8..055f54c0 100644
--- a/config/ntopng/ntopng.xml
+++ b/config/ntopng/ntopng.xml
@@ -156,7 +156,15 @@
safe_mkdir("/var/db/ntopng/rrd/graphics", 0755, true);
system("/bin/chmod -R 755 /var/db/ntopng");
system("/usr/sbin/chown -R nobody:nobody /var/db/ntopng");
- system("/bin/cp -Rp /usr/local/lib/X11/fonts/webfonts/ /usr/local/lib/X11/fonts/TTF/");
+ $pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
+ if ($pf_version == "2.2") {
+ $fonts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/lib/X11/fonts";
+ } else if ($pf_version == "2.1") {
+ $fonts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/lib/X11/fonts";
+ } else {
+ $fonts_path = "/usr/local/lib/X11/fonts";
+ }
+ system("/bin/cp -Rp {$fonts_path}/webfonts/ {$fonts_path}/TTF/");
$first = 0;
foreach($ntopng_config['interface_array'] as $iface) {
$if = convert_friendly_interface_to_real_interface_name($iface);
@@ -246,12 +254,23 @@
config_unlock();
}
function ntopng_update_geoip() {
+ $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";
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version == "2.1" || $pf_version == "2.2") {
- mwexec("/usr/pbi/ntopng-" . php_uname("m") . "/bin/ntopng-geoipupdate.sh");
+ $output_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/share/ntopng";
} else {
- mwexec("/usr/local/bin/ntopng-geoipupdate.sh");
+ $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();
restart_service("ntopng");
}
@@ -268,7 +287,8 @@
foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) {
/* Decompress if needed. */
if (substr($geofile, -3, 3) == ".gz") {
- mwexec("/usr/bin/gzip -d " . escapeshellarg($geofile));
+ // keep -f here, otherwise the files will not get updated
+ mwexec("/usr/bin/gzip -d -f " . escapeshellarg($geofile));
}
}