diff options
author | jim-p <jimp@pfsense.org> | 2013-10-08 15:46:57 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-10-08 15:46:57 -0400 |
commit | 63209b621929d77f669af22b2f721320e62184cf (patch) | |
tree | 154bc0a996f5efb30d62a1954ecf4bc8851650dc | |
parent | 3b9c658e72a0eacf91ffd63d962e5ec322f3f333 (diff) | |
download | pfsense-packages-63209b621929d77f669af22b2f721320e62184cf.tar.gz pfsense-packages-63209b621929d77f669af22b2f721320e62184cf.tar.bz2 pfsense-packages-63209b621929d77f669af22b2f721320e62184cf.zip |
Add small softflowd package
-rw-r--r-- | config/softflowd/softflowd.xml | 136 | ||||
-rw-r--r-- | pkg_config.8.xml | 18 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 18 |
3 files changed, 172 insertions, 0 deletions
diff --git a/config/softflowd/softflowd.xml b/config/softflowd/softflowd.xml new file mode 100644 index 00000000..1b45f8bb --- /dev/null +++ b/config/softflowd/softflowd.xml @@ -0,0 +1,136 @@ +<packagegui> + <name>softflowd</name> + <version>0.9.8</version> + <title>softflowd: Settings</title> + <aftersaveredirect>pkg_edit.php?xml=softflowd.xml&id=0</aftersaveredirect> + <menu> + <name>softflowd</name> + <tooltiptext>Modify softflowd settings.</tooltiptext> + <section>Services</section> + <configfile>softflowd.xml</configfile> + <url>/pkg_edit.php?xml=softflowd.xml&id=0</url> + </menu> + <service> + <name>softflowd</name> + <rcfile>softflowd.sh</rcfile> + <executable>softflowd</executable> + </service> + <configpath>installedpackages->package->$packagename->configuration->settings</configpath> + <fields> + <field> + <fielddescr>Interface</fielddescr> + <fieldname>interface</fieldname> + <type>interfaces_selection</type> + <description>Pick an interface from which to collect netflow data. A separate instance of softflowd will be launched for each interface.</description> + <multiple/> + </field> + <field> + <fielddescr>Host</fielddescr> + <fieldname>host</fieldname> + <description>Specify the host to which datagrams will be sent.</description> + <type>input</type> + </field> + <field> + <fielddescr>Port</fielddescr> + <fieldname>port</fieldname> + <description>Enter the port to which datagrams will be sent.</description> + <type>input</type> + </field> + <field> + <fielddescr>Max Flows</fielddescr> + <fieldname>maxflows</fieldname> + <description>Specify the maximum number of flows to concurrently track before older flows are expired. Default: 8192.</description> + <type>input</type> + </field> + <field> + <fielddescr>Netflow version</fielddescr> + <fieldname>version</fieldname> + <description>Select the desired version of the NetFlow protocol.</description> + <type>select</type> + <options> + <option> + <name>9</name> + <value>9</value> + </option> + <option> + <name>5</name> + <value>5</value> + </option> + <option> + <name>1</name> + <value>1</value> + </option> + </options> + </field> + </fields> + <custom_php_global_functions> + <![CDATA[ + function sync_package_softflowd() { + conf_mount_rw(); + config_lock(); + global $config; + $cf = $config['installedpackages']['softflowd']['config'][0]; + $interface_list = explode(",", $cf['interface']); + if (!empty($cf['host']) && !empty($interface_list)) { + $cf['host'] = is_ipaddrv6($cf['host']) ? "[{$cf['host']}]" : $cf['host']; + $start = "/usr/bin/killall -9 softflowd"; + foreach ($interface_list as $interface_friendly) { + if (empty($interface_friendly)) + continue; + $interface = get_real_interface($interface_friendly); + if (empty($interface)) + continue; + $start .= "\n\t/usr/local/sbin/softflowd "; + $start .= " -i {$interface}"; + $start .= " -n {$cf['host']}:{$cf['port']}"; + if (is_numeric($cf['maxflows'])) + $start .= " -m {$cf['maxflows']}"; + if ($cf['version'] != "") + $start .= " -v {$cf['version']}"; + $start .= " -p /var/run/softflowd.{$interface}.pid"; + $start .= " -c /var/run/softflowd.{$interface}.ctl"; + } + write_rcfile(array( + "file" => "softflowd.sh", + "start" => $start, + "stop" => "/usr/bin/killall -9 softflowd" + ) + ); + restart_service("softflowd"); + } + conf_mount_ro(); + config_unlock(); + } + + 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'; + } + + 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; + } + ]]> + </custom_php_global_functions> + <custom_php_resync_config_command> + sync_package_softflowd(); + </custom_php_resync_config_command> + <custom_php_validation_command> + validate_form_softflowd($_POST, &$input_errors); + </custom_php_validation_command> + <custom_php_command_before_form> + cleanup_config_softflowd(); + </custom_php_command_before_form> +</packagegui> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 0185fe4b..594b0f1a 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1965,5 +1965,23 @@ <required_version>2.1</required_version> <configurationfile>servicewatchdog.xml</configurationfile> </package> + <package> + <name>softflowd</name> + <website>http://code.google.com/p/softflowd/</website> + <descr>Softflowd is flow-based network traffic analyser capable of Cisco NetFlow data export. Softflowd semi-statefully tracks traffic flows recorded by listening on a network interface or by reading a packet capture file. These flows may be reported via NetFlow to a collecting host or summarised within softflowd itself. Softflowd supports Netflow versions 1, 5 and 9 and is fully IPv6-capable - it can track IPv6 flows and send export datagrams via IPv6. It also supports export to multicast groups, allowing for redundant flow collectors.</descr> + <category>Network Management</category> + <config_file>http://www.pfsense.com/packages/config/softflowd/softflowd.xml</config_file> + <depends_on_package_base_url>http://files.pfsense.org/packages/8/All/</depends_on_package_base_url> + <depends_on_package>softflowd-0.9.8.tbz</depends_on_package> + <depends_on_package_pbi>softflowd-0.9.8-i386.pbi</depends_on_package_pbi> + <version>0.9.8</version> + <status>Beta</status> + <required_version>3.0</required_version> + <configurationfile>softflowd.xml</configurationfile> + <maintainer></maintainer> + <build_pbi> + <port>net-mgmt/softflowd</port> + </build_pbi> + </package> </packages> </pfsensepkgs> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 1519fd39..5b6f6022 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1952,5 +1952,23 @@ <required_version>2.1</required_version> <configurationfile>servicewatchdog.xml</configurationfile> </package> + <package> + <name>softflowd</name> + <website>http://code.google.com/p/softflowd/</website> + <descr>Softflowd is flow-based network traffic analyser capable of Cisco NetFlow data export. Softflowd semi-statefully tracks traffic flows recorded by listening on a network interface or by reading a packet capture file. These flows may be reported via NetFlow to a collecting host or summarised within softflowd itself. Softflowd supports Netflow versions 1, 5 and 9 and is fully IPv6-capable - it can track IPv6 flows and send export datagrams via IPv6. It also supports export to multicast groups, allowing for redundant flow collectors.</descr> + <category>Network Management</category> + <config_file>http://www.pfsense.com/packages/config/softflowd/softflowd.xml</config_file> + <depends_on_package_base_url>http://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url> + <depends_on_package>softflowd-0.9.8.tbz</depends_on_package> + <depends_on_package_pbi>softflowd-0.9.8-amd64.pbi</depends_on_package_pbi> + <version>0.9.8</version> + <status>Beta</status> + <required_version>3.0</required_version> + <configurationfile>softflowd.xml</configurationfile> + <maintainer></maintainer> + <build_pbi> + <port>net-mgmt/softflowd</port> + </build_pbi> + </package> </packages> </pfsensepkgs> |