Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # /usr/local/pkg/ntopng.inc
- function ntopng_update_geoip() {
- global $config;
- $curlcmd = "/usr/local/bin/curl";
- $geolite_city = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=CHANGE_ME&suffix=tar.gz";
- $geoip_asnum = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=CHANGE_ME&suffix=tar.gz";
- $output_dir_city = "/usr/local/share/ntopng/GeoCity.tar.gz";
- $output_dir_asn = "/usr/local/share/ntopng/GeoASN.tar.gz";
- mwexec("{$curlcmd} --output {$output_dir_city} \"{$geolite_city}\"");
- mwexec("{$curlcmd} --output {$output_dir_asn} \"{$geoip_asnum}\"");
- ntopng_fixup_geoip();
- /* Do not (re)start services on package (re)install, only on manual GeoIP updates via the GUI */
- if ($_POST['Submit'] == "Update GeoIP Data") {
- init_config_arr(array('installedpackages', 'ntopng', 'config', 0));
- $ntopng_config = $config['installedpackages']['ntopng']['config'][0];
- ntopng_services_stop();
- if ($ntopng_config['enable'] == "on") {
- start_service("ntopng");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement