aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/filer/filer.inc240
-rw-r--r--config/filer/filer.xml111
-rw-r--r--config/filer/filer_sync.xml89
-rw-r--r--config/rrd-summary/rrd-summary.xml84
-rw-r--r--config/rrd-summary/status_rrd_summary.php24
-rw-r--r--config/sudo/sudo.inc30
-rw-r--r--config/sudo/sudo.xml42
7 files changed, 332 insertions, 288 deletions
diff --git a/config/filer/filer.inc b/config/filer/filer.inc
index b89553e4..3a012dd2 100644
--- a/config/filer/filer.inc
+++ b/config/filer/filer.inc
@@ -1,194 +1,191 @@
<?php
-/* ========================================================================== */
-/*
- filerinc
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
- Copyright (C) 2012 Marcello Coutinho
- Copyright (C) 2012 Brian Scholer
- 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.
- */
+ filer.inc
+ part of pfSense (https://www.pfsense.org/)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2012 Brian Scholer
+ 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.
+*/
/* ========================================================================== */
-
-
-function filer_install() {
- // reserved
+function filer_text_area_decode($text) {
+ return preg_replace('/\r\n/', "\n", base64_decode($text));
}
-function filer_deinstall() {
- // reserved
-}
-
-function filer_start() {
- global $g, $config;
-
- // reserved
-}
-
-function filer_text_area_decode($text){
- return preg_replace('/\r\n/', "\n",base64_decode($text));
-}
function sync_package_filer() {
global $config, $g;
- $update_conf=0;
- #mount filesystem writeable
+ $update_conf = 0;
+
conf_mount_rw();
-
- #loop on configured files
- if($config['installedpackages']['filer']['config']!="") {
- $count=0;
- foreach($config['installedpackages']['filer']['config'] as $file) {
- 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']));
+
+ /* Loop on configured files. */
+ if ($config['installedpackages']['filer']['config'] != "") {
+ $count = 0;
+ foreach ($config['installedpackages']['filer']['config'] as $file) {
+ 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++;
- }
+ }
$count++;
- if(preg_match("/0?[0-7]{3}/", $file['mod']))
+ if (preg_match("/0?[0-7]{3}/", $file['mod'])) {
$mod = octdec($file['mod']);
- else
- $mod = 0700;
-
- #write file
- file_put_contents($file['fullfile'], filer_text_area_decode($file['filedata']),LOCK_EX);
+ } else {
+ $mod = 0644;
+ }
+
+ /* Write file. */
+ file_put_contents($file['fullfile'], filer_text_area_decode($file['filedata']), LOCK_EX);
chmod($file['fullfile'], $mod);
-
- #check if there is a script to run after file save
- if($file['cmd']!= "")
- switch ($file['background']){
+
+ /* Check if there is a script to run after file save. */
+ if ($file['cmd'] != "") {
+ switch ($file['background']) {
case "background":
mwexec_bg($file['cmd']);
break;
case "foreground":
mwexec($file['cmd']);
- break;
+ break;
}
-
+ }
}
- #Write config if any file from filesystem was loaded
- if ($update_conf > 0)
- write_config();
+ /* Write config if any file from filesystem was loaded. */
+ if ($update_conf > 0) {
+ write_config();
+ }
}
- #mount filesystem readonly
+
conf_mount_ro();
-
+
filer_sync_on_changes();
}
function filer_validate_input($post, &$input_errors) {
foreach ($post as $key => $value) {
- if (empty($value))
+ if (empty($value)) {
continue;
- if (substr($key, 0, 3) == "mod" && !preg_match("/^0?[0-7]{3}$/", $value))
- $input_errors[] = "{$value} is valid permission number";
- if (substr($key, 0, 11) == "description" && !preg_match("@^[a-zA-Z0-9 _/.-]+$@", $value))
- $input_errors[] = "Do not use special characters on description";
- if (substr($key, 0, 8) == "fullfile" && !preg_match("@^[a-zA-Z0-9_/.-]+$@", $value))
- $input_errors[] = "Do not use special characters on filename";
-
+ }
+ if (substr($key, 0, 3) == "mod" && !preg_match("/^0?[0-7]{3}$/", $value)) {
+ $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.";
+ }
+ if (substr($key, 0, 8) == "fullfile" && !preg_match("@^[a-zA-Z0-9_/.-]+$@", $value)) {
+ $input_errors[] = "Do not use special characters in filename.";
+ }
}
}
-/* Uses XMLRPC to synchronize the changes to a remote node */
+/* Uses XMLRPC to synchronize the changes to a remote node. */
function filer_sync_on_changes() {
global $config, $g;
-
+
log_error("[filer] filer_xmlrpc_sync.php is starting.");
- $synconchanges = $config['installedpackages']['filersync']['config'][0]['synconchanges'];
- if(!$synconchanges)
+ $synconchanges = $config['installedpackages']['filersync']['config'][0]['synconchanges'];
+ if (!$synconchanges) {
return;
- foreach ($config['installedpackages']['filersync']['config'] as $rs ){
- foreach($rs['row'] as $sh){
+ }
+ foreach ($config['installedpackages']['filersync']['config'] as $rs) {
+ foreach ($rs['row'] as $sh) {
$sync_to_ip = $sh['ipaddress'];
$password = $sh['password'];
- if($sh['username'])
+ if ($sh['username']) {
$username = $sh['username'];
- else
+ } else {
$username = 'admin';
- if($password && $sync_to_ip)
+ }
+ if ($password && $sync_to_ip) {
filer_do_xmlrpc_sync($sync_to_ip, $username, $password);
}
+ }
}
log_error("[filer] filer_xmlrpc_sync.php is ending.");
}
-/* Do the actual XMLRPC sync */
+
+/* Do the actual XMLRPC sync. */
function filer_do_xmlrpc_sync($sync_to_ip, $username, $password) {
global $config, $g;
- if(!$username)
+ if (!$username) {
return;
-
- if(!$password)
+ }
+
+ if (!$password) {
return;
+ }
- if(!$sync_to_ip)
+ if (!$sync_to_ip) {
return;
+ }
$xmlrpc_sync_neighbor = $sync_to_ip;
- if($config['system']['webgui']['protocol'] != "") {
+ if ($config['system']['webgui']['protocol'] != "") {
$synchronizetoip = $config['system']['webgui']['protocol'];
$synchronizetoip .= "://";
- }
- $port = $config['system']['webgui']['port'];
- /* if port is empty lets rely on the protocol selection */
- if($port == "") {
- if($config['system']['webgui']['protocol'] == "http")
+ }
+ $port = $config['system']['webgui']['port'];
+ /* If port is empty, let's rely on the protocol selection. */
+ if ($port == "") {
+ if ($config['system']['webgui']['protocol'] == "http") {
$port = "80";
- else
+ } else {
$port = "443";
- }
+ }
+ }
$synchronizetoip .= $sync_to_ip;
- /* xml will hold the sections to sync */
+ /* xml will hold the sections to sync. */
$xml = array();
$xml['filer'] = $config['installedpackages']['filer'];
-
- /* assemble xmlrpc payload */
+
+ /* Assemble XMLRPC payload. */
$params = array(
XML_RPC_encode($password),
XML_RPC_encode($xml)
);
- /* set a few variables needed for sync code borrowed from filter.inc */
+ /* Set a few variables needed for sync; code borrowed from filter.inc. */
$url = $synchronizetoip;
log_error("Beginning Filer XMLRPC sync to {$url}:{$port}.");
$method = 'pfsense.merge_installedpackages_section_xmlrpc';
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
$cli->setCredentials($username, $password);
- if($g['debug'])
+ if ($g['debug']) {
$cli->setDebug(1);
- /* send our XMLRPC message and timeout after 250 seconds */
+ }
+ /* Send our XMLRPC message and timeout after 250 seconds. */
$resp = $cli->send($msg, "250");
- if(!$resp) {
+ if (!$resp) {
$error = "A communications error occurred while attempting filer XMLRPC sync with {$url}:{$port}.";
log_error($error);
file_notice("sync_settings", $error, "filer Settings Sync", "");
- } elseif($resp->faultCode()) {
+ } elseif ($resp->faultCode()) {
$cli->setDebug(1);
$resp = $cli->send($msg, "250");
$error = "An error code was received while attempting filer XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
@@ -197,27 +194,27 @@ function filer_do_xmlrpc_sync($sync_to_ip, $username, $password) {
} else {
log_error("filer XMLRPC sync successfully completed with {$url}:{$port}.");
}
-
- /* tell filer to reload our settings on the destionation sync host. */
+
+ /* Tell filer to reload our settings on the destination sync host. */
$method = 'pfsense.exec_php';
- $execcmd = "require_once('/usr/local/pkg/filer.inc');\n";
+ $execcmd = "require_once('/usr/local/pkg/filer.inc');\n";
$execcmd .= "sync_package_filer();";
- /* assemble xmlrpc payload */
+ /* Assemble XMLRPC payload. */
$params = array(
XML_RPC_encode($password),
XML_RPC_encode($execcmd)
);
-
+
log_error("filer XMLRPC reload data {$url}:{$port}.");
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
$cli->setCredentials($username, $password);
$resp = $cli->send($msg, "250");
- if(!$resp) {
+ if (!$resp) {
$error = "A communications error occurred while attempting filer XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
log_error($error);
file_notice("sync_settings", $error, "filer Settings Sync", "");
- } elseif($resp->faultCode()) {
+ } elseif ($resp->faultCode()) {
$cli->setDebug(1);
$resp = $cli->send($msg, "250");
$error = "An error code was received while attempting filer XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
@@ -226,7 +223,6 @@ function filer_do_xmlrpc_sync($sync_to_ip, $username, $password) {
} else {
log_error("filer XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
}
-
}
?>
diff --git a/config/filer/filer.xml b/config/filer/filer.xml
index 71821067..98eb4bd8 100644
--- a/config/filer/filer.xml
+++ b/config/filer/filer.xml
@@ -1,59 +1,58 @@
<?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$ */
+/* ====================================================================================== */
/*
- filer.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
- Copyright (C) 2011 Brian Scholer
- Copyright (C) 2012 Marcello Coutinho
- All rights reserved.
+ filer.xml
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ Copyright (C) 2011 Brian Scholer
+ Copyright (C) 2012 Marcello Coutinho
+ 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.
- 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.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 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>
+ 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>
<name>filer</name>
- <version>0.60.1</version>
+ <version>0.60.2</version>
<title>Filer</title>
<include_file>/usr/local/pkg/filer.inc</include_file>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
<item>https://packages.pfsense.org/packages/config/filer/filer.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
<item>https://packages.pfsense.org/packages/config/filer/filer_sync.xml</item>
</additional_files_needed>
<menu>
@@ -73,7 +72,6 @@
<url>/pkg_edit.php?xml=filer_sync.xml</url>
</tab>
</tabs>
-
<adddeleteeditpagefields>
<columnitem>
<fielddescr>File</fielddescr>
@@ -99,7 +97,7 @@
<fieldname>fullfile</fieldname>
<type>input</type>
<size>60</size>
- <description>Enter Full file path</description>
+ <description>Enter full file path.</description>
<required/>
</field>
<field>
@@ -107,6 +105,7 @@
<fieldname>description</fieldname>
<description>Enter a description for this file.</description>
<type>input</type>
+ <typehint>(Not parsed -- this is for your reference only.)</typehint>
<size>60</size>
</field>
<field>
@@ -114,7 +113,7 @@
<fieldname>mod</fieldname>
<type>input</type>
<size>10</size>
- <description><![CDATA[Enter file permission you want on this file<br>Blank leaves the permissions alone.]]></description>
+ <description><![CDATA[Enter file permission you want on this file<br />If left blank, default file permissions (0644) will be used.]]></description>
</field>
<field>
<fielddescr>File Contents</fielddescr>
@@ -129,23 +128,33 @@
<field>
<type>listtopic</type>
<fieldname>temp</fieldname>
- <name>cmd to run after file save/sync</name>
+ <name>Command to run after file save/sync.</name>
</field>
<field>
- <fielddescr>script</fielddescr>
+ <fielddescr>Script/Command</fielddescr>
<fieldname>cmd</fieldname>
- <description>Enter script or cmd to run after file save/sync</description>
+ <description>Enter script or command to run after file save/sync.</description>
<type>input</type>
+ <typehint>(Optional. If using a custom script, it must have executable bit set.)</typehint>
<size>60</size>
</field>
<field>
- <fielddescr>execute mode</fielddescr>
+ <fielddescr>Execute mode</fielddescr>
<fieldname>background</fieldname>
<type>select</type>
<options>
- <option><name>Background (default)</name><value>background</value></option>
- <option><name>Foreground</name><value>foreground</value></option>
- <option><name>Do not run this script</name><value>disabled</value></option>
+ <option>
+ <name>Background (default)</name>
+ <value>background</value>
+ </option>
+ <option>
+ <name>Foreground</name>
+ <value>foreground</value>
+ </option>
+ <option>
+ <name>Do not run this script</name>
+ <value>disabled</value>
+ </option>
</options>
<description>Choose the way script will run.</description>
</field>
@@ -153,8 +162,6 @@
<custom_php_install_command>
filer_install();
</custom_php_install_command>
- <custom_php_command_before_form>
- </custom_php_command_before_form>
<custom_php_validation_command>
filer_validate_input($_POST, $input_errors);
</custom_php_validation_command>
@@ -164,4 +171,4 @@
<custom_php_resync_config_command>
sync_package_filer();
</custom_php_resync_config_command>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/filer/filer_sync.xml b/config/filer/filer_sync.xml
index c51bae86..0b4124ce 100644
--- a/config/filer/filer_sync.xml
+++ b/config/filer/filer_sync.xml
@@ -2,48 +2,49 @@
<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
- <copyright>
- <![CDATA[
-/* ========================================================================== */
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ====================================================================================== */
/*
- filer_sync.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
- Copyright (C) 2011 Brian Scholer
- Copyright (C) 2012 Marcello Coutinho
- All rights reserved.
- */
-/* ========================================================================== */
+ filer_sync.xml
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ Copyright (C) 2011 Brian Scholer
+ Copyright (C) 2012 Marcello Coutinho
+ 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.
- 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.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 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>
+ 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>
<name>filersync</name>
- <version>1.1</version>
+ <version>1.2</version>
<title>Filer: Sync</title>
<include_file>/usr/local/pkg/filer.inc</include_file>
<tabs>
@@ -62,11 +63,11 @@
<type>listtopic</type>
<fieldname>temp</fieldname>
<name>Enable Filer configuration sync</name>
- </field>
+ </field>
<field>
- <fielddescr>Automatically sync Filer configuration changes</fielddescr>
+ <fielddescr>Automatically sync Filer configuration changes.</fielddescr>
<fieldname>synconchanges</fieldname>
- <description>pfSense will automatically sync changes to the hosts defined below. Blank user assumes 'admin'.</description>
+ <description>pfSense will automatically sync changes to the hosts defined below. (Leave blank to use 'admin'.)</description>
<type>checkbox</type>
</field>
<field>
@@ -77,7 +78,7 @@
<rowhelperfield>
<fielddescr>IP Address</fielddescr>
<fieldname>ipaddress</fieldname>
- <description>IP Address of remote server</description>
+ <description>IP Address of remote server.</description>
<type>input</type>
<size>20</size>
<required/>
@@ -85,7 +86,7 @@
<rowhelperfield>
<fielddescr>User Name</fielddescr>
<fieldname>username</fieldname>
- <description>user name of remote server</description>
+ <description>user name of remote server.</description>
<type>input</type>
<size>20</size>
</rowhelperfield>
@@ -101,9 +102,9 @@
</field>
</fields>
<custom_php_resync_config_command>
- filer_sync_on_changes();
+ filer_sync_on_changes();
</custom_php_resync_config_command>
- <custom_php_command_before_form>
+ <custom_php_command_before_form>
unset($_POST['temp']);
</custom_php_command_before_form>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/rrd-summary/rrd-summary.xml b/config/rrd-summary/rrd-summary.xml
index 4b62272d..67c20937 100644
--- a/config/rrd-summary/rrd-summary.xml
+++ b/config/rrd-summary/rrd-summary.xml
@@ -2,69 +2,57 @@
<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
- <copyright>
- <![CDATA[
+ <copyright>
+ <![CDATA[
/* $Id$ */
-/* ========================================================================== */
+/* ====================================================================================== */
/*
- rrd-summary.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2010 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.
- */
-/* ========================================================================== */
+ rrd-summary.xml
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2010 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:
+ 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>
+ 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>RRD Summary Page</description>
- <requirements>None</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
<name>RRD Summary</name>
- <version>1.1</version>
+ <version>1.2</version>
<title>Status: RRD Summary</title>
<menu>
<name>RRD Summary</name>
- <tooltiptext></tooltiptext>
+ <tooltiptext>Display total amount of traffic passed In/Out during this and the previous month.</tooltiptext>
<section>Status</section>
<url>/status_rrd_summary.php</url>
</menu>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
- <chmod>077</chmod>
<item>https://packages.pfsense.org/packages/config/rrd-summary/status_rrd_summary.php</item>
</additional_files_needed>
- <custom_php_deinstall_command>
- <![CDATA[
- $version = file_get_contents("/etc/version");
- if ($version[0] < 2) {
- unlink_if_exists("/usr/local/www/status_rrd_summary.php");
- }
- ]]>
- </custom_php_deinstall_command>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/rrd-summary/status_rrd_summary.php b/config/rrd-summary/status_rrd_summary.php
index 0e43d95c..27a6f069 100644
--- a/config/rrd-summary/status_rrd_summary.php
+++ b/config/rrd-summary/status_rrd_summary.php
@@ -1,7 +1,10 @@
<?php
/*
rrd_summary.php
+ part of pfSense (https://www.pfsense.org/)
Copyright (C) 2010 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:
@@ -37,9 +40,9 @@ $lastmonth = fetch_rrd_summary($rrd, $lastmonth, $start, 720*60);
function fetch_rrd_summary($rrd, $start, $end, $resolution=3600) {
$traffic = array();
- $rrd = escapeshellarg("/var/db/rrd/{$rrd}");
+ $rrd = escapeshellarg("/var/db/rrd/{$rrd}");
$start = escapeshellarg($start);
- $end = escapeshellarg($end);
+ $end = escapeshellarg($end);
exec("/usr/local/bin/rrdtool fetch {$rrd} AVERAGE -r {$resolution} -s {$start} -e {$end} | grep -v nan | awk '{ sum1 += $2/(1024*1024); sum2 += $3/(1024*1024) } END { printf \"%u|%u\", sum1*{$resolution}, sum2*{$resolution}; }'", $traffic);
return explode('|', trim($traffic[0]));
}
@@ -55,19 +58,20 @@ function print_rrd_summary_table($data) { ?>
}
$pgtitle = "Status: RRD Summary";
-include("head.inc");
-include("fbegin.inc");
+include_once("head.inc");
+echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">";
+include_once("fbegin.inc");
$rrds = glob("/var/db/rrd/*-traffic.rrd");
?>
-<form name="form1" action="status_rrd_summary.php" method="POST">
- RRD Database:
+<form name="form1" action="status_rrd_summary.php" method="post">
+ RRD Database:&nbsp;
<select name="rrd" class="formselect" onchange="document.form1.submit()">
<?php
foreach ($rrds as $r) {
$r = basename($r);
- $selected = ($r == $rrd) ? " selected" : "";
+ $selected = ($r == $rrd) ? ' selected="selected"' : '';
print "<option value=\"{$r}\"{$selected}>{$r}</option>";
} ?>
</select>
@@ -75,7 +79,7 @@ $rrds = glob("/var/db/rrd/*-traffic.rrd");
<select name="startday" class="formselect" onchange="document.form1.submit()">
<?php
for ($day=1; $day < 29; $day++) {
- $selected = ($day == $startday) ? " selected" : "";
+ $selected = ($day == $startday) ? ' selected="selected"' : "";
print "<option value=\"{$day}\"{$selected}>{$day}</option>";
} ?>
</select>
@@ -87,4 +91,6 @@ This Month (to date, does not include this hour, starting at day <?php echo $sta
Last Month:
<?php print_rrd_summary_table($lastmonth); ?>
-<?php include("fend.inc"); ?>
+<?php include_once("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/sudo/sudo.inc b/config/sudo/sudo.inc
index 1c07984d..ed0feb9c 100644
--- a/config/sudo/sudo.inc
+++ b/config/sudo/sudo.inc
@@ -1,8 +1,9 @@
<?php
/*
sudo.inc
-
+ part of pfSense (https://www.pfSense.org/)
Copyright (C) 2013 Jim Pingle (jpingle@gmail.com)
+ Copyright (C) 2015 ESF, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,7 +33,7 @@ global $pfs_version;
$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.
+ /* Hackish way to detect if someone manually did pkg_add rather than use pbi. */
if (is_dir('/usr/pbi/sudo-' . php_uname("m"))) {
define('SUDO_BASE', '/usr/pbi/sudo-' . php_uname("m"));
define('SUDO_LIBEXEC_DIR', '/usr/local/libexec/');
@@ -43,7 +44,7 @@ switch ($pfs_version) {
break;
case "2.2":
define('SUDO_BASE','/usr/local');
- // Hackish way to detect if someone manually did pkg_add rather than use pbi.
+ /* Hackish way to detect if someone manually did pkg_add rather than use pbi. */
if (is_dir('/usr/pbi/sudo-' . php_uname("m"))) {
define('SUDO_LIBEXEC_DIR', '/usr/pbi/sudo-' . php_uname("m") . '/local/libexec/sudo');
} else {
@@ -132,16 +133,19 @@ function sudo_write_config() {
conf_mount_ro();
}
-/* Get a list of users and groups in a format we can use to make proper sudoers entries.
+/*
+Get a list of users and groups in a format we can use to make proper sudoers entries.
Optionally include "ALL" as a user (for use by the Run As list)
*/
function sudo_get_users($list_all_user = false) {
global $config;
- 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['system']['group']))
+ if (!is_array($config['system']['group'])) {
$config['system']['group'] = array();
+ }
$a_group = &$config['system']['group'];
$users = array();
@@ -174,8 +178,9 @@ function sudo_get_users($list_all_user = false) {
foreach ($a_group as $group) {
/* The "all" group is internal and doesn't make sense to use here. */
- if ($group['name'] == "all")
+ if ($group['name'] == "all") {
continue;
+ }
$tmpgroup = array();
$tmpgroup["name"] = "group:{$group['name']}";
$tmpgroup["descr"] = "Group: {$group['name']}";
@@ -185,20 +190,23 @@ function sudo_get_users($list_all_user = false) {
return $users;
}
-/* Make sure commands passed in are valid executables to help ensure a valid sudoers file and expected behavior.
- This also forces the user to give full paths to executables, which they should be doing anyhow.
+/*
+Make sure commands passed in are valid executables to help ensure a valid sudoers file and expected behavior.
+This also forces the user to give full paths to executables, which they should be doing anyhow.
*/
function sudo_validate_commands(&$input_errors) {
$idx = 0;
while(isset($_POST["cmdlist{$idx}"])) {
$commands = $_POST["cmdlist" . $idx++];
- if (strtoupper($commands) == "ALL")
+ if (strtoupper($commands) == "ALL") {
continue;
+ }
$commands = explode(",", $commands);
foreach ($commands as $command) {
list($cmd, $params) = explode(" ", trim($command), 2);
- if (!is_executable($cmd))
+ if (!is_executable($cmd)) {
$input_errors[] = htmlspecialchars($cmd) . " is not an executable command.";
+ }
}
}
}
diff --git a/config/sudo/sudo.xml b/config/sudo/sudo.xml
index 069606ba..e9b4dcbb 100644
--- a/config/sudo/sudo.xml
+++ b/config/sudo/sudo.xml
@@ -1,9 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ====================================================================================== */
+/*
+ sudo.xml
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 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>Sudo Command Control</description>
<requirements>None</requirements>
<name>sudo</name>
- <version>0.2.5</version>
+ <version>0.2.6</version>
<title>Sudo - Shell Command Privilege Delegation Utility</title>
<include_file>/usr/local/pkg/sudo.inc</include_file>
<menu>
@@ -15,7 +54,6 @@
<configpath>installedpackages->package->sudo</configpath>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
- <chmod>077</chmod>
<item>https://packages.pfsense.org/packages/config/sudo/sudo.inc</item>
</additional_files_needed>
<fields>