From fc2f34fb393e323a13aee0a3761cedba663dbe92 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Tue, 6 Jun 2017 16:48:58 +0200 Subject: [PATCH 1/4] Add option to provide a custom networks list for option --local-networks. --- .../files/usr/local/pkg/ntopng.inc | 18 ++++++++++++++++++ .../files/usr/local/pkg/ntopng.xml | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc index 1c591abdae69..4b5ba0b590a7 100644 --- a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc +++ b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc @@ -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[] = $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'"; @@ -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(); } diff --git a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.xml b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.xml index 05d179ba7a4d..f705034872b7 100644 --- a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.xml +++ b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.xml @@ -146,8 +146,21 @@ + + + Custom Local Networks list + none + rowhelper + + + CIDR + cidr + input + + + + + Utilities + listtopic + + + GeoIP Data + + + This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com

+ + ]]> +
+ info +
Delete ntopng Data @@ -191,12 +205,6 @@ info - - Disable Alerts - disable_alerts - Disables all alerts generated by ntopng, such as flooding notifications. - checkbox - ntopng_sync_package(); From 04314552a42ac5ea134325b88c569938d09bb117 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Sun, 11 Jun 2017 12:18:27 +0200 Subject: [PATCH 3/4] Trim user input to avoid spurious whitespace. --- net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc index 4b5ba0b590a7..1418025e71d8 100644 --- a/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc +++ b/net/pfSense-pkg-ntopng/files/usr/local/pkg/ntopng.inc @@ -125,7 +125,7 @@ function ntopng_sync_package() { $nets = array(); foreach ($ntopng_config['row'] as $net) { if (is_subnet($net['cidr'])) { - $nets[] = $net['cidr']; + $nets[] = trim($net['cidr']); } } if (!empty($nets)) { From f65a6347e995ef4e819c879ce16a6853bda79aee Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Mon, 3 Jul 2017 11:20:21 +0200 Subject: [PATCH 4/4] Bump PORTREVISION again. --- net/pfSense-pkg-ntopng/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/pfSense-pkg-ntopng/Makefile b/net/pfSense-pkg-ntopng/Makefile index e1e377116902..4ecbfc67fd94 100644 --- a/net/pfSense-pkg-ntopng/Makefile +++ b/net/pfSense-pkg-ntopng/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-ntopng -PORTVERSION= 0.8.8 +PORTVERSION= 0.8.9 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty