diff options
29 files changed, 976 insertions, 709 deletions
diff --git a/config/blinkled8/blinkled.inc b/config/blinkled8/blinkled.inc index 6d0da039..6e76c157 100644 --- a/config/blinkled8/blinkled.inc +++ b/config/blinkled8/blinkled.inc @@ -1,4 +1,33 @@ <?php +/* + blinkled.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +require_once("config.inc"); require_once("functions.inc"); function blinkled_rcfile() { @@ -28,53 +57,42 @@ EOD; conf_mount_ro(); } -function blinkled_running () { - return ((int)exec('pgrep blinkled | wc -l') > 0); -} function sync_package_blinkled() { global $config; + + blinkled_rcfile(); + $blinkled_config = $config['installedpackages']['blinkled']['config'][0]; - /* kill all instances of blinkled */ - if(blinkled_running()) { - blinkled_stop(); + /* If the service (being) disabled, stop it (if running) and do nothing else */ + if (!($blinkled_config['enable'])) { + if (is_process_running("blinkled")) { + stop_service("blinkled"); + } + return; } - /* if blinkled not running start it */ - if(!blinkled_running()) { - blinkled_start(); + /* Kill all instances of blinkled */ + if (is_process_running("blinkled")) { + stop_service("blinkled"); } - blinkled_rcfile(); + start_service("blinkled"); } function blinkled_launch($int, $led, $return = false) { $cmd = "/usr/local/bin/blinkled -i " . escapeshellarg($int) . " -l " . escapeshellarg("/dev/led/led{$led}"); - if ($return) + if ($return) { return $cmd; - else + } else { mwexec($cmd); -} - -function blinkled_start() { - global $config; - $blinkled_config = $config['installedpackages']['blinkled']['config'][0]; - if (!($blinkled_config['enable'])) - return; - - if (($blinkled_config['enable_led2']) && ($blinkled_config['iface_led2'])) - blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led2']), 2); - if (($blinkled_config['enable_led3']) && ($blinkled_config['iface_led3'])) - blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led3']), 3); -} - -function blinkled_stop() { - mwexec("/usr/bin/killall -9 blinkled"); + } } function validate_form_blinkled($post, &$input_errors) { /* Make sure both aren't using the same interface */ - if (($post['iface_led2']) && ($post['iface_led3']) && + if (($post['iface_led2']) && ($post['iface_led3']) && (($post['enable_led2']) && ($post['enable_led3'])) && - ($post['iface_led2'] == $post['iface_led3'])) + ($post['iface_led2'] == $post['iface_led3'])) { $input_errors[] = 'You cannot set two LEDs for a single interface. Please choose seperate interfaces.'; + } } ?> diff --git a/config/blinkled8/blinkled.xml b/config/blinkled8/blinkled.xml index ec70f392..2502f3ff 100644 --- a/config/blinkled8/blinkled.xml +++ b/config/blinkled8/blinkled.xml @@ -1,8 +1,49 @@ <?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + blinkled.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009-2012 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <title>Interfaces: Assign LEDs</title> <name>blinkled</name> - <version>0.4.1</version> + <version>0.4.5</version> <savetext>Save</savetext> <include_file>/usr/local/pkg/blinkled.inc</include_file> <menu> @@ -14,13 +55,12 @@ <additional_files_needed> <item>https://packages.pfsense.org/packages/config/blinkled8/blinkled.inc</item> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> </additional_files_needed> <service> <name>blinkled</name> <rcfile>blinkled.sh</rcfile> <executable>blinkled</executable> - <description>Blinks LEDs to indicate network activity</description> + <description>Network Activity LED Indicator Daemon</description> </service> <fields> <field> @@ -28,7 +68,7 @@ <fieldname>enable</fieldname> <type>checkbox</type> <enablefields>enable_led2,enable_led3,iface_led2,iface_led3</enablefields> - <description>if this is enabled, it will use LED #2 and #3 to + <description>If this is enabled, it will use LED #2 and #3 to indicate network activity. Be aware, however, that this will possibly consume some system resources in the process.</description> </field> @@ -41,7 +81,7 @@ <fielddescr>Interface For LED #2</fielddescr> <fieldname>iface_led2</fieldname> <type>interfaces_selection</type> - <description>Pick an interface to blink for activity on LED #2</description> + <description>Pick an interface to blink for activity on LED #2.</description> </field> <field> <fielddescr>Enable LED #3</fielddescr> @@ -52,7 +92,7 @@ <fielddescr>Interface For LED #3</fielddescr> <fieldname>iface_led3</fieldname> <type>interfaces_selection</type> - <description>Pick an interface to blink for activity on LED #3</description> + <description>Pick an interface to blink for activity on LED #3.</description> </field> </fields> <custom_php_validation_command> diff --git a/config/filer/filer.inc b/config/filer/filer.inc index 3a012dd2..7b795acb 100644 --- a/config/filer/filer.inc +++ b/config/filer/filer.inc @@ -44,7 +44,7 @@ function sync_package_filer() { if ($config['installedpackages']['filer']['config'] != "") { $count = 0; foreach ($config['installedpackages']['filer']['config'] as $file) { - if ($file['filedata']=="" && file_exists($file['fullfile'])) { + if ($file['filedata'] == "" && file_exists($file['fullfile'])) { $config['installedpackages']['filer']['config'][$count]['filedata'] = base64_encode(file_get_contents($file['fullfile'])); $file['filedata'] = base64_encode(file_get_contents($file['fullfile'])); $update_conf++; @@ -65,10 +65,10 @@ function sync_package_filer() { switch ($file['background']) { case "background": mwexec_bg($file['cmd']); - break; + break; case "foreground": mwexec($file['cmd']); - break; + break; } } } @@ -90,13 +90,13 @@ function filer_validate_input($post, &$input_errors) { continue; } if (substr($key, 0, 3) == "mod" && !preg_match("/^0?[0-7]{3}$/", $value)) { - $input_errors[] = "{$value} is not valid permissions mode number."; + $input_errors[] = "{$value} is not valid permissions mode number."; } if (substr($key, 0, 11) == "description" && !preg_match("@^[a-zA-Z0-9 _/.-]+$@", $value)) { - $input_errors[] = "Do not use special characters in description."; + $input_errors[] = "Do not use special characters in description."; } if (substr($key, 0, 8) == "fullfile" && !preg_match("@^[a-zA-Z0-9_/.-]+$@", $value)) { - $input_errors[] = "Do not use special characters in filename."; + $input_errors[] = "Do not use special characters in filename."; } } } diff --git a/config/filer/filer.xml b/config/filer/filer.xml index ab49bb21..57125927 100644 --- a/config/filer/filer.xml +++ b/config/filer/filer.xml @@ -44,7 +44,7 @@ ]]> </copyright> <name>filer</name> - <version>0.60.2</version> + <version>0.60.4</version> <title>Filer</title> <include_file>/usr/local/pkg/filer.inc</include_file> <additional_files_needed> @@ -84,14 +84,14 @@ <columnitem> <fielddescr>Description</fielddescr> <fieldname>description</fieldname> - </columnitem> + </columnitem> </adddeleteeditpagefields> <fields> <field> <type>listtopic</type> <fieldname>temp</fieldname> <name>File configuration</name> - </field> + </field> <field> <fielddescr>File</fielddescr> <fieldname>fullfile</fieldname> @@ -129,7 +129,7 @@ <type>listtopic</type> <fieldname>temp</fieldname> <name>Command to run after file save/sync.</name> - </field> + </field> <field> <fielddescr>Script/Command</fielddescr> <fieldname>cmd</fieldname> @@ -142,7 +142,7 @@ <fielddescr>Execute mode</fielddescr> <fieldname>background</fieldname> <type>select</type> - <options> + <options> <option> <name>Background (default)</name> <value>background</value> @@ -164,7 +164,7 @@ </custom_php_validation_command> <custom_delete_php_command> sync_package_filer(); - </custom_delete_php_command> + </custom_delete_php_command> <custom_php_resync_config_command> sync_package_filer(); </custom_php_resync_config_command> diff --git a/config/iperf/iperf.xml b/config/iperf/iperf.xml index 4312cf25..182d866b 100644 --- a/config/iperf/iperf.xml +++ b/config/iperf/iperf.xml @@ -1,52 +1,48 @@ <?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ -/* ========================================================================== */ +/* ====================================================================================== */ /* - iperf.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ + iperf.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2015 Renato Botelho + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>iperf</name> - <version>1.7.0</version> + <version>2.0.5.2</version> <title>iperf: Client</title> <preoutput>yes</preoutput> <donotsave>true</donotsave> @@ -57,10 +53,10 @@ <configfile>iperf.xml</configfile> </menu> <service> - <name>iperf</name> - <executable>iperf</executable> + <name>iperf</name> + <executable>iperf</executable> <description>iperf network performance testing daemon/client</description> - </service> + </service> <tabs> <tab> <text>Client</text> @@ -85,13 +81,13 @@ <field> <fielddescr>Port</fielddescr> <fieldname>port</fieldname> - <description>Enter the port that iperf will connect to. (default 5001)</description> + <description>Enter the port that iperf will connect to. (Default is 5001.)</description> <type>input</type> </field> <field> <fielddescr>Protocol</fielddescr> <fieldname>protocol</fieldname> - <description>Choose whether to use TCP or UDP here. (default is TCP)</description> + <description>Choose whether to use TCP or UDP here. (Default is TCP.)</description> <type>select</type> <options> <option> @@ -107,7 +103,7 @@ <field> <fielddescr>Output format</fielddescr> <fieldname>format</fieldname> - <description>Choose to display output in bits/sec or bytes/sec. (default is bits)</description> + <description>Choose to display output in bits/sec or bytes/sec. (Default is bits.)</description> <type>select</type> <options> <option> @@ -123,13 +119,13 @@ <field> <fielddescr>Interval</fielddescr> <fieldname>interval</fieldname> - <description>Enter the desired interval between bandwidth, jitter and loss reports here. (default is 0 for no periodic reports)</description> + <description>Enter the desired interval between bandwidth, jitter and loss reports here. (Default is 0 for no periodic reports.)</description> <type>input</type> </field> <field> <fielddescr>Buffer length</fielddescr> <fieldname>length</fieldname> - <description>Enter the length of buffers to read or write here. (default 8KB for TCP, 1470B for UDP)</description> + <description>Enter the length of buffers to read or write here. (Default 8KB for TCP, 1470B for UDP.)</description> <type>input</type> </field> <field> @@ -141,21 +137,37 @@ <field> <fielddescr>UDP Bandwidth</fielddescr> <fieldname>udpbandwidth</fieldname> - <description>Enter the UDP bandwidth to send at in bits/sec. (default is 1Mbit/sec)</description> + <description>Enter the UDP bandwidth to send at in bits/sec. (Default is 1Mbit/sec.)</description> <type>input</type> </field> </fields> <custom_add_php_command> - mwexec("killall iperf"); + <![CDATA[ + mwexec("/usr/bin/killall iperf"); $iperf_options = ""; - if($_POST['protocol'] == "udp") $iperf_options .= " -u"; - if($_POST['format'] == "bytes") $iperf_options .= " -f A"; - if($_POST['interval'] != "") $iperf_options .= " -i " . escapeshellarg($_POST['interval']); - if($_POST['length'] != "") $iperf_options .= " -l " . escapeshellarg($_POST['length']); - if($_POST['window'] != "") $iperf_options .= " -w " . escapeshellarg($_POST['window']); - if($_POST['udpbandwidth'] != "") $iperf_options .= " -b " . escapeshellarg($_POST['udpbandwidth']); - if($_POST['port'] != "") $iperf_options .= " -p " . escapeshellarg($_POST['port']); + if ($_POST['protocol'] == "udp") { + $iperf_options .= " -u"; + } + if ($_POST['format'] == "bytes") { + $iperf_options .= " -f A"; + } + if ($_POST['interval'] != "") { + $iperf_options .= " -i " . escapeshellarg($_POST['interval']); + } + if ($_POST['length'] != "") { + $iperf_options .= " -l " . escapeshellarg($_POST['length']); + } + if ($_POST['window'] != "") { + $iperf_options .= " -w " . escapeshellarg($_POST['window']); + } + if ($_POST['udpbandwidth'] != "") { + $iperf_options .= " -b " . escapeshellarg($_POST['udpbandwidth']); + } + if ($_POST['port'] != "") { + $iperf_options .= " -p " . escapeshellarg($_POST['port']); + } $iperf_options .= " -c " . escapeshellarg($_POST['hostname']); system("/usr/local/bin/iperf" . $iperf_options); + ]]> </custom_add_php_command> </packagegui> diff --git a/config/iperf/iperfserver.xml b/config/iperf/iperfserver.xml index f0dc074a..524e8366 100644 --- a/config/iperf/iperfserver.xml +++ b/config/iperf/iperfserver.xml @@ -2,51 +2,47 @@ <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ -/* ========================================================================== */ +/* ====================================================================================== */ /* - iperfserver.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ + iperfserver.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2015 Renato Botelho + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>iperf</name> - <version>1.7.0</version> + <version>2.0.5.2</version> <title>iperf: Server</title> <preoutput>yes</preoutput> <donotsave>true</donotsave> @@ -71,13 +67,13 @@ <field> <fielddescr>Port</fielddescr> <fieldname>port</fieldname> - <description>Enter the port that iperf will listen for connections on. (default 5001)</description> + <description>Enter the port that iperf will listen for connections on. (Default is 5001.)</description> <type>input</type> </field> <field> <fielddescr>Protocol</fielddescr> <fieldname>protocol</fieldname> - <description>Choose whether to use TCP or UDP here. (default is TCP)</description> + <description>Choose whether to use TCP or UDP here. (Default is TCP.)</description> <type>select</type> <options> <option> @@ -93,7 +89,7 @@ <field> <fielddescr>Output format</fielddescr> <fieldname>format</fieldname> - <description>Choose to display output in bits/sec or bytes/sec. (default is bits)</description> + <description>Choose to display output in bits/sec or bytes/sec. (Default is bits.)</description> <type>select</type> <options> <option> @@ -109,13 +105,13 @@ <field> <fielddescr>Interval</fielddescr> <fieldname>interval</fieldname> - <description>Enter the desired interval between bandwidth, jitter and loss reports here. (default is 0 for no periodic reports)</description> + <description>Enter the desired interval between bandwidth, jitter and loss reports here. (Default is 0 for no periodic reports.)</description> <type>input</type> </field> <field> <fielddescr>Buffer length</fielddescr> <fieldname>length</fieldname> - <description>Enter the length of buffers to read or write here. (default 8KB for TCP, 1470B for UDP)</description> + <description>Enter the length of buffers to read or write here. (Default 8KB for TCP, 1470B for UDP.)</description> <type>input</type> </field> <field> @@ -126,16 +122,29 @@ </field> </fields> <custom_add_php_command> - mwexec("killall iperf"); + <![CDATA[ + mwexec("/usr/bin/killall iperf"); $iperf_options = ""; - if($_POST['protocol'] == "udp") $iperf_options .= " -u"; - if($_POST['format'] == "bytes") $iperf_options .= " -f A"; - if($_POST['interval'] != "") $iperf_options .= " -i " . escapeshellarg($_POST['interval']); - if($_POST['length'] != "") $iperf_options .= " -l " . escapeshellarg($_POST['length']); - if($_POST['window'] != "") $iperf_options .= " -w " . escapeshellarg($_POST['window']); - if($_POST['port'] != "") $iperf_options .= " -p " . escapeshellarg($_POST['port']); + if ($_POST['protocol'] == "udp") { + $iperf_options .= " -u"; + } + if ($_POST['format'] == "bytes") { + $iperf_options .= " -f A"; + } + if ($_POST['interval'] != "") { + $iperf_options .= " -i " . escapeshellarg($_POST['interval']); + } + if ($_POST['length'] != "") { + $iperf_options .= " -l " . escapeshellarg($_POST['length']); + } + if ($_POST['window'] != "") { + $iperf_options .= " -w " . escapeshellarg($_POST['window']); + } + if ($_POST['port'] != "") { + $iperf_options .= " -p " . escapeshellarg($_POST['port']); + } $iperf_options .= " -s"; mwexec_bg("/usr/local/bin/iperf" . $iperf_options); + ]]> </custom_add_php_command> </packagegui> - diff --git a/config/notes/notes.inc b/config/notes/notes.inc index f4bfe2cc..29b51396 100644 --- a/config/notes/notes.inc +++ b/config/notes/notes.inc @@ -3,10 +3,10 @@ /* /* ========================================================================== */ /* - notes.inc - Copyright (C) 2008 Mark J Crane - All rights reserved. - */ + notes.inc + Copyright (C) 2008 Mark J Crane + All rights reserved. +*/ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -31,61 +31,53 @@ POSSIBILITY OF SUCH DAMAGE. */ -function notes_sync_package() -{ - - //global $config; +function notes_sync_package() { + + //global $config; } - -function notes_install_command() -{ + +function notes_install_command() { global $config; conf_mount_rw(); config_lock(); if (!is_dir('/usr/local/www/packages/')) { - exec("mkdir /usr/local/www/packages/"); + exec("mkdir /usr/local/www/packages/"); } - + //if (!is_dir('/usr/local/www/packages/notes/')) { // exec("mkdir /usr/local/www/packages/notes/"); //} - //rename PHP files from .tmp to .php //exec("cp /tmp/notes.tmp /usr/local/www/packages/phpservice/notes.php"); //unlink_if_exists("/tmp/notes.tmp"); - - //write_config(); + //write_config(); - //write_rcfile(array( // "file" => "notes.sh", // "start" => "/usr/local/bin/php /usr/local/pkg/notes.php", // "stop" => "rm /tmp/phpmonitor.pid" // ) //); - - + notes_sync_package(); - - //if (pkg_is_service_running('notes')) { + //if (pkg_is_service_running('notes')) { //documentation purposes //} conf_mount_ro(); config_unlock(); - + } -function notes_deinstall_command() -{ +function notes_deinstall_command() { conf_mount_rw(); config_lock(); @@ -93,7 +85,7 @@ function notes_deinstall_command() unlink_if_exists("/usr/local/pkg/notes.inc"); conf_mount_ro(); config_unlock(); - + } ?>
\ No newline at end of file diff --git a/config/notes/notes.xml b/config/notes/notes.xml index 513bf922..34d2f676 100644 --- a/config/notes/notes.xml +++ b/config/notes/notes.xml @@ -2,46 +2,46 @@ <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - notes.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - */ + notes.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. +*/ /* ========================================================================== */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ /* ========================================================================== */ - ]]> - </copyright> - <description>Notes</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>Notes</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>Notes</name> - <version>0.2.3</version> + <version>0.2.5</version> <title>Settings</title> <include_file>/usr/local/pkg/notes.inc</include_file> <menu> @@ -56,24 +56,24 @@ <text>Settings</text> <url>/pkg_edit.php?xml=notes.xml</url> <active/> - </tab> + </tab> </tabs> - <configpath>installedpackages->package->$packagename->configuration->notes</configpath> + <configpath>installedpackages->package->$packagename->configuration->notes</configpath> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>https://packages.pfsense.org/packages/config/notes/notes.inc</item> </additional_files_needed> <adddeleteeditpagefields> <columnitem> <fielddescr>Title</fielddescr> <fieldname>title</fieldname> - </columnitem> + </columnitem> <columnitem> <fielddescr>Category</fielddescr> <fieldname>category</fieldname> </columnitem> - </adddeleteeditpagefields> + </adddeleteeditpagefields> <fields> <field> <fielddescr>Title</fielddescr> @@ -86,7 +86,7 @@ <fieldname>category</fieldname> <description>Enter a category.</description> <type>input</type> - </field> + </field> <field> <fielddescr><b>Notes</b> <br /> <br /></fielddescr> <fieldname>notes</fieldname> @@ -94,16 +94,16 @@ <type>textarea</type> <encoding>base64</encoding> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>20</rows> </field> - </fields> + </fields> <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> notes_sync_package(); </custom_php_resync_config_command> - <custom_delete_php_command> + <custom_delete_php_command> notes_sync_package(); </custom_delete_php_command> <custom_php_install_command> diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc index 7d541e6b..b5e6a7d9 100644 --- a/config/nrpe2/nrpe2.inc +++ b/config/nrpe2/nrpe2.inc @@ -1,42 +1,49 @@ <?php - -/** - * Author: Erik Kristensen - * Email: erik@erikkristensen.com - * - * Developed for: pfSense.com - * - * Copyright (c) 2009, pfSense.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution. - * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - +/* + nrpe2.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Erik Kristensen <erik@erikkristensen.com> + Copyright (C) 2011-2013 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ require_once('filter.inc'); -$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); +global $pfs_version; +$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3); -if ($pfs_version == "2.0") { - define('NRPE_BASE', '/usr/local'); -} else { +if ($pfs_version == "2.1" || $pfs_version == "2.2") { define('NRPE_BASE', '/usr/pbi/nrpe-' . php_uname("m")); +} else { + define('NRPE_BASE', '/usr/local'); } -if ($pfs_version == "2.1") +if ($pfs_version == "2.1") { define('NRPE_BINARY', NRPE_BASE . "/sbin/nrpe2"); -else +} else { define('NRPE_BINARY', "/usr/local/sbin/nrpe2"); +} define('NRPE_CONFIG_DIR', NRPE_BASE . '/etc'); define('NRPE_RCFILE', '/usr/local/etc/rc.d/nrpe2.sh'); @@ -202,22 +209,21 @@ connection_timeout=300 {$commands} EOD; if (defined($config['installedpackages']['nrpe2']['config'][0]['server_address'])) { - $server_address = $config['installedpackages']['nrpe2']['config'][0]['server_address']; - $nrpe_cfg .= "server_address={$server_address}"; - } + $server_address = $config['installedpackages']['nrpe2']['config'][0]['server_address']; + $nrpe_cfg .= "server_address={$server_address}"; + } fwrite($fd, $nrpe_cfg); fclose($fd); conf_mount_ro(); } function nrpe2_custom_php_service() { - global $g, $config; + global $config; if ($config['installedpackages']['nrpe2']['config'][0]['enabled'] == "on") { - exec(NRPE_RCFILE . " restart"); - } - else { - exec(NRPE_RCFILE . " stop"); + restart_service("nrpe2"); + } else { + stop_service("nrpe2"); } } diff --git a/config/nrpe2/nrpe2.xml b/config/nrpe2/nrpe2.xml index 8d6f0b09..1204e8ec 100644 --- a/config/nrpe2/nrpe2.xml +++ b/config/nrpe2/nrpe2.xml @@ -1,9 +1,50 @@ <?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + nrpe2.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Erik Kristensen + Copyright (C) 2011-2013 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <description>Nagios NRPEv2</description> - <requirements>Describe your package requirements here</requirements> <name>nrpe2</name> - <version>2.2</version> + <version>2.2.1</version> <title>NRPEv2</title> <aftersaveredirect>/pkg_edit.php?xml=nrpe2.xml&id=0</aftersaveredirect> <include_file>/usr/local/pkg/nrpe2.inc</include_file> @@ -22,7 +63,6 @@ <configpath>installedpackages->package->nrpe2</configpath> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>077</chmod> <item>https://packages.pfsense.org/packages/config/nrpe2/nrpe2.inc</item> </additional_files_needed> <fields> @@ -34,7 +74,7 @@ <field> <fielddescr>Enabled</fielddescr> <fieldname>enabled</fieldname> - <description>Check this to enable NRPE daemon</description> + <description>Check this to enable NRPE daemon.</description> <type>checkbox</type> </field> <field> @@ -52,20 +92,20 @@ <field> <fielddescr>Bind IP Address</fielddescr> <fieldname>server_address</fieldname> - <description>Set this to the IP address of the interface you want the daemon to listen on. (optional)</description> + <description>Set this to the IP address of the interface you want the daemon to listen on. (Optional)</description> <type>input</type> </field> <field> <fielddescr>Nagios Server(s)</fielddescr> <fieldname>allowed_hosts</fieldname> - <description>IP Address of Nagios server, usualy a single IP, but if multiple delimit by comma</description> + <description>IP Address of Nagios server. Usually a single IP; multiple IPs must be delimited by comma.</description> <type>input</type> <required/> </field> <field> <fielddescr>Allow Arguments (dont_blame_nrpe)</fielddescr> <fieldname>dont_blame_nrpe</fieldname> - <description>Check this to enable accept NRPE arguments (Default: 0)</description> + <description>Check this to enable accept NRPE arguments. (Default: 0)</description> <type>checkbox</type> </field> @@ -118,7 +158,7 @@ <rowhelperfield> <fielddescr>Extra Options (Example: -s Z \$ARG1\$ \$ARG2\$)</fielddescr> <fieldname>extra</fieldname> - <description>Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting!</description> + <description><![CDATA[<strong>Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting!</strong>]]></description> <type>input</type> <size>25</size> </rowhelperfield> diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 979c5f1b..963a2604 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -40,8 +40,8 @@ require_once("util.inc"); require_once("pfsense-utils.inc"); global $current_openvpn_version, $current_openvpn_version_rev; -$current_openvpn_version = "2.3.6"; -$current_openvpn_version_rev = "03"; +$current_openvpn_version = "2.3.8"; +$current_openvpn_version_rev = "01"; function openvpn_client_export_install() { global $current_openvpn_version; @@ -90,10 +90,10 @@ function openvpn_client_export_prefix($srvid, $usrid = null, $crtid = null) { $host = empty($config['system']['hostname']) ? "openvpn" : $config['system']['hostname']; $prot = ($settings['protocol'] == 'UDP' ? 'udp' : $settings['protocol']); $port = $settings['local_port']; - + $filename_addition = ""; if ($usrid && is_numeric($usrid)) { - $filename_addition = "-".$config['system']['user'][$usrid]['name']; + $filename_addition = "-" . $config['system']['user'][$usrid]['name']; } elseif ($crtid && is_numeric($crtid) && function_exists("cert_get_cn")) { $filename_addition = "-" . str_replace(' ', '_', cert_get_cn($config['cert'][$crtid]['crt'])); } @@ -185,9 +185,9 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) { return array($settings, $server_cert, $server_ca, $servercn, $user, $cert, $nokeys); } -function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $nokeys = false, $proxy, $expformat = "baseconf", $outpass = "", $skiptls=false, $doslines=false, $openvpnmanager, $advancedoptions = "") { +function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $nokeys = false, $proxy, $expformat = "baseconf", $outpass = "", $skiptls = false, $doslines = false, $openvpnmanager, $advancedoptions = "") { global $config, $input_errors, $g; - $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); + $pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3); $nl = ($doslines) ? "\r\n" : "\n"; $conf = ""; @@ -374,7 +374,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys $conf .= "management-forget-disconnect{$nl}"; $conf .= $nl; }; - + // add advanced options $advancedoptions = str_replace("\r\n", "\n", $advancedoptions); $advancedoptions = str_replace("\n", $nl, $advancedoptions); @@ -668,12 +668,13 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead } $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, true, $proxy, "baseconf", $outpass, true, true, $openvpnmanager, $advancedoptions); - if (!$conf) + if (!$conf) { return false; + } // We need to nuke the ca line from the above config if it exists. $conf = explode("\n", $conf); - for ($i=0; $i < count($conf); $i++) { + for ($i = 0; $i < count($conf); $i++) { if ((substr($conf[$i], 0, 3) == "ca ") || (substr($conf[$i], 0, 7) == "pkcs12 ")) { unset($conf[$i]); } @@ -866,10 +867,11 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $shkeyfile = "{$tempdir}/{$shkeyfile}"; file_put_contents("{$shkeyfile}", base64_decode($settings['shared_key'])); - if(file_exists("/usr/pbi/zip-{$uname_p}/bin/zip")) + if (file_exists("/usr/pbi/zip-{$uname_p}/bin/zip")) { exec("cd {$tempdir}/.. && /usr/pbi/zip-{$uname_p}/bin/zip -r {$g['tmp_path']}/{$prefix}-config.zip {$prefix}"); - else + } else { exec("cd {$tempdir}/.. && /usr/local/bin/zip -r {$g['tmp_path']}/{$prefix}-config.zip {$prefix}"); + } // Remove temporary directory exec("rm -rf {$tempdir}"); @@ -952,7 +954,7 @@ function openvpn_client_export_find_port_forwards($targetip, $targetport, $targe } $dstaddr = trim(filter_generate_address($natent, 'destination', true)); - if(!$dstaddr) { + if (!$dstaddr) { $dstaddr = $FilterIflist[$natif]['ip']; } diff --git a/config/openvpn-client-export/openvpn-client-export.xml b/config/openvpn-client-export/openvpn-client-export.xml index a9630730..1a150dc5 100755 --- a/config/openvpn-client-export/openvpn-client-export.xml +++ b/config/openvpn-client-export/openvpn-client-export.xml @@ -44,7 +44,7 @@ ]]> </copyright> <name>OpenVPN Client Export</name> - <version>1.2.17</version> + <version>1.2.19</version> <title>OpenVPN Client Export</title> <include_file>/usr/local/pkg/openvpn-client-export.inc</include_file> <tabs> @@ -65,7 +65,7 @@ </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <item>https://files.pfsense.org/packages/openvpn-client-export/openvpn-client-export-2.3.6.tgz</item> + <item>https://files.pfsense.org/packages/openvpn-client-export/openvpn-client-export-2.3.8.tgz</item> <do_not_add_to_port/> </additional_files_needed> <additional_files_needed> diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index a445e986..246e7421 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -40,40 +40,48 @@ global $current_openvpn_version, $current_openvpn_version_rev; $pgtitle = array("OpenVPN", "Client Export Utility"); -if (!is_array($config['openvpn']['openvpn-server'])) +if (!is_array($config['openvpn']['openvpn-server'])) { $config['openvpn']['openvpn-server'] = array(); +} $a_server = $config['openvpn']['openvpn-server']; -if (!is_array($config['system']['user'])) +if (!is_array($config['system']['user'])) { $config['system']['user'] = array(); +} $a_user = $config['system']['user']; -if (!is_array($config['cert'])) +if (!is_array($config['cert'])) { $config['cert'] = array(); +} $a_cert = $config['cert']; $ras_server = array(); -foreach($a_server as $sindex => $server) { - if (isset($server['disable'])) +foreach ($a_server as $sindex => $server) { + if (isset($server['disable'])) { continue; + } $ras_user = array(); $ras_certs = array(); - if (stripos($server['mode'], "server") === false) + if (stripos($server['mode'], "server") === false) { continue; + } if (($server['mode'] == "server_tls_user") && ($server['authmode'] == "Local Database")) { - foreach($a_user as $uindex => $user) { - if (!is_array($user['cert'])) + foreach ($a_user as $uindex => $user) { + if (!is_array($user['cert'])) { continue; - foreach($user['cert'] as $cindex => $cert) { + } + foreach ($user['cert'] as $cindex => $cert) { // If $cert is not an array, it's a certref not a cert. - if (!is_array($cert)) + if (!is_array($cert)) { $cert = lookup_cert($cert); + } - if ($cert['caref'] != $server['caref']) + if ($cert['caref'] != $server['caref']) { continue; + } $ras_userent = array(); $ras_userent['uindex'] = $uindex; $ras_userent['cindex'] = $cindex; @@ -83,9 +91,10 @@ foreach($a_server as $sindex => $server) { } } } elseif (($server['mode'] == "server_tls") || (($server['mode'] == "server_tls_user") && ($server['authmode'] != "Local Database"))) { - foreach($a_cert as $cindex => $cert) { - if (($cert['caref'] != $server['caref']) || ($cert['refid'] == $server['certref'])) + foreach ($a_cert as $cindex => $cert) { + if (($cert['caref'] != $server['caref']) || ($cert['refid'] == $server['certref'])) { continue; + } $ras_cert_entry['cindex'] = $cindex; $ras_cert_entry['certname'] = $cert['descr']; $ras_cert_entry['certref'] = $cert['refid']; @@ -96,10 +105,11 @@ foreach($a_server as $sindex => $server) { $ras_serverent = array(); $prot = $server['protocol']; $port = $server['local_port']; - if ($server['description']) + if ($server['description']) { $name = "{$server['description']} {$prot}:{$port}"; - else + } else { $name = "Server {$prot}:{$port}"; + } $ras_serverent['index'] = $sindex; $ras_serverent['name'] = $name; $ras_serverent['users'] = $ras_user; @@ -109,12 +119,14 @@ foreach($a_server as $sindex => $server) { } $id = $_GET['id']; -if (isset($_POST['id'])) +if (isset($_POST['id'])) { $id = $_POST['id']; +} $act = $_GET['act']; -if (isset($_POST['act'])) +if (isset($_POST['act'])) { $act = $_POST['act']; +} if (!empty($act)) { @@ -125,19 +137,21 @@ if (!empty($act)) { pfSenseHeader("vpn_openvpn_export.php"); exit; } else if (($config['openvpn']['openvpn-server'][$srvid]['mode'] != "server_user") && - (($usrid === false) || ($crtid === false))) { + (($usrid === false) || ($crtid === false))) { pfSenseHeader("vpn_openvpn_export.php"); exit; } - if ($config['openvpn']['openvpn-server'][$srvid]['mode'] == "server_user") + if ($config['openvpn']['openvpn-server'][$srvid]['mode'] == "server_user") { $nokeys = true; - else + } else { $nokeys = false; + } $useaddr = ''; - if (isset($_GET['useaddr']) && !empty($_GET['useaddr'])) + if (isset($_GET['useaddr']) && !empty($_GET['useaddr'])) { $useaddr = trim($_GET['useaddr']); + } if (!(is_ipaddr($useaddr) || is_hostname($useaddr) || in_array($useaddr, array("serveraddr", "servermagic", "servermagichost", "serverhostname")))) { @@ -192,10 +206,10 @@ if (!empty($act)) { $exp_name = openvpn_client_export_prefix($srvid, $usrid, $crtid); - if(substr($act, 0, 4) == "conf") { + if (substr($act, 0, 4) == "conf") { switch ($act) { case "confzip": - $exp_name = urlencode($exp_name."-config.zip"); + $exp_name = urlencode($exp_name . "-config.zip"); $expformat = "zip"; break; case "conf_yealink_t28": @@ -215,30 +229,30 @@ if (!empty($act)) { $expformat = "snom"; break; case "confinline": - $exp_name = urlencode($exp_name."-config.ovpn"); + $exp_name = urlencode($exp_name . "-config.ovpn"); $expformat = "inline"; break; case "confinlinedroid": - $exp_name = urlencode($exp_name."-android-config.ovpn"); + $exp_name = urlencode($exp_name . "-android-config.ovpn"); $expformat = "inlinedroid"; break; case "confinlineios": - $exp_name = urlencode($exp_name."-ios-config.ovpn"); + $exp_name = urlencode($exp_name . "-ios-config.ovpn"); $expformat = "inlineios"; break; default: - $exp_name = urlencode($exp_name."-config.ovpn"); + $exp_name = urlencode($exp_name . "-config.ovpn"); $expformat = "baseconf"; } $exp_path = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $nokeys, $proxy, $expformat, $password, false, false, $openvpnmanager, $advancedoptions); } - if($act == "visc") { - $exp_name = urlencode($exp_name."-Viscosity.visc.zip"); + if ($act == "visc") { + $exp_name = urlencode($exp_name . "-Viscosity.visc.zip"); $exp_path = viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $password, $proxy, $openvpnmanager, $advancedoptions); } - if(substr($act, 0, 4) == "inst") { + if (substr($act, 0, 4) == "inst") { $exp_name = urlencode($exp_name."-install.exe"); $exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $verifyservercn, $randomlocalport, $usetoken, $password, $proxy, $openvpnmanager, $advancedoptions, substr($act, 5)); } @@ -316,8 +330,9 @@ function download_begin(act, i, j) { return; } useaddr = document.getElementById("useaddr_hostname").value; - } else + } else { useaddr = document.getElementById("useaddr").value; + } advancedoptions = document.getElementById("advancedoptions").value; @@ -325,21 +340,25 @@ function download_begin(act, i, j) { verifyservercn = document.getElementById("verifyservercn").value; var randomlocalport = 0; - if (document.getElementById("randomlocalport").checked) + if (document.getElementById("randomlocalport").checked) { randomlocalport = 1; + } var usetoken = 0; - if (document.getElementById("usetoken").checked) + if (document.getElementById("usetoken").checked) { usetoken = 1; + } var usepass = 0; - if (document.getElementById("usepass").checked) + if (document.getElementById("usepass").checked) { usepass = 1; + } var openvpnmanager = 0; - if (document.getElementById("openvpnmanager").checked) + if (document.getElementById("openvpnmanager").checked) { openvpnmanager = 1; + } var pass = document.getElementById("pass").value; var conf = document.getElementById("conf").value; - if (usepass && (act.substring(0,4) == "inst")) { + if (usepass && (act.substring(0, 4) == "inst")) { if (!pass || !conf) { alert("The password or confirm field is empty"); return; @@ -352,8 +371,9 @@ function download_begin(act, i, j) { var useproxy = 0; var useproxypass = 0; - if (document.getElementById("useproxy").checked) + if (document.getElementById("useproxy").checked) { useproxy = 1; + } var proxyaddr = document.getElementById("proxyaddr").value; var proxyport = document.getElementById("proxyport").value; @@ -363,8 +383,9 @@ function download_begin(act, i, j) { return; } - if (document.getElementById("useproxypass").value != 'none') + if (document.getElementById("useproxypass").value != 'none') { useproxypass = 1; + } var proxytype = document.getElementById("useproxytype").value; @@ -404,8 +425,9 @@ function download_begin(act, i, j) { dlurl += "&randomlocalport=" + escape(randomlocalport); dlurl += "&openvpnmanager=" + escape(openvpnmanager); dlurl += "&usetoken=" + escape(usetoken); - if (usepass) + if (usepass) { dlurl += "&password=" + escape(pass); + } if (useproxy) { dlurl += "&proxy_type=" + escape(proxytype); dlurl += "&proxy_addr=" + escape(proxyaddr); @@ -419,19 +441,20 @@ function download_begin(act, i, j) { dlurl += "&advancedoptions=" + escape(advancedoptions); - window.open(dlurl,"_self"); + window.open(dlurl, "_self"); } function server_changed() { var table = document.getElementById("users"); - while (table.rows.length > 1 ) + while (table.rows.length > 1 ) { table.deleteRow(1); + } var index = document.getElementById("server").selectedIndex; var users = servers[index][1]; var certs = servers[index][3]; - for (i=0; i < users.length; i++) { + for (i = 0; i < users.length; i++) { var row = table.insertRow(table.rows.length); var cell0 = row.insertCell(0); var cell1 = row.insertCell(1); @@ -462,11 +485,11 @@ function server_changed() { cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x86-win6\"," + i + ", -1)'>x86-win6<\/a>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x64-win6\"," + i + ", -1)'>x64-win6<\/a>"; - cell2.innerHTML += "<br\/>- Mac OSX:<br\/>"; + cell2.innerHTML += "<br\/>- Mac OS X:<br\/>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"visc\"," + i + ", -1)'>Viscosity Bundle<\/a>"; } - for (j=0; j < certs.length; j++) { + for (j = 0; j < certs.length; j++) { var row = table.insertRow(table.rows.length); var cell0 = row.insertCell(0); var cell1 = row.insertCell(1); @@ -501,7 +524,7 @@ function server_changed() { cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x86-win6\", -1," + j + ")'>x86-win6<\/a>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x64-win6\", -1," + j + ")'>x64-win6<\/a>"; - cell2.innerHTML += "<br\/>- Mac OSX:<br\/>"; + cell2.innerHTML += "<br\/>- Mac OS X:<br\/>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"visc\", -1," + j + ")'>Viscosity Bundle<\/a>"; if (servers[index][2] == "server_tls") { @@ -547,7 +570,7 @@ function server_changed() { cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x86-win6\"," + i + ")'>x86-win6<\/a>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"inst-x64-win6\"," + i + ")'>x64-win6<\/a>"; - cell2.innerHTML += "<br\/>- Mac OSX:<br\/>"; + cell2.innerHTML += "<br\/>- Mac OS X:<br\/>"; cell2.innerHTML += " "; cell2.innerHTML += "<a href='javascript:download_begin(\"visc\"," + i + ")'>Viscosity Bundle<\/a>"; } @@ -555,25 +578,27 @@ function server_changed() { function useaddr_changed(obj) { - if (obj.value == "other") + if (obj.value == "other") { $('HostName').show(); - else + } else { $('HostName').hide(); + } } function usepass_changed() { - if (document.getElementById("usepass").checked) + if (document.getElementById("usepass").checked) { document.getElementById("usepass_opts").style.display = ""; - else + } else { document.getElementById("usepass_opts").style.display = "none"; + } } function useproxy_changed(obj) { if ((obj.id == "useproxy" && obj.checked) || - (obj.id == "useproxypass" && (obj.value != 'none'))) { + (obj.id == "useproxypass" && (obj.value != 'none'))) { $(obj.id + '_opts').show(); } else { $(obj.id + '_opts').hide(); @@ -590,7 +615,7 @@ function useproxy_changed(obj) { } ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="openvpn export"> - <tr> + <tr> <td> <?php $tab_array = array(); @@ -612,7 +637,7 @@ function useproxy_changed(obj) { <td width="22%" valign="top" class="vncellreq">Remote Access Server</td> <td width="78%" class="vtable"> <select name="server" id="server" class="formselect" onchange="server_changed()"> - <?php foreach($ras_server as & $server): ?> + <?php foreach ($ras_server as & $server): ?> <option value="<?=$server['index'];?>"><?=$server['name'];?></option> <?php endforeach; ?> </select> @@ -914,8 +939,8 @@ function useproxy_changed(obj) { <br/><a href="https://play.google.com/store/apps/details?id=de.blinkt.openvpn"><?= gettext("OpenVPN For Android") ?></a> - <?=gettext("Recommended client for Android")?> <br/><a href="http://www.featvpn.com/"><?= gettext("FEAT VPN For Android") ?></a> - <?=gettext("For older versions of Android")?> <br/><?= gettext("OpenVPN Connect") ?>: <a href="https://play.google.com/store/apps/details?id=net.openvpn.openvpn"><?=gettext("Android (Google Play)")?></a> or <a href="https://itunes.apple.com/us/app/openvpn-connect/id590379981"><?=gettext("iOS (App Store)")?></a> - <?= gettext("Recommended client for iOS") ?> - <br/><a href="http://www.sparklabs.com/viscosity/"><?= gettext("Viscosity") ?></a> - <?= gettext("Recommended client for Mac OSX") ?> - <br/><a href="http://code.google.com/p/tunnelblick/"><?= gettext("Tunnelblick") ?></a> - <?= gettext("Free client for OSX") ?> + <br/><a href="https://www.sparklabs.com/viscosity/"><?= gettext("Viscosity") ?></a> - <?= gettext("Recommended client for Mac OS X") ?> + <br/><a href="https://tunnelblick.net"><?= gettext("Tunnelblick") ?></a> - <?= gettext("Free client for OS X") ?> </td> </tr> </table> diff --git a/config/openvpn-client-export/vpn_openvpn_export_shared.php b/config/openvpn-client-export/vpn_openvpn_export_shared.php index 630bb253..5810e97b 100644 --- a/config/openvpn-client-export/vpn_openvpn_export_shared.php +++ b/config/openvpn-client-export/vpn_openvpn_export_shared.php @@ -1,22 +1,22 @@ -<?php +<?php /* vpn_openvpn_export_shared.php part of pfSense (http://www.pfSense.org) Copyright (C) 2008 Shrew Soft Inc. Copyright (C) 2010 Ermal Luçi Copyright (C) 2011-2015 ESF, LLC - All rights reserved. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -44,7 +44,7 @@ if (!is_array($config['openvpn']['openvpn-server'])) { $a_server = $config['openvpn']['openvpn-server']; $ras_server = array(); -foreach($a_server as $sindex => $server) { +foreach ($a_server as $sindex => $server) { if (isset($server['disable'])) { continue; } @@ -57,8 +57,7 @@ foreach($a_server as $sindex => $server) { $port = $server['local_port']; if ($server['description']) { $name = "{$server['description']} {$prot}:{$port}"; - } - else { + } else { $name = "Shared Key Server {$prot}:{$port}"; } $ras_serverent['index'] = $sindex; @@ -79,7 +78,7 @@ if (isset($_POST['act'])) { $error = false; -if(($act == "skconf") || ($act == "skzipconf")) { +if (($act == "skconf") || ($act == "skzipconf")) { $srvid = $_GET['srvid']; if (($srvid === false) || ($config['openvpn']['openvpn-server'][$srvid]['mode'] != "p2p_shared_key")) { pfSenseHeader("vpn_openvpn_export.php"); @@ -189,13 +188,15 @@ function download_begin(act) { return; } useaddr = document.getElementById("useaddr_hostname").value; - } else + } else { useaddr = document.getElementById("useaddr").value; + } var useproxy = 0; var useproxypass = 0; - if (document.getElementById("useproxy").checked) + if (document.getElementById("useproxy").checked) { useproxy = 1; + } var proxyaddr = document.getElementById("proxyaddr").value; var proxyport = document.getElementById("proxyport").value; @@ -205,8 +206,9 @@ function download_begin(act) { return; } - if (document.getElementById("useproxypass").value != 'none') + if (document.getElementById("useproxypass").value != 'none') { useproxypass = 1; + } var proxytype = document.getElementById("useproxytype").value; @@ -245,14 +247,15 @@ function download_begin(act) { } } - window.open(dlurl,"_self"); + window.open(dlurl, "_self"); } function server_changed() { var table = document.getElementById("clients"); - while (table.rows.length > 1 ) + while (table.rows.length > 1 ) { table.deleteRow(1); + } var index = document.getElementById("server").selectedIndex; @@ -271,17 +274,18 @@ function server_changed() { function useaddr_changed(obj) { - if (obj.value == "other") + if (obj.value == "other") { $('HostName').show(); - else + } else { $('HostName').hide(); - + } + } function useproxy_changed(obj) { if ((obj.id == "useproxy" && obj.checked) || - (obj.id == "useproxypass" && (obj.value != 'none'))) { + (obj.id == "useproxypass" && (obj.value != 'none'))) { $(obj.id + '_opts').show(); } else { $(obj.id + '_opts').hide(); @@ -298,9 +302,9 @@ function useproxy_changed(obj) { } ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="openvpn export shared"> - <tr> + <tr> <td> - <?php + <?php $tab_array = array(); $tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php"); $tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php"); @@ -320,7 +324,7 @@ function useproxy_changed(obj) { <td width="22%" valign="top" class="vncellreq">Shared Key Server</td> <td width="78%" class="vtable"> <select name="server" id="server" class="formselect" onchange="server_changed()"> - <?php foreach($ras_server as & $server): ?> + <?php foreach ($ras_server as & $server): ?> <option value="<?=$server['sindex'];?>"><?=$server['name'];?></option> <?php endforeach; ?> </select> @@ -406,7 +410,7 @@ function useproxy_changed(obj) { </tr> <tr> <td width="25%"> - <br /> + <br /> </td> <td> <select name="useproxypass" id="useproxypass" class="formselect" onchange="useproxy_changed(this)"> @@ -417,39 +421,39 @@ function useproxy_changed(obj) { <span class="vexpl"> Choose proxy authentication if any. </span> - <br /> - <table border="0" cellpadding="2" cellspacing="0" id="useproxypass_opts" style="display:none" summary="name and password"> - <tr> - <td align="right" width="25%"> - <span class="vexpl"> - Username : - </span> - </td> - <td> - <input name="proxyuser" id="proxyuser" class="formfld unknown" size="20" value="" /> - </td> - </tr> - <tr> - <td align="right" width="25%"> - <span class="vexpl"> - Password : - </span> - </td> - <td> - <input name="proxypass" id="proxypass" type="password" class="formfld pwd" size="20" value="" /> - </td> - </tr> - <tr> - <td align="right" width="25%"> - <span class="vexpl"> - Confirm : - </span> - </td> - <td> - <input name="proxyconf" id="proxyconf" type="password" class="formfld pwd" size="20" value="" /> - </td> - </tr> - </table> + <br /> + <table border="0" cellpadding="2" cellspacing="0" id="useproxypass_opts" style="display:none" summary="name and password"> + <tr> + <td align="right" width="25%"> + <span class="vexpl"> + Username : + </span> + </td> + <td> + <input name="proxyuser" id="proxyuser" class="formfld unknown" size="20" value="" /> + </td> + </tr> + <tr> + <td align="right" width="25%"> + <span class="vexpl"> + Password : + </span> + </td> + <td> + <input name="proxypass" id="proxypass" type="password" class="formfld pwd" size="20" value="" /> + </td> + </tr> + <tr> + <td align="right" width="25%"> + <span class="vexpl"> + Confirm : + </span> + </td> + <td> + <input name="proxyconf" id="proxyconf" type="password" class="formfld pwd" size="20" value="" /> + </td> + </tr> + </table> </td> </tr> </table> diff --git a/config/servicewatchdog/services_servicewatchdog.php b/config/servicewatchdog/services_servicewatchdog.php index bd4d4442..6c91b98e 100644 --- a/config/servicewatchdog/services_servicewatchdog.php +++ b/config/servicewatchdog/services_servicewatchdog.php @@ -41,14 +41,16 @@ require_once("functions.inc"); require_once("service-utils.inc"); require_once("servicewatchdog.inc"); -if (!is_array($config['installedpackages']['servicewatchdog']['item'])) +if (!is_array($config['installedpackages']['servicewatchdog']['item'])) { $config['installedpackages']['servicewatchdog']['item'] = array(); +} $a_pwservices = &$config['installedpackages']['servicewatchdog']['item']; /* if a custom message has been passed along, lets process it */ -if ($_GET['savemsg']) +if ($_GET['savemsg']) { $savemsg = $_GET['savemsg']; +} if ($_GET['act'] == "del") { if ($a_pwservices[$_GET['id']]) { @@ -65,13 +67,15 @@ if (isset($_POST['Update'])) { if (is_array($_POST['notifies']) && count($_POST['notifies'])) { /* Check each service and set the notify flag only for those chosen, remove those that are unset. */ foreach ($a_pwservices as $idx => $thisservice) { - if (!is_array($thisservice)) + if (!is_array($thisservice)) { continue; + } if (in_array($idx, $_POST['notifies'])) { $a_pwservices[$idx]['notify'] = true; } else { - if (isset($a_pwservices[$idx]['notify'])) + if (isset($a_pwservices[$idx]['notify'])) { unset($a_pwservices[$idx]['notify']); + } } } } else { /* No notifies selected, remove them all. */ @@ -111,26 +115,31 @@ if (isset($_POST['del_x'])) { /* copy all services < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { - if (!in_array($i, $_POST['pwservices'])) + if (!in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } /* copy all selected services */ for ($i = 0; $i < count($a_pwservices); $i++) { - if ($i == $movebtn) + if ($i == $movebtn) { continue; - if (in_array($i, $_POST['pwservices'])) + } + if (in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } /* copy $movebtn service */ - if ($movebtn < count($a_pwservices)) + if ($movebtn < count($a_pwservices)) { $a_pwservices_new[] = $a_pwservices[$movebtn]; + } /* copy all services > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_pwservices); $i++) { - if (!in_array($i, $_POST['pwservices'])) + if (!in_array($i, $_POST['pwservices'])) { $a_pwservices_new[] = $a_pwservices[$i]; + } } $a_pwservices = $a_pwservices_new; servicewatchdog_cron_job(); @@ -141,7 +150,7 @@ if (isset($_POST['del_x'])) { } $closehead = false; -$pgtitle = array(gettext("Services"),gettext("Service Watchdog")); +$pgtitle = array(gettext("Services"), gettext("Service Watchdog")); include("head.inc"); ?> @@ -160,83 +169,99 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="services to monitor"> <tr><td><div id="mainarea"> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area"> -<tr><td colspan="8" align="center"> -<?php echo gettext("This page allows you to select services to be monitored so that they may be automatically restarted if they crash or are stopped."); ?> -<br/><br/> -</td></tr> -<tr id="frheader"> -<td width="5%" class="list"> </td> -<td width="5%" class="listhdrr">Notify</td> -<td width="30%" class="listhdrr"><?=gettext("Service Name");?></td> -<td width="60%" class="listhdrr"><?=gettext("Description");?></td> -<td width="5%" class="list"> -<table border="0" cellspacing="0" cellpadding="1" summary="buttons"> - <tr><td width="17"> - <?php if (count($a_pwservices) == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected services");?>" border="0" alt="delete" /> - <?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" /> - <?php endif; ?> - </td> - <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td> + <tr> + <td colspan="8" align="center"> + <?php echo gettext("This page allows you to select services to be monitored so that they may be automatically restarted if they crash or are stopped."); ?> + <br/><br/> + </td> + </tr> + <tr id="frheader"> + <td width="5%" class="list"> </td> + <td width="5%" class="listhdrr">Notify</td> + <td width="30%" class="listhdrr"><?=gettext("Service Name");?></td> + <td width="60%" class="listhdrr"><?=gettext("Description");?></td> + <td width="5%" class="list"> + <table border="0" cellspacing="0" cellpadding="1" summary="buttons"> + <tr> + <td width="17"> + <?php if (count($a_pwservices) == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected services");?>" border="0" alt="delete" /> + <?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" /> + <?php endif; ?> + </td> + <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td> + </tr> + </table> + </td> </tr> -</table> -</td> -</tr> <?php $nservices = $i = 0; foreach ($a_pwservices as $thisservice): ?> <tr valign="top" id="fr<?=$nservices;?>"> - <td class="listt"><input type="checkbox" id="frc<?=$nservices;?>" name="pwservices[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nservices;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td> - <td class="listlr"><input type="checkbox" id="notify<?=$nservices;?>" name="notifies[]" value="<?=$i;?>" style="margin: 0; padding: 0; width: 15px; height: 15px;" <?PHP if (isset($thisservice['notify'])) echo 'checked="CHECKED"';?>/></td> - <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';"> - <?=$thisservice['name'];?> - </td> - <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';"> - <?=$thisservice['description'];?> - </td> - <td valign="middle" class="list" nowrap> - <table border="0" cellspacing="0" cellpadding="1" summary="add"> - <tr> - <td><input onmouseover="fr_insline(<?=$nservices;?>, true)" onmouseout="fr_insline(<?=$nservices;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected services before this service");?>" height="17" type="image" width="17" border="0" /></td> - <td align="center" valign="middle"><a href="services_servicewatchdog.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this service?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete service");?>" alt="delete" /></a></td> - </tr> - </table> - </td></tr> -<?php $i++; $nservices++; endforeach; ?> - <tr> - <td class="list" colspan="4"></td> - <td class="list" valign="middle" nowrap> - <table border="0" cellspacing="0" cellpadding="1" summary="add"> + <td class="listt"><input type="checkbox" id="frc<?=$nservices;?>" name="pwservices[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nservices;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td> + <td class="listlr"><input type="checkbox" id="notify<?=$nservices;?>" name="notifies[]" value="<?=$i;?>" style="margin: 0; padding: 0; width: 15px; height: 15px;" <?PHP if (isset($thisservice['notify'])) echo 'checked="CHECKED"';?>/></td> + <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';"> + <?=$thisservice['name'];?> + </td> + <td class="listr" onclick="fr_toggle(<?=$nservices;?>)" id="frd<?=$nservices;?>" ondblclick="document.location='services_servicewatchdog_add.php?id=<?=$nservices;?>';"> + <?=$thisservice['description'];?> + </td> + <td valign="middle" class="list" nowrap> + <table border="0" cellspacing="0" cellpadding="1" summary="add"> + <tr> + <td><input onmouseover="fr_insline(<?=$nservices;?>, true)" onmouseout="fr_insline(<?=$nservices;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected services before this service");?>" height="17" type="image" width="17" border="0" /></td> + <td align="center" valign="middle"><a href="services_servicewatchdog.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this service?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete service");?>" alt="delete" /></a></td> + </tr> + </table> + </td> + </tr> +<?php + $i++; + $nservices++; +endforeach; +?> <tr> - <td><?php if ($nservices == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected services to end"); ?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected services to end");?>" border="0" alt="move" /><?php endif; ?></td> + <td class="list" colspan="4"></td> + <td class="list" valign="middle" nowrap> + <table border="0" cellspacing="0" cellpadding="1" summary="add"> + <tr> + <td><?php if ($nservices == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected services to end"); ?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected services to end");?>" border="0" alt="move" /><?php endif; ?></td> + </tr> + <tr> + <td width="17"> + <?php if (count($a_pwservices) == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected services");?>" border="0" alt="delete" /> + <?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" /> + <?php endif; ?> + </td> + <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td> + </tr> + </table> + </td> </tr> <tr> - <td width="17"> - <?php if (count($a_pwservices) == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected services");?>" border="0" alt="delete" /> - <?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected services"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected services?");?>')" /> - <?php endif; ?> - </td> - <td><a href="services_servicewatchdog_add.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new service"); ?>" alt="add" /></a></td> + <td></td> + <td colspan="4"> + <?php echo gettext("Check Notify next to services to perform an e-mail notification when the service is restarted. Configure e-mail notifications to receive the alerts."); ?> + <br/> + <input name="Update" type="submit" class="formbtn" value="<?=gettext("Update Notification Settings"); ?>" /> + <br/> + <br/> + </td> + <td></td> </tr> - </table> - </td> + <tr> + <td></td> + <td colspan="4"> + <?php echo gettext("Click to select a service and use the arrows to re-order them in the list. Higher services are checked first."); ?> + </td> + <td></td> </tr> - <tr><td></td><td colspan="4"> - <?php echo gettext("Check Notify next to services to perform an e-mail notification when the service is restarted. Configure e-mail notifications to receive the alerts."); ?> - <br/> - <input name="Update" type="submit" class="formbtn" value="<?=gettext("Update Notification Settings"); ?>" /> - <br/> - <br/> - </td><td></td></tr> - <tr><td></td><td colspan="4"> - <?php echo gettext("Click to select a service and use the arrows to re-order them in the list. Higher services are checked first."); ?> - </td><td></td></tr> - </table> +</table> </div></td></tr> </table> </form> diff --git a/config/servicewatchdog/services_servicewatchdog_add.php b/config/servicewatchdog/services_servicewatchdog_add.php index 11e5e284..10f24797 100644 --- a/config/servicewatchdog/services_servicewatchdog_add.php +++ b/config/servicewatchdog/services_servicewatchdog_add.php @@ -55,7 +55,7 @@ unset($input_errors); if ($_POST) { if (!is_numeric($_POST['svcid'])) - + return; if (!isset($system_services[$_POST['svcid']])) { $input_errors[] = gettext("The supplied service appears to be invalid."); @@ -72,7 +72,7 @@ if ($_POST) { } $closehead = false; -$pgtitle = array(gettext("Services"),gettext("servicewatchdog"), gettext("Add")); +$pgtitle = array(gettext("Services"), gettext("servicewatchdog"), gettext("Add")); include("head.inc"); ?> diff --git a/config/servicewatchdog/servicewatchdog.inc b/config/servicewatchdog/servicewatchdog.inc index 5b638836..817b92e0 100644 --- a/config/servicewatchdog/servicewatchdog.inc +++ b/config/servicewatchdog/servicewatchdog.inc @@ -7,23 +7,27 @@ require_once("notices.inc"); function servicewatchdog_service_matches($svc1, $svc2) { /* If the arrays are equal, it must be the same service. */ - if ($svc1 == $svc2) + if ($svc1 == $svc2) { return true; + } /* If the names are different, they must not be the same. */ - if ($svc1['name'] != $svc2['name']) + if ($svc1['name'] != $svc2['name']) { return false; + } switch ($svc1['name']) { case "openvpn": - if (($svc1['mode'] == $svc2['mode']) && ($svc1['vpnid'] == $svc2['vpnid'])) + if (($svc1['mode'] == $svc2['mode']) && ($svc1['vpnid'] == $svc2['vpnid'])) { return true; - else + } else { return false; + } break; case "captiveportal": - if ($svc1['zone'] == $svc2['zone']) + if ($svc1['zone'] == $svc2['zone']) { return true; - else + } else { return false; + } break; default: /* Other services must be the same if the name matches. */ @@ -39,12 +43,14 @@ function servicewatchdog_is_service_watched($svc) { $a_pwservices = &$config['installedpackages']['servicewatchdog']['item']; $blacklisted_services = array("cron"); - if (empty($svc['name']) || in_array($svc['name'], $blacklisted_services)) + if (empty($svc['name']) || in_array($svc['name'], $blacklisted_services)) { return true; + } foreach ($a_pwservices as $a_svc) { - if (servicewatchdog_service_matches($svc, $a_svc)) + if (servicewatchdog_service_matches($svc, $a_svc)) { return true; + } } return false; } @@ -77,8 +83,9 @@ function servicewatchdog_check_services() { $descr = strlen($svc['description']) > 50 ? substr($svc['description'], 0, 50) . "..." : $svc['description']; $error_message = "Service Watchdog detected service {$svc['name']} stopped. Restarting {$svc['name']} ({$descr})"; log_error($error_message); - if (isset($svc['notify'])) + if (isset($svc['notify'])) { notify_via_smtp($error_message); + } service_control_start($svc['name'], $svc); } } diff --git a/config/servicewatchdog/servicewatchdog.xml b/config/servicewatchdog/servicewatchdog.xml index 685ba997..5a1aebbb 100644 --- a/config/servicewatchdog/servicewatchdog.xml +++ b/config/servicewatchdog/servicewatchdog.xml @@ -40,7 +40,7 @@ <requirements>None</requirements> <faq>Monitors for stopped services and restarts them.</faq> <name>Service Watchdog</name> - <version>1.6</version> + <version>1.7</version> <title>Services: Service Watchdog</title> <include_file>/usr/local/pkg/servicewatchdog.inc</include_file> <menu> diff --git a/config/servicewatchdog/servicewatchdog_cron.php b/config/servicewatchdog/servicewatchdog_cron.php index 004afd97..9979917e 100644 --- a/config/servicewatchdog/servicewatchdog_cron.php +++ b/config/servicewatchdog/servicewatchdog_cron.php @@ -6,8 +6,9 @@ require_once("servicewatchdog.inc"); global $g; /* Do nothing at bootup. */ -if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) +if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) { return; +} servicewatchdog_check_services(); ?>
\ No newline at end of file diff --git a/config/sudo/sudo.inc b/config/sudo/sudo.inc index ed0feb9c..ccbda309 100644 --- a/config/sudo/sudo.inc +++ b/config/sudo/sudo.inc @@ -30,7 +30,7 @@ require_once("config.inc"); global $pfs_version; -$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); +$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3); switch ($pfs_version) { case "2.1": /* Hackish way to detect if someone manually did pkg_add rather than use pbi. */ @@ -38,7 +38,7 @@ switch ($pfs_version) { define('SUDO_BASE', '/usr/pbi/sudo-' . php_uname("m")); define('SUDO_LIBEXEC_DIR', '/usr/local/libexec/'); } else { - define('SUDO_BASE','/usr/local'); + define('SUDO_BASE', '/usr/local'); define('SUDO_LIBEXEC_DIR', '/usr/local/libexec/sudo'); } break; @@ -66,17 +66,17 @@ function sudo_install() { if (!is_array($config['installedpackages']['sudo']['config'][0]['row'])) { $config['installedpackages']['sudo']['config'][0]['row'] = array( 0 => array( - "username" => "user:root", + "username" => "user:root", "runas" => "user:root", "cmdlist" => "ALL" ), 1 => array( - "username" => "user:admin", + "username" => "user:admin", "runas" => "user:root", "cmdlist" => "ALL" ), 2 => array( - "username" => "group:admins", + "username" => "group:admins", "runas" => "user:root", "cmdlist" => "ALL" ) @@ -196,7 +196,7 @@ This also forces the user to give full paths to executables, which they should b */ function sudo_validate_commands(&$input_errors) { $idx = 0; - while(isset($_POST["cmdlist{$idx}"])) { + while (isset($_POST["cmdlist{$idx}"])) { $commands = $_POST["cmdlist" . $idx++]; if (strtoupper($commands) == "ALL") { continue; diff --git a/config/sudo/sudo.xml b/config/sudo/sudo.xml index e9b4dcbb..6124a641 100644 --- a/config/sudo/sudo.xml +++ b/config/sudo/sudo.xml @@ -42,7 +42,7 @@ <description>Sudo Command Control</description> <requirements>None</requirements> <name>sudo</name> - <version>0.2.6</version> + <version>0.2.7</version> <title>Sudo - Shell Command Privilege Delegation Utility</title> <include_file>/usr/local/pkg/sudo.inc</include_file> <menu> diff --git a/config/systempatches/patches.inc b/config/systempatches/patches.inc index 60c9a391..f47324c4 100644 --- a/config/systempatches/patches.inc +++ b/config/systempatches/patches.inc @@ -55,10 +55,11 @@ function patch_commit($patch, $action, $test=false, $fulldetail=false) { $full_patch_command = "{$patch_cmd} --directory={$directory} {$force} {$pathstrip} {$filename} {$check} {$direction} {$whitespace}"; conf_mount_rw(); patch_write($patch); - if (!$fulldetail) + if (!$fulldetail) { $output = (mwexec($full_patch_command, true) == 0); - else + } else { $output = $full_patch_command . "\n\n" . shell_exec($full_patch_command . ' 2>&1'); + } patch_erase($patch); conf_mount_ro(); return $output; @@ -158,8 +159,9 @@ function bootup_apply_patches() { foreach ($a_patches as $patch) { /* Skip the patch if it should not be automatically applied. */ - if (!isset($patch['autoapply'])) + if (!isset($patch['autoapply'])) { continue; + } /* If the patch can be reverted it is already applied, so skip it. */ if (!patch_test_revert($patch)) { /* Only attempt to apply if it can be applied. */ @@ -173,12 +175,15 @@ function bootup_apply_patches() { function patch_add_shellcmd() { global $config; $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if (!is_array($a_earlyshellcmd)) + if (!is_array($a_earlyshellcmd)) { $a_earlyshellcmd = array(); + } $found = false; - foreach ($a_earlyshellcmd as $idx => $cmd) - if (stristr($cmd, "apply_patches.php")) + foreach ($a_earlyshellcmd as $idx => $cmd) { + if (stristr($cmd, "apply_patches.php")) { $found = true; + } + } if (!$found) { $a_earlyshellcmd[] = "/usr/local/bin/php -f /usr/local/bin/apply_patches.php"; write_config("System Patches package added a shellcmd"); @@ -188,8 +193,9 @@ function patch_add_shellcmd() { function patch_remove_shellcmd() { global $config; $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if (!is_array($a_earlyshellcmd)) + if (!is_array($a_earlyshellcmd)) { $a_earlyshellcmd = array(); + } $removed = false; foreach ($a_earlyshellcmd as $idx => $cmd) { if (stristr($cmd, "apply_patches.php")) { @@ -197,8 +203,9 @@ function patch_remove_shellcmd() { $removed = true; } } - if ($removed) + if ($removed) { write_config("System Patches package removed a shellcmd"); + } } ?> diff --git a/config/systempatches/system_patches.php b/config/systempatches/system_patches.php index 43c8c22b..feeee07e 100644 --- a/config/systempatches/system_patches.php +++ b/config/systempatches/system_patches.php @@ -41,14 +41,16 @@ require_once("functions.inc"); require_once("itemid.inc"); require_once("patches.inc"); -if (!is_array($config['installedpackages']['patches']['item'])) +if (!is_array($config['installedpackages']['patches']['item'])) { $config['installedpackages']['patches']['item'] = array(); +} $a_patches = &$config['installedpackages']['patches']['item']; /* if a custom message has been passed along, lets process it */ -if ($_GET['savemsg']) +if ($_GET['savemsg']) { $savemsg = $_GET['savemsg']; +} if ($_POST) { $pconfig = $_POST; @@ -116,26 +118,31 @@ if (isset($_POST['del_x'])) { /* copy all patches < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { - if (!in_array($i, $_POST['patch'])) + if (!in_array($i, $_POST['patch'])) { $a_patches_new[] = $a_patches[$i]; + } } /* copy all selected patches */ for ($i = 0; $i < count($a_patches); $i++) { - if ($i == $movebtn) + if ($i == $movebtn) { continue; - if (in_array($i, $_POST['patch'])) + } + if (in_array($i, $_POST['patch'])) { $a_patches_new[] = $a_patches[$i]; + } } /* copy $movebtn patch */ - if ($movebtn < count($a_patches)) + if ($movebtn < count($a_patches)) { $a_patches_new[] = $a_patches[$movebtn]; + } /* copy all patches > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_patches); $i++) { - if (!in_array($i, $_POST['patch'])) + if (!in_array($i, $_POST['patch'])) { $a_patches_new[] = $a_patches[$i]; + } } $a_patches = $a_patches_new; write_config(); @@ -164,41 +171,47 @@ include("head.inc"); <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system patches"> <tr><td><div id="mainarea"> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area"> -<tr><td colspan="8" align="center"> -<?php echo gettext("This page allows you to add patches, either from the official code repository or ones pasted in from e-mail or other sources."); ?> -<br/><br/> -<strong><?php echo gettext("Use with caution!"); ?></strong> -<br/><br/> + <tr> + <td colspan="8" align="center"> + <?php echo gettext("This page allows you to add patches, either from the official code repository or ones pasted in from e-mail or other sources."); ?> + <br/><br/> + <strong><?php echo gettext("Use with caution!"); ?></strong> + <br/><br/> <?php if (!empty($fulldetail)): ?> -</td></tr> -<tr><td></td><td colspan="7" align="left">Output of full patch <?php echo $_GET['fulltest']; ?> test: -<pre><?php echo $fulldetail; ?></pre> -<a href="system_patches.php">Close</a><br/><br/> + </td> + </tr> + <tr> + <td></td> + <td colspan="7" align="left">Output of full patch <?php echo $_GET['fulltest']; ?> test: + <pre><?php echo $fulldetail; ?></pre> + <a href="system_patches.php">Close</a><br/><br/> <?php endif; ?> -</td></tr> -<tr id="frheader"> -<td width="5%" class="list"> </td> -<td width="5%" class="listhdrr"><?=gettext("Description");?></td> -<td width="60%" class="listhdrr"><?=gettext("URL/ID");?></td> -<td width="5%" class="listhdrr"><?=gettext("Fetch");?></td> -<td width="5%" class="listhdrr"><?=gettext("Test");?></td> -<td width="5%" class="listhdrr"><?=gettext("Apply");?></td> -<td width="5%" class="listhdr"><?=gettext("Revert");?></td> -<td width="5%" class="listhdr"><?=gettext("Auto Apply");?></td> -<td width="5%" class="list"> -<table border="0" cellspacing="0" cellpadding="1" summary="buttons"> - <tr><td width="17"> - <?php if (count($a_patches) == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected patches");?>" border="0" alt="delete" /> - <?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected patches"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected patches?");?>')" /> - <?php endif; ?> - </td> - <td><a href="system_patches_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new patch"); ?>" alt="add" /></a></td> + </td> + </tr> + <tr id="frheader"> + <td width="5%" class="list"> </td> + <td width="5%" class="listhdrr"><?=gettext("Description");?></td> + <td width="60%" class="listhdrr"><?=gettext("URL/ID");?></td> + <td width="5%" class="listhdrr"><?=gettext("Fetch");?></td> + <td width="5%" class="listhdrr"><?=gettext("Test");?></td> + <td width="5%" class="listhdrr"><?=gettext("Apply");?></td> + <td width="5%" class="listhdr"><?=gettext("Revert");?></td> + <td width="5%" class="listhdr"><?=gettext("Auto Apply");?></td> + <td width="5%" class="list"> + <table border="0" cellspacing="0" cellpadding="1" summary="buttons"> + <tr> + <td width="17"> + <?php if (count($a_patches) == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected patches");?>" border="0" alt="delete" /> + <?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected patches"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected patches?");?>')" /> + <?php endif; ?> + </td> + <td><a href="system_patches_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new patch"); ?>" alt="add" /></a></td> + </tr> + </table> + </td> </tr> -</table> -</td> -</tr> <?php $npatches = $i = 0; @@ -208,83 +221,93 @@ foreach ($a_patches as $thispatch): ?> <tr valign="top" id="fr<?=$npatches;?>"> - <td class="listt"><input type="checkbox" id="frc<?=$npatches;?>" name="patch[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$npatches;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td> - <td class="listlr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?=$thispatch['descr'];?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - - <?php - if (!empty($thispatch['location'])) - echo $thispatch['location']; - elseif (!empty($thispatch['patch'])) - echo gettext("Saved Patch"); - ?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?php if (empty($thispatch['patch'])): ?> - <a href="system_patches.php?id=<?=$i;?>&act=fetch"><?php echo gettext("Fetch"); ?></a> - <?php elseif (!empty($thispatch['location'])): ?> - <a href="system_patches.php?id=<?=$i;?>&act=fetch"><?php echo gettext("Re-Fetch"); ?></a> - <?php endif; ?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?php if (!empty($thispatch['patch'])): ?> - <a href="system_patches.php?id=<?=$i;?>&act=test"><?php echo gettext("Test"); ?></a> - <?php endif; ?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?php if ($can_apply): ?> - <a href="system_patches.php?id=<?=$i;?>&act=apply"><?php echo gettext("Apply"); ?></a> - <?php endif; ?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?php if ($can_revert): ?> - <a href="system_patches.php?id=<?=$i;?>&act=revert"><?php echo gettext("Revert"); ?></a> - <?php endif; ?> - </td> - <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> - <?= isset($thispatch['autoapply']) ? "Yes" : "No" ?> - </td> - <td valign="middle" class="list" nowrap> - <table border="0" cellspacing="0" cellpadding="1" summary="edit"> - <tr> - <td><input onmouseover="fr_insline(<?=$npatches;?>, true)" onmouseout="fr_insline(<?=$npatches;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected patches before this patch");?>" height="17" type="image" width="17" border="0" /></td> - <td><a href="system_patches_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit patch"); ?>" alt="edit" /></a></td> - </tr> - <tr> - <td align="center" valign="middle"><a href="system_patches.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this patch?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete patch");?>" alt="delete" /></a></td> - <td></td> - </tr> - </table> - </td></tr> -<?php $i++; $npatches++; endforeach; ?> - <tr> - <td class="list" colspan="8"></td> - <td class="list" valign="middle" nowrap> - <table border="0" cellspacing="0" cellpadding="1" summary="edit"> - <tr> - <td><?php if ($npatches == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected patches to end"); ?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected patches to end");?>" border="0" alt="move" /><?php endif; ?></td> + <td class="listt"><input type="checkbox" id="frc<?=$npatches;?>" name="patch[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$npatches;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td> + <td class="listlr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?=$thispatch['descr'];?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + + <?php + if (!empty($thispatch['location'])) { + echo $thispatch['location']; + } elseif (!empty($thispatch['patch'])) { + echo gettext("Saved Patch"); + } + ?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?php if (empty($thispatch['patch'])): ?> + <a href="system_patches.php?id=<?=$i;?>&act=fetch"><?php echo gettext("Fetch"); ?></a> + <?php elseif (!empty($thispatch['location'])): ?> + <a href="system_patches.php?id=<?=$i;?>&act=fetch"><?php echo gettext("Re-Fetch"); ?></a> + <?php endif; ?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?php if (!empty($thispatch['patch'])): ?> + <a href="system_patches.php?id=<?=$i;?>&act=test"><?php echo gettext("Test"); ?></a> + <?php endif; ?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?php if ($can_apply): ?> + <a href="system_patches.php?id=<?=$i;?>&act=apply"><?php echo gettext("Apply"); ?></a> + <?php endif; ?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?php if ($can_revert): ?> + <a href="system_patches.php?id=<?=$i;?>&act=revert"><?php echo gettext("Revert"); ?></a> + <?php endif; ?> + </td> + <td class="listr" onclick="fr_toggle(<?=$npatches;?>)" id="frd<?=$npatches;?>" ondblclick="document.location='system_patches_edit.php?id=<?=$npatches;?>';"> + <?= isset($thispatch['autoapply']) ? "Yes" : "No" ?> + </td> + <td valign="middle" class="list" nowrap> + <table border="0" cellspacing="0" cellpadding="1" summary="edit"> + <tr> + <td><input onmouseover="fr_insline(<?=$npatches;?>, true)" onmouseout="fr_insline(<?=$npatches;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected patches before this patch");?>" height="17" type="image" width="17" border="0" /></td> + <td><a href="system_patches_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit patch"); ?>" alt="edit" /></a></td> + </tr> + <tr> + <td align="center" valign="middle"><a href="system_patches.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this patch?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete patch");?>" alt="delete" /></a></td> + <td></td> + </tr> + </table> + </td> </tr> +<?php + $i++; + $npatches++; +endforeach; +?> <tr> - <td width="17"> - <?php if (count($a_patches) == 0): ?> - <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected patches");?>" border="0" alt="delete" /> - <?php else: ?> - <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected patches"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected patches?");?>')" /> - <?php endif; ?> - </td> - <td><a href="system_patches_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new patch"); ?>" alt="add" /></a></td> + <td class="list" colspan="8"></td> + <td class="list" valign="middle" nowrap> + <table border="0" cellspacing="0" cellpadding="1" summary="edit"> + <tr> + <td><?php if ($npatches == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected patches to end"); ?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected patches to end");?>" border="0" alt="move" /><?php endif; ?></td> + </tr> + <tr> + <td width="17"> + <?php if (count($a_patches) == 0): ?> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected patches");?>" border="0" alt="delete" /> + <?php else: ?> + <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected patches"); ?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected patches?");?>')" /> + <?php endif; ?> + </td> + <td><a href="system_patches_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new patch"); ?>" alt="add" /></a></td> + </tr> + </table> + </td> </tr> - </table> - </td> + <tr> + <td></td> + <td colspan="6"> + <?php echo gettext("NOTE: Each patch is tested, and the appropriate action is shown. If neither 'Apply' or 'Revert' shows up, the patch cannot be used (check the pathstrip and whitespace options)."); ?> + <br/><br/> + <?php echo gettext("Use the 'Test' link to see if a patch can be applied or reverted. You can reorder patches so that higher patches apply later than lower patches."); ?> + </td> + <td></td> </tr> - <tr><td></td><td colspan="6"> - <?php echo gettext("NOTE: Each patch is tested, and the appropriate action is shown. If neither 'Apply' or 'Revert' shows up, the patch cannot be used (check the pathstrip and whitespace options)."); ?> - <br/><br/> - <?php echo gettext("Use the 'Test' link to see if a patch can be applied or reverted. You can reorder patches so that higher patches apply later than lower patches."); ?> - </td><td></td></tr> - </table> +</table> </div></td></tr> </table> </form> diff --git a/config/systempatches/system_patches_edit.php b/config/systempatches/system_patches_edit.php index 3e63038e..9e1f7a49 100644 --- a/config/systempatches/system_patches_edit.php +++ b/config/systempatches/system_patches_edit.php @@ -46,8 +46,9 @@ if (!is_array($config['installedpackages']['patches']['item'])) { $a_patches = &$config['installedpackages']['patches']['item']; $id = $_GET['id']; -if (isset($_POST['id'])) +if (isset($_POST['id'])) { $id = $_POST['id']; +} if (isset($_GET['dup'])) { $id = $_GET['dup']; @@ -69,8 +70,9 @@ if (isset($id) && $a_patches[$id]) { $pconfig['ignorewhitespace'] = true; } -if (isset($_GET['dup'])) +if (isset($_GET['dup'])) { unset($id); +} unset($input_errors); @@ -87,10 +89,11 @@ if ($_POST) { } $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); - if ($pf_version < 2.1) + if ($pf_version < 2.1) { $input_errors = eval('do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); return $input_errors;'); - else + } else { do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); + } if (!empty($_POST['location']) && !is_commit_id($_POST['location']) && !is_URL($_POST['location'])) { $input_errors[] = gettext("The supplied commit ID/URL appears to be invalid."); @@ -111,10 +114,11 @@ if ($_POST) { /* Strip DOS style carriage returns from textarea input */ $thispatch['patch'] = base64_encode(str_replace("\r", "", $_POST['patch'])); } - if (is_github_url($thispatch['location']) && ($_POST['pathstrip'] == 0)) + if (is_github_url($thispatch['location']) && ($_POST['pathstrip'] == 0)) { $thispatch['pathstrip'] = 1; - else + } else { $thispatch['pathstrip'] = $_POST['pathstrip']; + } $thispatch['basedir'] = empty($_POST['basedir']) ? "/" : $_POST['basedir']; $thispatch['ignorewhitespace'] = isset($_POST['ignorewhitespace']); $thispatch['autoapply'] = isset($_POST['autoapply']); @@ -125,18 +129,20 @@ if ($_POST) { } // Update the patch entry now - if (isset($id) && $a_patches[$id]) + if (isset($id) && $a_patches[$id]) { $a_patches[$id] = $thispatch; - else { - if (is_numeric($after)) + } else { + if (is_numeric($after)) { array_splice($a_patches, $after+1, 0, array($thispatch)); - else + } else { $a_patches[] = $thispatch; + } } write_config(); - if ($thispatch['autoapply']) + if ($thispatch['autoapply']) { patch_add_shellcmd(); + } header("Location: system_patches.php"); return; } diff --git a/config/systempatches/systempatches.xml b/config/systempatches/systempatches.xml index 3cc1354a..ad7f5953 100644 --- a/config/systempatches/systempatches.xml +++ b/config/systempatches/systempatches.xml @@ -10,17 +10,18 @@ part of pfSense (http://www.pfSense.com) Copyright (C) 2012 Jim Pingle All rights reserved. +*/ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY @@ -32,7 +33,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ +*/ /* ========================================================================== */ ]]> </copyright> @@ -40,7 +41,7 @@ <requirements>None</requirements> <faq>Applies patches supplied by the user to the firewall.</faq> <name>System Patches</name> - <version>1.0.3</version> + <version>1.0.4</version> <title>System: Patches</title> <include_file>/usr/local/pkg/patches.inc</include_file> <menu> diff --git a/config/widentd/widentd.xml b/config/widentd/widentd.xml index ca73d436..27a8ffe8 100644 --- a/config/widentd/widentd.xml +++ b/config/widentd/widentd.xml @@ -1,58 +1,54 @@ <?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ -/* ========================================================================== */ +/* ====================================================================================== */ /* - authng.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ + widentd.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Bill Marquette + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ -/* ========================================================================== */ - ]]> - </copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>widentd</name> - <version>1.03_1</version> + <version>1.0.4</version> <title>Services: widentd</title> <menu> <name>widentd</name> <tooltiptext>Modify widentd settings.</tooltiptext> <section>Services</section> - <url>pkg_edit.php?xml=widentd.xml&id=0</url> + <url>pkg_edit.php?xml=widentd.xml&id=0</url> </menu> <service> <name>widentd</name> @@ -62,61 +58,114 @@ <configpath>installedpackages->package->$packagename->configuration->settings</configpath> <fields> <field> - <fielddescr>Listening interface</fielddescr> - <fieldname>interface</fieldname> - <description>Enter the desired listening interface here.</description> - <type>interfaces_selection</type> + <fielddescr>Enable widentd daemon</fielddescr> + <fieldname>enable</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>Listening interface</fielddescr> + <fieldname>interface</fieldname> + <description> + <![CDATA[ + Enter the desired listening interface here.<br /> + (Default: WAN) + ]]> + </description> + <type>interfaces_selection</type> + <default_value>wan</default_value> + <required/> </field> <field> - <fielddescr>Username</fielddescr> - <fieldname>username</fieldname> - <description>Enter the username you'd like displayed via widentd.</description> - <type>input</type> + <fielddescr>Username</fielddescr> + <fieldname>username</fieldname> + <description> + <![CDATA[ + Enter the username you'd like displayed via widentd. Allowed characters: [a-zA-Z] and "." only.<br /> + (Defaults to 'user' if left empty.) + ]]> + </description> + <type>input</type> </field> <field> - <fielddescr>System name</fielddescr> - <fieldname>sysname</fieldname> - <description>Enter the system name you'd like displayed via widentd</description> - <type>input</type> - <value>pfSense</value> + <fielddescr>System name</fielddescr> + <fieldname>sysname</fieldname> + <description> + <![CDATA[ + Enter the system name you'd like displayed via widentd. Allowed characters: [a-zA-Z] only.<br /> + (Defaults to 'UNIX' if left empty.) + ]]> + </description> + <type>input</type> </field> - </fields> + </fields> <custom_php_global_functions> + <![CDATA[ function sync_package_widentd() { conf_mount_rw(); config_lock(); global $config; - if (!isset($config['installedpackages']['widentd']['config'][0]['interface'])) { - $config['installedpackages']['widentd']['config'][0]['interface'] = 'WAN'; - } - if (!isset($config['installedpackages']['widentd']['config'][0]['username'])) { - $config['installedpackages']['widentd']['config'][0]['username'] = 'user'; - } - if (!isset($config['installedpackages']['widentd']['config'][0]['sysname'])) { - $config['installedpackages']['widentd']['config'][0]['sysname'] = 'UNIX'; - } + + /* Write widentd.sh */ $int = convert_friendly_interface_to_real_interface_name($config['installedpackages']['widentd']['config'][0]['interface']); $ip = find_interface_ip($int); - $user = $config['installedpackages']['widentd']['config'][0]['username']; - $system = $config['installedpackages']['widentd']['config'][0]['sysname']; + $user = $config['installedpackages']['widentd']['config'][0]['username'] ?: 'user'; + $system = $config['installedpackages']['widentd']['config'][0]['sysname'] ?: 'UNIX'; $start = "/usr/local/sbin/widentd -u {$user} -o {$system} -i {$ip}"; $stop = "/usr/bin/killall widentd"; write_rcfile(array( "file" => "widentd.sh", "start" => $start, - "stop" => $stop + "stop" => $stop ) ); - restart_service("widentd"); - conf_mount_ro(); + + /* If the service is (being) disabled, stop it (if running) and do nothing else */ + if (!($config['installedpackages']['widentd']['config'][0][enable])) { + if (is_process_running("widentd")) { + stop_service("widentd"); + } + return; + } else { + restart_service("widentd"); + } config_unlock(); + conf_mount_ro(); } + + + function validate_input_widentd($post, &$input_errors) { + /* Only allow ^[a-zA-Z\.]+$ otherwise the daemon will not start; see widentd manpage */ + if (($post['username'] != "") && !preg_match("/^[a-zA-Z\.]+$/", $post['username'])) { + $input_errors[] = 'Username may only contain uppercase and lowercase letters [a-zA-Z] and "." character.'; + } + + /* Technically, ^[A-Z][A-Z0-9\-.\/]+[A-Z0-9]$ should be valid characters here + https://www.iana.org/assignments/operating-system-names/operating-system-names.xhtml + However this is not supported by widentd; the service will not start. + */ + if (($post['sysname'] != "") && !preg_match("/^[a-zA-Z]+$/", $post['sysname'])) { + $input_errors[] .= 'System name may only contain uppercase and lowercase letters [a-zA-Z].'; + } + + /* Check for IPv6-only interfaces */ + $int = convert_friendly_interface_to_real_interface_name($post['interface']); + $ip = find_interface_ip($int); + if (!is_ipaddrv4($ip)) { + $input_errors[] .= 'The selected interface has no IPv4 configured. Widentd does not support IPv6.'; + } + } + ]]> </custom_php_global_functions> <custom_add_php_command> sync_package_widentd(); </custom_add_php_command> + <custom_php_resync_config_command> + sync_package_widentd(); + </custom_php_resync_config_command> <custom_php_install_command> unlink_if_exists("/usr/local/etc/rc.d/widentd.sh"); </custom_php_install_command> + <custom_php_validation_command> + validate_input_widentd($_POST, $input_errors); + </custom_php_validation_command> </packagegui> - diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 4e7e04b4..4abf0a4e 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -79,7 +79,7 @@ <category>File Management</category> <pkginfolink>https://doc.pfsense.org/index.php/Filer_package</pkginfolink> <config_file>https://packages.pfsense.org/packages/config/filer/filer.xml</config_file> - <version>0.60.3</version> + <version>0.60.4</version> <status>Beta</status> <required_version>2.2</required_version> <maintainer>bscholer@cshl.edu</maintainer> @@ -253,7 +253,7 @@ <name>Avahi</name> <pkginfolink>https://doc.pfsense.org/index.php/Avahi_package</pkginfolink> <website>http://www.avahi.org/</website> - <descr>Avahi is a system which facilitates service discovery on a local network. This means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in Apple MacOS X (branded Rendezvous, Bonjour and sometimes Zeroconf) and is very convenient. Avahi is mainly based on Lennart Poettering's flexmdns mDNS implementation for Linux which has been discontinued in favour of Avahi.</descr> + <descr>Avahi is a system which facilitates service discovery on a local network. This means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in Apple Mac OS X (branded Rendezvous, Bonjour and sometimes Zeroconf) and is very convenient. Avahi is mainly based on Lennart Poettering's flexmdns mDNS implementation for Linux which has been discontinued in favour of Avahi.</descr> <category>Network Management</category> <lib_depends>libavahi-core.so:net/avahi-app</lib_depends> <port_category>net</port_category> @@ -315,7 +315,7 @@ <category>Status</category> <pkginfolink/> <config_file>https://packages.pfsense.org/packages/config/notes/notes.xml</config_file> - <version>0.2.4</version> + <version>0.2.5</version> <status>Alpha</status> <required_version>2.2</required_version> <maintainer>markjcrane@gmail.com</maintainer> @@ -865,7 +865,7 @@ <website>http://www.webweaving.org/widentd</website> <category>Services</category> <depends_on_package_pbi>widentd-1.03_2-##ARCH##.pbi</depends_on_package_pbi> - <version>1.03_2</version> + <version>1.0.4</version> <status>Stable</status> <pkginfolink>https://doc.pfsense.org/index.php/Widentd_package</pkginfolink> <required_version>2.2</required_version> @@ -952,7 +952,7 @@ <category>Network Management</category> <config_file>https://packages.pfsense.org/packages/config/iperf/iperf.xml</config_file> <depends_on_package_pbi>iperf-2.0.5-##ARCH##.pbi</depends_on_package_pbi> - <version>2.0.5_1</version> + <version>2.0.5.2</version> <status>Beta</status> <pkginfolink>https://doc.pfsense.org/index.php/Iperf_package</pkginfolink> <required_version>2.2</required_version> @@ -1153,14 +1153,14 @@ <package> <name>OpenVPN Client Export Utility</name> <internal_name>openvpn-client-export</internal_name> - <descr>Allows a pre-configured OpenVPN Windows Client or Mac OSX's Viscosity configuration bundle to be exported directly from pfSense.</descr> + <descr>Allows a pre-configured OpenVPN Windows Client or Mac OS X's Viscosity configuration bundle to be exported directly from pfSense.</descr> <category>Security</category> <depends_on_package_pbi>zip-3.0_1-##ARCH##.pbi p7zip-9.20.1_2-##ARCH##.pbi</depends_on_package_pbi> <build_port_path>/usr/ports/archivers/p7zip</build_port_path> <build_port_path>/usr/ports/archivers/zip</build_port_path> <port_category>security</port_category> <run_depends>share/openvpn/client-export/template/config-import:security/openvpn-client-export bin/zip:archivers/zip bin/7z:archivers/p7zip</run_depends> - <version>1.2.17</version> + <version>1.2.19</version> <status>RELEASE</status> <required_version>2.2</required_version> <config_file>https://packages.pfsense.org/packages/config/openvpn-client-export/openvpn-client-export.xml</config_file> @@ -1191,7 +1191,7 @@ <name>blinkled</name> <descr>Allows you to use LEDs for network activity on supported platforms (ALIX, WRAP, Soekris, etc)</descr> <category>System</category> - <version>0.4.4</version> + <version>0.4.5</version> <status>Beta</status> <maintainer>jimp@pfsense.org</maintainer> <required_version>2.2</required_version> @@ -1280,7 +1280,7 @@ <config_file>https://packages.pfsense.org/packages/config/nrpe2/nrpe2.xml</config_file> <version>2.15_5 v2.2_4</version> <status>Beta</status> - <required_version>2.2</required_version> + <required_version>2.2.1</required_version> <maintainer>erik@erikkristensen.com</maintainer> <configurationfile>nrpe2.xml</configurationfile> <maximum_version>2.2.999</maximum_version> @@ -1352,7 +1352,7 @@ <internal_name>System_Patches</internal_name> <descr>A package to apply and maintain custom system patches.</descr> <maintainer>jimp@pfsense.org</maintainer> - <version>1.0.3</version> + <version>1.0.4</version> <category>System</category> <status>RELEASE</status> <config_file>https://packages.pfsense.org/packages/config/systempatches/systempatches.xml</config_file> @@ -1570,7 +1570,7 @@ <pkginfolink>https://doc.pfsense.org/index.php/Sudo_Package</pkginfolink> <descr><![CDATA[sudo allows delegation of privileges to users in the shell so commands can be run as other users, such as root.]]></descr> <category>Security</category> - <version>0.2.6</version> + <version>0.2.7</version> <status>Beta</status> <required_version>2.2</required_version> <config_file>https://packages.pfsense.org/packages/config/sudo/sudo.xml</config_file> @@ -1588,7 +1588,7 @@ <internal_name>Service_Watchdog</internal_name> <descr>Monitors for stopped services and restarts them.</descr> <maintainer>jimp@pfsense.org</maintainer> - <version>1.6</version> + <version>1.7</version> <category>Services</category> <status>Release</status> <config_file>https://packages.pfsense.org/packages/config/servicewatchdog/servicewatchdog.xml</config_file> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 5eeb18dd..b45bff1d 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -326,7 +326,7 @@ <name>Avahi</name> <pkginfolink>https://doc.pfsense.org/index.php/Avahi_package</pkginfolink> <website>http://www.avahi.org/</website> - <descr>Avahi is a system which facilitates service discovery on a local network. This means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in Apple MacOS X (branded Rendezvous, Bonjour and sometimes Zeroconf) and is very convenient. Avahi is mainly based on Lennart Poettering's flexmdns mDNS implementation for Linux which has been discontinued in favour of Avahi.</descr> + <descr>Avahi is a system which facilitates service discovery on a local network. This means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in Apple Mac OS X (branded Rendezvous, Bonjour and sometimes Zeroconf) and is very convenient. Avahi is mainly based on Lennart Poettering's flexmdns mDNS implementation for Linux which has been discontinued in favour of Avahi.</descr> <category>Network Management</category> <depends_on_package_base_url>https://files.pfsense.org/packages/8/All/</depends_on_package_base_url> <build_port_path>/usr/ports/net/avahi</build_port_path> @@ -1393,7 +1393,7 @@ </package> <package> <name>OpenVPN Client Export Utility</name> - <descr>Allows a pre-configured OpenVPN Windows Client or Mac OSX's Viscosity configuration bundle to be exported directly from pfSense.</descr> + <descr>Allows a pre-configured OpenVPN Windows Client or Mac OS X's Viscosity configuration bundle to be exported directly from pfSense.</descr> <category>Security</category> <depends_on_package_base_url>https://files.pfsense.org/packages/8/All/</depends_on_package_base_url> <depends_on_package>p7zip-9.20.1.tbz</depends_on_package> @@ -1401,7 +1401,7 @@ <depends_on_package_pbi>zip-3.0-i386.pbi p7zip-9.20.1-i386.pbi</depends_on_package_pbi> <build_port_path>/usr/ports/archivers/p7zip</build_port_path> <build_port_path>/usr/ports/archivers/zip</build_port_path> - <version>1.2.16</version> + <version>1.2.19</version> <status>RELEASE</status> <required_version>2.0</required_version> <config_file>https://packages.pfsense.org/packages/config/openvpn-client-export/openvpn-client-export.xml</config_file> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 38542bcf..f52f2525 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1388,7 +1388,7 @@ <depends_on_package_pbi>zip-3.0-amd64.pbi p7zip-9.20.1-amd64.pbi</depends_on_package_pbi> <build_port_path>/usr/ports/archivers/p7zip</build_port_path> <build_port_path>/usr/ports/archivers/zip</build_port_path> - <version>1.2.16</version> + <version>1.2.19</version> <status>RELEASE</status> <required_version>2.0</required_version> <config_file>https://packages.pfsense.org/packages/config/openvpn-client-export/openvpn-client-export.xml</config_file> |