diff --git a/net-mgmt/pfSense-pkg-softflowd/Makefile b/net-mgmt/pfSense-pkg-softflowd/Makefile index 4853d9346be6..19794efecc3e 100644 --- a/net-mgmt/pfSense-pkg-softflowd/Makefile +++ b/net-mgmt/pfSense-pkg-softflowd/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-softflowd -PORTVERSION= 1.2.1 -PORTREVISION= 2 +PORTVERSION= 1.2.2 CATEGORIES= net-mgmt MASTER_SITES= # empty DISTFILES= # empty @@ -27,7 +26,12 @@ do-extract: do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/pkg ${MKDIR} ${STAGEDIR}${DATADIR} - ${INSTALL_DATA} -m 0644 ${FILESDIR}${PREFIX}/pkg/softflowd.xml \ + ${MKDIR} ${STAGEDIR}/etc/inc/priv + ${INSTALL_DATA} ${FILESDIR}/etc/inc/priv/softflowd.priv.inc \ + ${STAGEDIR}/etc/inc/priv + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/softflowd.xml \ + ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/softflowd.inc \ ${STAGEDIR}${PREFIX}/pkg ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \ ${STAGEDIR}${DATADIR} diff --git a/net-mgmt/pfSense-pkg-softflowd/files/etc/inc/priv/softflowd.priv.inc b/net-mgmt/pfSense-pkg-softflowd/files/etc/inc/priv/softflowd.priv.inc new file mode 100644 index 000000000000..07de50da110f --- /dev/null +++ b/net-mgmt/pfSense-pkg-softflowd/files/etc/inc/priv/softflowd.priv.inc @@ -0,0 +1,32 @@ + diff --git a/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.inc b/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.inc new file mode 100644 index 000000000000..d58661c1ae53 --- /dev/null +++ b/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.inc @@ -0,0 +1,162 @@ + "softflowd.sh", + "start" => $start, + "stop" => "/usr/bin/killall -9 softflowd" + ) + ); + /* Only try to restart if not booting */ + if (!platform_booting()) { + if (is_service_running("softflowd")) { + restart_service("softflowd"); + } else { + start_service("softflowd"); + } + } + } else { + stop_service("softflowd"); + unlink_if_exists("/usr/local/etc/rc.d/softflowd.sh"); + } + conf_mount_ro(); +} + +function validate_form_softflowd($post, &$input_errors) { + if (!is_ipaddr($post['host'])) { + $input_errors[] = "You must specify a valid ip address in the 'Host' field"; + } + if (!is_port($post['port'])) { + $input_errors[] = "You must specify a valid port number in the 'Port' field"; + } + if (!in_array($post['version'], array(1, 5, 9))) { + $input_errors[] = 'You must specify a netflow version'; + } + if (!in_array($post['flowtracking'], array("full", "proto", "ip"))) { + $input_errors[] = 'You must specify a valid flow tracking selection'; + } + if (!empty($post['hoplimit']) && (!is_numericint($post['hoplimit']) || ($post['hoplimit'] < 1) || ($post['hoplimit'] > 255))) { + $input_errors[] = 'You must specify a valid hop limit'; + } + if (!empty($post['timeout-general']) && !is_numericint($post['timeout-general'])) { + $input_errors[] = 'You must specify a valid General Timeout'; + } + if (!empty($post['timeout-maxlife']) && !is_numericint($post['timeout-maxlife'])) { + $input_errors[] = 'You must specify a valid Maximum Lifetime Timeout'; + } + if (!empty($post['timeout-expint']) && !is_numericint($post['timeout-expint'])) { + $input_errors[] = 'You must specify a valid Expire Interval'; + } + if (!empty($post['timeout-tcp']) && !is_numericint($post['timeout-tcp'])) { + $input_errors[] = 'You must specify a valid TCP Timeout'; + } + if (!empty($post['timeout-tcp-rst']) && !is_numericint($post['timeout-tcp-rst'])) { + $input_errors[] = 'You must specify a valid TCP RST Timeout'; + } + if (!empty($post['timeout-tcp-fin']) && !is_numericint($post['timeout-tcp-fin'])) { + $input_errors[] = 'You must specify a valid TCP FIN Timeout'; + } + if (!empty($post['timeout-udp']) && !is_numericint($post['timeout-udp'])) { + $input_errors[] = 'You must specify a valid UDP Timeout'; + } +} + +function cleanup_config_softflowd() { + global $a_pkg; + $pffconf = array(); + if (is_array($a_pkg)) { + foreach($a_pkg as $cf) { + if ($cf['host'] != "") { + $pffconf = $cf; + } + } + } + $a_pkg = array(); + $a_pkg[0] = $pffconf; +} + +?> diff --git a/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.xml b/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.xml index 13985fdd9a57..ae93ef2ad545 100644 --- a/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.xml +++ b/net-mgmt/pfSense-pkg-softflowd/files/usr/local/pkg/softflowd.xml @@ -8,7 +8,7 @@ * softflowd.xml * * part of pfSense (https://www.pfsense.org) - * Copyright (c) 2013-2015 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2013-2017 Rubicon Communications, LLC (Netgate) * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,13 +27,14 @@ softflowd softflowd: Settings - pkg_edit.php?xml=softflowd.xml&id=0 + /usr/local/pkg/softflowd.inc + /pkg_edit.php?xml=softflowd.xml softflowd Modify softflowd settings.
Services
softflowd.xml - /pkg_edit.php?xml=softflowd.xml&id=0 + /pkg_edit.php?xml=softflowd.xml
softflowd @@ -41,12 +42,21 @@ softflowd Netflow export daemon - installedpackages->package->$packagename->configuration->settings General Settings listtopic + + Enable softflowd + enable + select + enabled + + + + + Interface interface @@ -59,23 +69,35 @@ host Specify the host to which datagrams will be sent. input + Port port Enter the port to which datagrams will be sent. input + Max Flows maxflows - Specify the maximum number of flows to concurrently track before older flows are expired. Default: 8192. + + Default: 8192. + ]]> + input Hop Limit hoplimit - Set the IPv4 TTL or the IPv6 hop limit to hoplimit. softflowd will use the default system TTL when exporting flows to a unicast host. When exporting to a multicast group, the default TTL will be 1 (i.e. link-local). + + + When exporting to a multicast group, the default TTL will be 1 (i.e. link-local). + ]]> + input @@ -84,39 +106,38 @@ Select the desired version of the NetFlow protocol. select - - - + + + + Flow Tracking Level flowtracking - Specify which flow elements softflowd should be used to define a flow. track_level may be one of: "full" (track everything in the flow, the default), "proto" (track source and destination addresses and protocol), or "ip" (only track source and destination addresses). Selecting either of the latter options will produce flows with less information in them (e.g. TCP/UDP ports will not be recorded). This will cause flows to be consolidated, reducing the quantity of output and CPU load that softflowd will place on the system at the cost of some detail being lost. + + Click Info for details. +
+ The track_level value may be one of:
+
+
full
Track everything in the flow, the default.
+
proto
Track source and destination addresses and protocol.
+
ip
Only track source and destination addresses.
+
+ Selecting either of the latter options will produce flows with less information in them (e.g. TCP/UDP ports will not be recorded). + This will cause flows to be consolidated, reducing the quantity of output and CPU load that softflowd will place on the system at + the cost of some detail being lost. +
+ ]]> +
select - - - + + + +
Timeout Values @@ -125,175 +146,81 @@ General timeout-general - (Seconds) This is the general timeout applied to all traffic unless overridden by one of the other timeouts. + + Specify value in seconds. + ]]> + input Maximum Lifetime timeout-maxlife - (Seconds) This is the maximum lifetime that a flow may exist for. All flows are forcibly expired when they pass maxlife seconds. To disable this feature, specify a maxlife of 0. + + + Specify value in seconds. To disable this feature, specify a maxlife of 0. + ]]> + input Expire Interval timeout-expint - (Seconds) Specify the interval between expiry checks. Increase this to group more flows into a NetFlow packet. To disable this feature, specify a expint of 0. + + + Specify value in seconds. To disable this feature, specify 0. + ]]> + input TCP timeout-tcp - (Seconds) This is the general TCP timeout, applied to open TCP connections. + + Specify value in seconds. + ]]> + input TCP RST timeout-tcp-rst - (Seconds) This timeout is applied to a TCP connection when a RST packet has been sent by one or both endpoints. + + Specify value in seconds. + ]]> + input TCP FIN timeout-tcp-fin - (Seconds) This timeout is applied to a TCP connection when a FIN packet has been sent by both endpoints. + + Specify value in seconds. + ]]> + input UDP timeout-udp - (Seconds) This is the general UDP timeout, applied to all UDP connections. + + Specify value in seconds. + ]]> + input
- - "softflowd.sh", - "start" => $start, - "stop" => "/usr/bin/killall -9 softflowd" - ) - ); - /* Only try to restart if not booting */ - if (function_exists("platform_booting")) { - if (!platform_booting()) { - restart_service("softflowd"); - } - } elseif (!($g['booting'])) { - restart_service("softflowd"); - } - } - conf_mount_ro(); - } - - function validate_form_softflowd($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['port'] == "") || !is_port($post['port'])) { - $input_errors[] = 'You must specify a valid port number in the \'Port\' field'; - } - if (($post['version'] == "" || !in_array($post['version'], array(1, 5, 9)))) { - $input_errors[] = 'You must specify a netflow version'; - } - if (($post['flowtracking'] == "" || !in_array($post['flowtracking'], array("full", "proto", "ip")))) { - $input_errors[] = 'You must specify a valid flow tracking selection'; - } - if (!empty($post['hoplimit']) && (!is_numeric($post['hoplimit']) || ($post['hoplimit'] < 1) || ($post['hoplimit'] > 255))) { - $input_errors[] = 'You must specify a valid hop limit'; - } - if (!empty($post['timeout-general']) && (!is_numeric($post['timeout-general']) || ($post['timeout-general'] < 0))) { - $input_errors[] = 'You must specify a valid General Timeout'; - } - if (!empty($post['timeout-maxlife']) && (!is_numeric($post['timeout-maxlife']) || ($post['timeout-maxlife'] < 0))) { - $input_errors[] = 'You must specify a valid Maximum Lifetime Timeout'; - } - if (!empty($post['timeout-expint']) && (!is_numeric($post['timeout-expint']) || ($post['timeout-expint'] < 0))) { - $input_errors[] = 'You must specify a valid Expire Interval'; - } - if (!empty($post['timeout-tcp']) && (!is_numeric($post['timeout-tcp']) || ($post['timeout-tcp'] < 0))) { - $input_errors[] = 'You must specify a valid TCP Timeout'; - } - if (!empty($post['timeout-tcp-rst']) && (!is_numeric($post['timeout-tcp-rst']) || ($post['timeout-tcp-rst'] < 0))) { - $input_errors[] = 'You must specify a valid TCP RST Timeout'; - } - if (!empty($post['timeout-tcp-fin']) && (!is_numeric($post['timeout-tcp-fin']) || ($post['timeout-tcp-fin'] < 0))) { - $input_errors[] = 'You must specify a valid TCP FIN Timeout'; - } - if (!empty($post['timeout-udp']) && (!is_numeric($post['timeout-udp']) || ($post['timeout-udp'] < 0))) { - $input_errors[] = 'You must specify a valid UDP Timeout'; - } - } - - function cleanup_config_softflowd() { - global $a_pkg; - $pffconf = array(); - if (is_array($a_pkg)) { - foreach($a_pkg as $cf) { - if ($cf['host'] != "") { - $pffconf = $cf; - } - } - } - $a_pkg = array(); - $a_pkg[0] = $pffconf; - } - ]]> - sync_package_softflowd(); diff --git a/net-mgmt/pfSense-pkg-softflowd/pkg-plist b/net-mgmt/pfSense-pkg-softflowd/pkg-plist index fe3b01129a56..242811aade6b 100644 --- a/net-mgmt/pfSense-pkg-softflowd/pkg-plist +++ b/net-mgmt/pfSense-pkg-softflowd/pkg-plist @@ -1,2 +1,6 @@ +pkg/softflowd.inc pkg/softflowd.xml +/etc/inc/priv/softflowd.priv.inc %%DATADIR%%/info.xml +@dir /etc/inc/priv +@dir /etc/inc