From 12a4ff878a41e407aa1a446fb5b6a757c6207706 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 15 Nov 2015 22:46:44 +0100 Subject: pfflowd - add privileges configuration, fixes and cleanups - Add privileges configuration - Add Enable checkbox instead of using the foreach() hack - Validate Source IP as well --- config/pfflowd/pfflowd.xml | 149 +++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 80 deletions(-) diff --git a/config/pfflowd/pfflowd.xml b/config/pfflowd/pfflowd.xml index 44294d69..25a68a2c 100644 --- a/config/pfflowd/pfflowd.xml +++ b/config/pfflowd/pfflowd.xml @@ -42,138 +42,130 @@ ]]> pfflowd - 1.0.3 - pfflowd: Settings - pkg_edit.php?xml=pfflowd.xml&id=0 + 1.0.4 + Services: pfflowd Settings + pkg_edit.php?xml=pfflowd.xml pfflowd Modify pfflowd settings.
Services
pfflowd.xml - /pkg_edit.php?xml=pfflowd.xml&id=0 + /pkg_edit.php?xml=pfflowd.xml
pfflowd pfflowd.sh pfflowd + Netflow Export Daemon installedpackages->package->$packagename->configuration->settings + + /etc/inc/priv/ + https://packages.pfsense.org/packages/config/pfflowd/pfflowd.priv.inc + - Host + Enable pfflowd + enabled + Check this to enable pfflowd daemon. + checkbox + + + Destination Host host - Specify the host that datagrams are to be sent to. + Specify the IP address of the host that datagrams are to be sent to. input + - Port + Destination Port port Enter the port that datagrams are to be sent to. input + - Source Hostname/IP + Source IP sourcehost - Specify the hostname or IP address that datagrams are to be sent from. The hostname/IP must be local to this system. + + The IP must be local to this system. + ]]> + input - pf rule direction restriction + pf Rule Direction Restriction direction Restrict creation of flow records to states matching a certain direction (in, out, or any). select - - - + + + - Netflow version + Netflow Version version Select which version of the NetFlow protocol to use. select - - - + + + "pfflowd.sh", - "start" => $start, - "stop" => "/usr/bin/killall pfflowd" - ) - ); + conf_mount_rw(); + if (is_array($config['installedpackages']['pfflowd']['config'])) { + $cf = $config['installedpackages']['pfflowd']['config'][0]; + } else { + $cf = array(); + } + if ($cf['enabled'] == "on") { + $start = "\n/sbin/ifconfig pfsync0 up\n"; + $start .= "/usr/local/sbin/pfflowd "; + $start .= " -n {$cf['host']}"; + $start .= ":{$cf['port']}"; + if (!empty($cf['sourcehost'])) { + $start .= " -s {$cf['sourcehost']} "; + } + if ($cf['direction'] != "") { + $start .= " -S {$cf['direction']}"; + } + if ($cf['version'] != "") { + $start .= " -v {$cf['version']}"; + } + write_rcfile(array("file" => "pfflowd.sh", "start" => $start, "stop" => "/usr/bin/killall pfflowd")); + if (is_service_running("pfflowd")) { restart_service("pfflowd"); - break; + } else { + start_service("pfflowd"); + } + } else { + if (is_service_running("pfflowd")) { + stop_service("pfflowd"); } + unlink_if_exists("/usr/local/etc/rc.d/pfflowd.sh"); } conf_mount_ro(); } function validate_form_pfflowd($post, &$input_errors) { - if (($post['host'] == "") || !is_ipaddr($post['host'])) { - $input_errors[] = 'You must specify a valid ip address in the \'Host\' field'; + if ($post['host'] != "" && !is_ipaddr($post['host'])) { + $input_errors[] = 'You must specify a valid IP address in the \'Destination Host\' field'; } - if (($post['port'] == "") || !is_port($post['port'])) { - $input_errors[] = 'You must specify a valid port number in the \'Port\' field'; + if ($post['port'] != "" && !is_port($post['port'])) { + $input_errors[] = 'You must specify a valid port number in the \'Destination Port\' field'; } - } - - function cleanup_config_pfflowd() { - global $a_pkg; - $pffconf = array(); - if (is_array($a_pkg)) { - foreach($a_pkg as $cf) { - if ($cf['host'] != "") { - $pffconf = $cf; - } - } + if ($post['sourcehost'] != "" && !is_ipaddr($post['sourcehost'])) { + $input_errors[] = 'You must specify a valid IP address in the \'Source IP\' field'; } - $a_pkg = array(); - $a_pkg[0] = $pffconf; } ]]> @@ -183,7 +175,4 @@ validate_form_pfflowd($_POST, $input_errors); - - cleanup_config_pfflowd(); - -- cgit v1.2.3 From 6e16cbfa352eeaaabd15c597e1c83ccdae4a62fa Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 15 Nov 2015 22:47:57 +0100 Subject: Add privileges configuration to pfflowd package --- config/pfflowd/pfflowd.priv.inc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 config/pfflowd/pfflowd.priv.inc diff --git a/config/pfflowd/pfflowd.priv.inc b/config/pfflowd/pfflowd.priv.inc new file mode 100644 index 00000000..67074f52 --- /dev/null +++ b/config/pfflowd/pfflowd.priv.inc @@ -0,0 +1,37 @@ + -- cgit v1.2.3 From 55ed9e6d7c35959af3b8ac5742c38a39ce05a36d Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 15 Nov 2015 22:48:50 +0100 Subject: Bump pfflowd package version --- pkg_config.8.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 1f90b15e..105334e6 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -929,7 +929,7 @@ https://files.pfsense.org/packages/8/All/ pfflowd-0.8.tbz pfflowd-0.8-i386.pbi - 0.8.3 pkg v1.0.1 + 0.8.3 pkg v1.0.4 Stable 2.0 pfflowd.xml -- cgit v1.2.3 From c99835168c9930bdb49b70256b38757505a15482 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 15 Nov 2015 22:49:23 +0100 Subject: Bump pfflowd package version --- pkg_config.8.xml.amd64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index bf958a26..1a9ba54a 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -916,7 +916,7 @@ https://files.pfsense.org/packages/amd64/8/All/ pfflowd-0.8.tbz pfflowd-0.8-amd64.pbi - 0.8.3 pkg v1.0.1 + 0.8.3 pkg v1.0.4 Stable 2.0 pfflowd.xml -- cgit v1.2.3 From d74b03f386cf2cb80c1be781e0ad82c8168a453e Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 15 Nov 2015 22:49:56 +0100 Subject: Bump pfflowd package version --- pkg_config.10.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 4277cede..a43b55cc 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -898,7 +898,7 @@ Network Management https://packages.pfsense.org/packages/config/pfflowd/pfflowd.xml pfflowd-0.8_1-##ARCH##.pbi - 1.0.3 + 1.0.4 RELEASE 3.0 pfflowd.xml -- cgit v1.2.3