Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntopng config UI changes to allow arbitrary local networks list #366

Merged
merged 4 commits into from
Jul 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/pfSense-pkg-ntopng/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-ntopng
PORTVERSION= 0.8.8
PORTVERSION= 0.8.9
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
18 changes: 18 additions & 0 deletions net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ function ntopng_sync_package() {
$local_networks = "--local-networks " . escapeshellarg(gen_subnet(get_interface_ip('lan'), get_interface_subnet('lan')) . '/' . get_interface_subnet('lan'));
}
break;
case "custom":
$nets = array();
foreach ($ntopng_config['row'] as $net) {
if (is_subnet($net['cidr'])) {
$nets[] = trim($net['cidr']);
}
}
if (!empty($nets)) {
$local_networks = "--local-networks " . escapeshellarg(implode(",", $nets));
}
break;
case "rfc1918":
default:
$local_networks = "--local-networks '192.168.0.0/16,172.16.0.0/12,10.0.0.0/8'";
Expand Down Expand Up @@ -323,6 +334,13 @@ function ntopng_validate_input($post, &$input_errors) {
if ($post['redis_password'] != $post['redis_passwordagain']) {
$input_errors[] = "The provided passwords did not match.";
}
$idx = 0;
while (isset($_POST["cidr{$idx}"])) {
$cidr = $_POST["cidr" . $idx++];
if (!is_subnet($cidr)) {
$input_errors[] = "Invalid CIDR in custom local networks list at position {$idx}.";
}
}
if ($post['Submit'] == "Update GeoIP Data") {
ntopng_update_geoip();
}
Expand Down
55 changes: 38 additions & 17 deletions net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,17 @@
</options>
</field>
<field>
<fielddescr>GeoIP Data</fielddescr>
<description>
<![CDATA[
Additionally, GeoIP Data can provide location information about IP addresses.
<div class="infoblock blockopen">
This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">http://www.maxmind.com</a><br /></div><br />
<button class="btn btn-success btn-sm" name='Submit' id='update_geoip' type='submit' value='Update GeoIP Data'><i class="fa fa-refresh icon-embed-btn"></i>Update GeoIP Data</button>
]]>
</description>
<type>info</type>
<fielddescr>Disable Alerts</fielddescr>
<fieldname>disable_alerts</fieldname>
<description>Disables all alerts generated by ntopng, such as flooding notifications.</description>
<type>checkbox</type>
</field>
<field>
<fielddescr>Local Networks</fielddescr>
<name>Local Networks</name>
<type>listtopic</type>
</field>
<field>
<fielddescr>Mode</fielddescr>
<fieldname>local_networks</fieldname>
<description>
<![CDATA[
Expand All @@ -146,8 +144,21 @@
<option><value>rfc1918</value><name>Consider all RFC1918 networks local</name></option>
<option><value>selected</value><name>Consider selected interface networks local</name></option>
<option><value>lanonly</value><name>Consider only LAN interface local</name></option>
<option><value>custom</value><name>Use custom list below</name></option>
</options>
</field>
<field>
<fielddescr>Custom networks list</fielddescr>
<fieldname>none</fieldname>
<type>rowhelper</type>
<rowhelper>
<rowhelperfield>
<fielddescr>CIDR</fielddescr>
<fieldname>cidr</fieldname>
<type>input</type>
</rowhelperfield>
</rowhelper>
</field>
<!-- Hide nonfunctional stuff pending rework - see https://redmine.pfsense.org/issues/7000 -->
<!--
<field>
Expand All @@ -167,6 +178,22 @@
<type>checkbox</type>
</field>
-->
<field>
<name>Utilities</name>
<type>listtopic</type>
</field>
<field>
<fielddescr>GeoIP Data</fielddescr>
<description>
<![CDATA[
Additionally, GeoIP Data can provide location information about IP addresses.
<div class="infoblock blockopen">
This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">http://www.maxmind.com</a><br /></div><br />
<button class="btn btn-success btn-sm" name='Submit' id='update_geoip' type='submit' value='Update GeoIP Data'><i class="fa fa-refresh icon-embed-btn"></i>Update GeoIP Data</button>
]]>
</description>
<type>info</type>
</field>
<field>
<fielddescr>Delete ntopng Data</fielddescr>
<description>
Expand All @@ -178,12 +205,6 @@
</description>
<type>info</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_resync_config_command>
ntopng_sync_package();
Expand Down