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.xml59
1 files changed, 53 insertions, 6 deletions
diff --git a/config/ntopng/ntopng.xml b/config/ntopng/ntopng.xml
index b656e483..9382912a 100644
--- a/config/ntopng/ntopng.xml
+++ b/config/ntopng/ntopng.xml
@@ -39,7 +39,7 @@
]]>
</copyright>
<name>ntopng</name>
- <version>1.1 v0.1</version>
+ <version>1.2 v0.5</version>
<title>Diagnostics: ntopng Settings</title>
<savetext>Change</savetext>
<aftersaveredirect>pkg_edit.php?xml=ntopng.xml</aftersaveredirect>
@@ -96,7 +96,12 @@
<field>
<fielddescr>DNS Mode</fielddescr>
<fieldname>dns_mode</fieldname>
- <description>Configures how name resolution is handled</description>
+ <description>
+ Configures how name resolution is handled&lt;br/&gt;&lt;br/&gt;
+ Additionally, GeoIP Data can provide location information about IP addresses.&lt;br/&gt;
+ This product includes GeoLite data created by MaxMind, available from &lt;a href=&quot;http://www.maxmind.com&quot;&gt;http://www.maxmind.com&lt;/a&gt;.&lt;br/&gt;
+ &lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Update GeoIP Data&quot;&gt;
+ </description>
<type>select</type>
<default_value>0</default_value>
<options>
@@ -121,13 +126,22 @@
<field>
<fielddescr>Historical Data Storage</fielddescr>
<fieldname>dump_flows</fieldname>
- <description>Turn historical data storages on</description>
+ <description>Enable historical data storage</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Disable Alerts</fielddescr>
+ <fieldname>disable_alerts</fieldname>
+ <description>Disables all alerts generated by ntopng, such as flooding notifications</description>
<type>checkbox</type>
</field>
</fields>
<custom_php_global_functions>
<![CDATA[
function sync_package_ntopng() {
+ if ($_POST['Submit'] == "Update GeoIP Data") {
+ return;
+ }
conf_mount_rw();
config_lock();
global $config;
@@ -185,7 +199,12 @@
if ($ntopng_config['dump_flows'] >= on) {
$dump_flows = "-F";
}
-
+
+ // Disable alerts
+ if ($ntopng_config['disable_alerts'] >= on) {
+ $disable_alerts = "-H";
+ }
+
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version >= 2.2) {
$redis_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/bin";
@@ -199,7 +218,7 @@
// Add support for --data-dir /somewhere, --httpdocs-dir /somewhereelse,
// --dump-timeline (on/off) --http-port, --https-port
- $start .= "\t/usr/local/bin/ntopng -d /var/db/ntopng -G /var/run/ntopng.pid -s -e {$dump_flows} {$ifaces} {$dns_mode} {$aggregations} {$local_networks} &";
+ $start .= "\t/usr/local/bin/ntopng -d /var/db/ntopng -G /var/run/ntopng.pid -s -e {$disable_alerts} {$dump_flows} {$ifaces} {$dns_mode} {$aggregations} {$local_networks} &";
write_rcfile(array(
"file" => "ntopng.sh",
"start" => $start,
@@ -211,6 +230,7 @@
// Wait for ntopng to shut down cleanly.
sleep(20);
}
+ ntopng_fixup_geoip();
start_service("ntopng");
sleep(2);
@@ -222,6 +242,30 @@
conf_mount_ro();
config_unlock();
}
+ function ntopng_update_geoip() {
+ mwexec("/usr/pbi/ntopng-" . php_uname("m") . "/bin/ntopng-geoipupdate.sh");
+ ntopng_fixup_geoip();
+ restart_service("ntopng");
+ }
+ function ntopng_fixup_geoip() {
+ $target_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/local/share/ntopng/httpdocs/geoip";
+ $source_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/share/ntopng";
+
+ foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) {
+ /* Decompress if needed. */
+ if (substr($geofile, -3, 3) == ".gz") {
+ mwexec("/usr/bin/gzip -d " . escapeshellarg($geofile));
+ }
+ }
+
+ /* Use a separate glob since the filenames could have changed since the last run */
+ foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) {
+ $target_file = $target_dir . '/' . basename($geofile);
+ if (!file_exists($target_file)) {
+ symlink($geofile, $target_file);
+ }
+ }
+ }
]]>
</custom_php_global_functions>
<custom_add_php_command>
@@ -232,7 +276,7 @@
</custom_php_resync_config_command>
<custom_php_install_command>
<![CDATA[
- mwexec_bg("/usr/pbi/ntopng-" . php_uname("m") . "/bin/geoipupdate.sh");
+ ntopng_update_geoip();
sync_package_ntopng();
]]>
</custom_php_install_command>
@@ -246,6 +290,9 @@
$input_errors[] = "You must provide (and confirm) ntopng's password.";
if ($_POST['password'] != $_POST['passwordagain'])
$input_errors[] = "The provided passwords did not match.";
+ if ($_POST['Submit'] == "Update GeoIP Data") {
+ ntopng_update_geoip();
+ }
}
]]>
</custom_php_validation_command>