Advertisement
Guest User

Ntopng GeoIP fix

a guest
Apr 7th, 2020
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. # /usr/local/pkg/ntopng.inc
  2. function ntopng_update_geoip() {
  3. global $config;
  4. $curlcmd = "/usr/local/bin/curl";
  5. $geolite_city = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=CHANGE_ME&suffix=tar.gz";
  6. $geoip_asnum = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=CHANGE_ME&suffix=tar.gz";
  7.  
  8. $output_dir_city = "/usr/local/share/ntopng/GeoCity.tar.gz";
  9. $output_dir_asn = "/usr/local/share/ntopng/GeoASN.tar.gz";
  10.  
  11. mwexec("{$curlcmd} --output {$output_dir_city} \"{$geolite_city}\"");
  12. mwexec("{$curlcmd} --output {$output_dir_asn} \"{$geoip_asnum}\"");
  13. ntopng_fixup_geoip();
  14.  
  15. /* Do not (re)start services on package (re)install, only on manual GeoIP updates via the GUI */
  16. if ($_POST['Submit'] == "Update GeoIP Data") {
  17. init_config_arr(array('installedpackages', 'ntopng', 'config', 0));
  18. $ntopng_config = $config['installedpackages']['ntopng']['config'][0];
  19. ntopng_services_stop();
  20. if ($ntopng_config['enable'] == "on") {
  21. start_service("ntopng");
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement