aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/apache_mod_security-dev/apache_balancer.template4
-rw-r--r--config/apache_mod_security-dev/apache_mod_security.inc2
-rw-r--r--config/bandwidthd/bandwidthd.inc110
-rw-r--r--config/bandwidthd/bandwidthd.xml44
-rw-r--r--config/haproxy-devel/haproxy.inc2
-rw-r--r--config/mailreport/mail_reports.inc61
-rw-r--r--config/mailreport/mail_reports_generate.php35
-rw-r--r--config/mailreport/mailreport.xml14
-rw-r--r--config/mailreport/status_mail_report.php12
-rw-r--r--config/mailreport/status_mail_report_add_cmd.php146
-rw-r--r--config/mailreport/status_mail_report_add_graph.php15
-rw-r--r--config/mailreport/status_mail_report_add_log.php162
-rw-r--r--config/mailreport/status_mail_report_edit.php126
-rw-r--r--config/openbgpd/openbgpd.inc94
-rw-r--r--config/openbgpd/openbgpd_neighbors.xml4
-rw-r--r--config/openbgpd/openbgpd_status.php1
-rwxr-xr-xconfig/pf-blocker/pfblocker.inc33
-rwxr-xr-xconfig/snort/snort.inc9
-rw-r--r--config/squidGuard/squidguard_configurator.inc3
-rw-r--r--config/systempatches/apply_patches.php11
-rw-r--r--config/systempatches/patches.inc63
-rw-r--r--config/systempatches/system_patches.php6
-rw-r--r--config/systempatches/system_patches_edit.php6
-rw-r--r--config/systempatches/systempatches.xml14
24 files changed, 784 insertions, 193 deletions
diff --git a/config/apache_mod_security-dev/apache_balancer.template b/config/apache_mod_security-dev/apache_balancer.template
index 361a5ed4..06422125 100644
--- a/config/apache_mod_security-dev/apache_balancer.template
+++ b/config/apache_mod_security-dev/apache_balancer.template
@@ -6,7 +6,7 @@ $balancer_config= <<<EOF
# then edit /usr/local/pkg/apache_* files. #
# #
# And don't forget to submit your changes to: #
-# https://github.com/bsdperimeter/pfsense-packages #
+# https://github.com/pfsense/pfsense-packages #
##################################################################################
SetOutputFilter DEFLATE
SetInputFilter DEFLATE
@@ -37,4 +37,4 @@ Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_
EOF;
-?> \ No newline at end of file
+?>
diff --git a/config/apache_mod_security-dev/apache_mod_security.inc b/config/apache_mod_security-dev/apache_mod_security.inc
index cdee4f6b..57f5407b 100644
--- a/config/apache_mod_security-dev/apache_mod_security.inc
+++ b/config/apache_mod_security-dev/apache_mod_security.inc
@@ -321,7 +321,7 @@ function generate_apache_configuration() {
# then edit /usr/local/pkg/apache_* files. #
# #
# And don't forget to submit your changes to: #
-# https://github.com/bsdperimeter/pfsense-packages #
+# https://github.com/pfsense/pfsense-packages #
##################################################################################
diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc
index 8821ac76..829cdf59 100644
--- a/config/bandwidthd/bandwidthd.inc
+++ b/config/bandwidthd/bandwidthd.inc
@@ -46,6 +46,8 @@ function bandwidthd_install_deinstall() {
exec("rm -f /usr/local/etc/rc.d/bandwidthd*");
exec("rm -rf " . PKG_BANDWIDTHD_BASE . "/htdocs");
exec("rm -f /usr/local/www/bandwidthd");
+ // Remove the cron job, if it is there
+ install_cron_job("/bin/kill -HUP `cat /var/run/bandwidthd.pid`", false);
conf_mount_ro();
config_unlock();
}
@@ -62,44 +64,47 @@ function bandwidthd_install_config() {
config_lock();
/* user defined values */
- $meta_refresh = $config['installedpackages']['bandwidthd']['config'][0]['meta_refresh'];
+ $bandwidthd_config = $config['installedpackages']['bandwidthd']['config'][0];
+ $meta_refresh = $bandwidthd_config['meta_refresh'];
if($meta_refresh)
$meta_refresh = "meta_refresh $meta_refresh\n";
- $graph = $config['installedpackages']['bandwidthd']['config'][0]['drawgraphs'];
+ $graph = $bandwidthd_config['drawgraphs'];
if($graph)
$graph = "graph true\n";
else
$graph = "graph false\n";
- $filter_text = $config['installedpackages']['bandwidthd']['config'][0]['filter'];
+ $filter_text = $bandwidthd_config['filter'];
if($filter_text)
$filter_text = "filter $filter_text\n";
- $recover_cdf = $config['installedpackages']['bandwidthd']['config'][0]['recovercdf'];
+ $recover_cdf = $bandwidthd_config['recovercdf'];
if($recover_cdf)
$recover_cdf = "recover_cdf true\n";
- $output_cdf = $config['installedpackages']['bandwidthd']['config'][0]['outputcdf'];
+ $output_cdf = $bandwidthd_config['outputcdf'];
if($output_cdf)
- $output_cdf = "output_cdf true\n";
- $promiscuous = $config['installedpackages']['bandwidthd']['config'][0]['promiscuous'];
+ $output_cdf_string = "output_cdf true\n";
+ else
+ $output_cdf_string = "";
+ $promiscuous = $bandwidthd_config['promiscuous'];
if($promiscuous)
$promiscuous = "promiscuous true\n";
else
$promiscuous = "promiscuous false\n";
- $graph_cutoff = $config['installedpackages']['bandwidthd']['config'][0]['graphcutoff'];
+ $graph_cutoff = $bandwidthd_config['graphcutoff'];
if($graph_cutoff)
$graph_cutoff = "graph_cutoff $graph_cutoff\n";
- $skip_intervals = $config['installedpackages']['bandwidthd']['config'][0]['skipintervals'];
+ $skip_intervals = $bandwidthd_config['skipintervals'];
if($skip_intervals)
$skip_intervals = "skip_intervals $skip_intervals\n";
- if($config['installedpackages']['bandwidthd']['config'][0]['active_interface']){
- $ifdescrs = array($config['installedpackages']['bandwidthd']['config'][0]['active_interface']);
+ if($bandwidthd_config['active_interface']){
+ $ifdescrs = array($bandwidthd_config['active_interface']);
} else {
log_error("You should specify an interface for bandwidthd to listen on. Exiting.");
}
- $subnets_custom = explode(';',str_replace(' ','',$config['installedpackages']['bandwidthd']['config'][0]['subnets_custom']));
+ $subnets_custom = explode(';',str_replace(' ','',$bandwidthd_config['subnets_custom']));
/* initialize to "" */
$subnets = "";
@@ -180,7 +185,7 @@ $graph_cutoff
$promiscuous
#Log data to cdf file htdocs/log.cdf
-$output_cdf
+$output_cdf_string
#Read back the cdf file on startup
$recover_cdf
@@ -208,26 +213,40 @@ EOF;
fwrite($fd, $config_file);
fclose($fd);
+ if ($g['platform'] == 'nanobsd') {
+ $bandwidthd_nano_dir = "/var/bandwidthd";
+ $bandwidthd_htdocs_dir = $bandwidthd_nano_dir . "/htdocs";
+ if (!is_dir($bandwidthd_nano_dir)) {
+ if (file_exists($bandwidthd_nano_dir)) {
+ unlink($bandwidthd_nano_dir);
+ }
+ mkdir($bandwidthd_nano_dir);
+ }
+ } else {
+ $bandwidthd_htdocs_dir = $bandwidthd_base_dir . "/htdocs";
+ }
+
$rc = array();
$rc['file'] = 'bandwidthd.sh';
$rc['stop'] = <<<EOD
/usr/bin/killall bandwidthd
EOD;
- if ($g['platform'] == 'nanobsd') {
- // On nanobsd, /var/bandwidthd is created.
- // In that is a real /var/bandwidth/htdocs, where the graph data is written
- // A soft link to the real bandwidth program is made - /var/bandwidthd/bandwidthd
- // A soft link to the etc folder with the conf file is made - /var/bandwidthd/etc
- // bandwidthd is started from /var/bandwidthd with the current dir /var/bandwidth
- // This way, it:
- // looks in ./etc for the conf file
- // writes graph files in ./htdocs
- // writes cdf log files (if selected in the config) to ./
- // All of this is on the /var filesystem, which is a read-write memory disk on nanobsd
- $bandwidthd_nano_dir = "/var/bandwidthd";
- $bandwidthd_htdocs_dir = $bandwidthd_nano_dir . "/htdocs";
- $rc['start'] = <<<EOD
+ // If this is an old config before the enable checkbox was added, then enable by default
+ $bandwidthd_enable = (!isset($bandwidthd_config['enable']) || ($bandwidthd_config['enable']));
+ if ($bandwidthd_enable) {
+ if ($g['platform'] == 'nanobsd') {
+ // On nanobsd, /var/bandwidthd is created.
+ // In that is a real /var/bandwidth/htdocs, where the graph data is written
+ // A soft link to the real bandwidth program is made - /var/bandwidthd/bandwidthd
+ // A soft link to the etc folder with the conf file is made - /var/bandwidthd/etc
+ // bandwidthd is started from /var/bandwidthd with the current dir /var/bandwidth
+ // This way, it:
+ // looks in ./etc for the conf file
+ // writes graph files in ./htdocs
+ // writes cdf log files (if selected in the config) to ./
+ // All of this is on the /var filesystem, which is a read-write memory disk on nanobsd
+ $rc['start'] = <<<EOD
if [ ! -d "{$bandwidthd_nano_dir}" ] ; then
if [ -e "{$bandwidthd_nano_dir}" ] ; then
/bin/rm -f {$bandwidthd_nano_dir}
@@ -252,22 +271,25 @@ if [ ! -L "{$bandwidthd_nano_dir}/etc" ] ; then
fi
/bin/ln -s {$bandwidthd_config_dir} {$bandwidthd_nano_dir}/etc
fi
-
+if [ ! -f "{$bandwidthd_htdocs_dir}/legend.gif" ] ; then
+ /bin/cp {$bandwidthd_base_dir}/htdocs/legend.gif {$bandwidthd_htdocs_dir}
+fi
+if [ ! -f "{$bandwidthd_htdocs_dir}/logo.gif" ] ; then
+ /bin/cp {$bandwidthd_base_dir}/htdocs/logo.gif {$bandwidthd_htdocs_dir}
+fi
cd {$bandwidthd_nano_dir}
{$bandwidthd_nano_dir}/bandwidthd
cd -
EOD;
- if (!is_dir($bandwidthd_nano_dir)) {
- if (file_exists($bandwidthd_nano_dir)) {
- unlink($bandwidthd_nano_dir);
- }
- mkdir($bandwidthd_nano_dir);
- }
- } else {
- $bandwidthd_htdocs_dir = $bandwidthd_base_dir . "/htdocs";
- $rc['start'] = <<<EOD
+ } else {
+ $rc['start'] = <<<EOD
/usr/local/bandwidthd/bandwidthd
EOD;
+ }
+ } else {
+ // bandwidthd is disabled, so do not put any real start commands in the script.
+ // This effectively disables it but keeps all the files in place (e.g. saved logs) ready to reload when it is enabled.
+ $rc['start'] = "return";
}
/* write out rc.d start/stop file */
@@ -292,10 +314,22 @@ EOD;
if (!file_exists($bandwidthd_index_file)) {
exec("echo \"Please start bandwidthd to populate this directory.\" > " . $bandwidthd_index_file);
}
+
+ if (($bandwidthd_enable) && ($output_cdf)) {
+ // Use cron job to rotate logs every day at 00:01
+ install_cron_job("/bin/kill -HUP `cat /var/run/bandwidthd.pid`", true, "1", "0");
+ }
+ else
+ {
+ // Remove the cron job, if it is there
+ install_cron_job("/bin/kill -HUP `cat /var/run/bandwidthd.pid`", false);
+ }
conf_mount_ro();
config_unlock();
stop_service("bandwidthd");
- start_service("bandwidthd");
+ if ($bandwidthd_enable) {
+ start_service("bandwidthd");
+ }
}
?>
diff --git a/config/bandwidthd/bandwidthd.xml b/config/bandwidthd/bandwidthd.xml
index f82ac69d..f306546a 100644
--- a/config/bandwidthd/bandwidthd.xml
+++ b/config/bandwidthd/bandwidthd.xml
@@ -7,7 +7,7 @@
/* $Id$ */
/* ========================================================================== */
/*
- authng.xml
+ bandwidthd.xml
part of pfSense (http://www.pfSense.com)
Copyright (C) 2007 to whom it may belong
All rights reserved.
@@ -41,10 +41,10 @@
*/
/* ========================================================================== */
]]>
- </copyright>
- <description>Describe your package here</description>
- <requirements>Describe your package requirements here</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
+ </copyright>
+ <description>Describe your package here</description>
+ <requirements>Describe your package requirements here</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
<name>bandwidthd</name>
<version>2.0.1.4</version>
<title>Bandwidthd</title>
@@ -60,7 +60,7 @@
<name>bandwidthd</name>
<rcfile>bandwidthd.sh</rcfile>
<executable>bandwidthd</executable>
- </service>
+ </service>
<tabs>
<tab>
<text>BandwidthD</text>
@@ -80,6 +80,12 @@
</additional_files_needed>
<fields>
<field>
+ <fielddescr>Enable bandwidthd</fielddescr>
+ <fieldname>enable</fieldname>
+ <type>checkbox</type>
+ <description></description>
+ </field>
+ <field>
<fielddescr>Interface</fielddescr>
<fieldname>active_interface</fieldname>
<description>The interface that bandwidthd will bind to.</description>
@@ -96,7 +102,7 @@
<field>
<fielddescr>Skip intervals</fielddescr>
<fieldname>skipintervals</fieldname>
- <description>Number of intervals (2.5 minute) to skip between graphing. Default 0.</description>
+ <description>Number of intervals to skip between graphing. Default 0. Each interval is 200 seconds = 3 min 20 sec.</description>
<type>input</type>
</field>
<field>
@@ -108,19 +114,20 @@
<field>
<fielddescr>Promiscuous</fielddescr>
<fieldname>promiscuous</fieldname>
- <description>Put interface in promiscuous mode to score to traffic that may not be routing through the host machine.</description>
+ <description>Put interface in promiscuous mode to see traffic that may not be routing through the host machine.&lt;br&gt;
+ Note: If the interface is connected to a switch then the interface will only see the traffic on its port.</description>
<type>checkbox</type>
</field>
<field>
<fielddescr>output_cdf</fielddescr>
<fieldname>outputcdf</fieldname>
- <description>Log data to cdf file htdocs/log.cdf</description>
+ <description>Log data to cdf files log*.cdf</description>
<type>checkbox</type>
</field>
<field>
<fielddescr>recover_cdf</fielddescr>
<fieldname>recovercdf</fieldname>
- <description>Read back the cdf file on startup</description>
+ <description>Read back the cdf files on startup</description>
<type>checkbox</type>
</field>
<field>
@@ -139,9 +146,24 @@
<field>
<fielddescr>Meta Refresh</fielddescr>
<fieldname>meta_refresh</fieldname>
- <description>Set META REFRESH seconds (default 150, use 0 to disable).</description>
+ <description>Sets the interval (seconds) at which the browser graph display refreshes (default 150, use 0 to disable).</description>
<type>input</type>
</field>
+ <field>
+ <fielddescr>Graph and Log Info</fielddescr>
+ <fieldname>graph_log_info</fieldname>
+ <description>If draw graphs is on, then the daily report and graph html data is regenerated every (skip intervals + 1) * 200 seconds. The data volumes in the report are for the same period as the span of the graph.&lt;br&gt;
+ If output_cdf is on, then a cron job is added to rotate the log files at 00:01 each day. 6 log files are kept for each log frequency (daily, weekly, monthly, yearly). At the respective rotation intervals, the oldest log is deleted, the others are shuffled back and a new log is created.&lt;br&gt;
+ &lt;table cellpadding=1 cellspacing=0 style=&quot;text-align: left;&quot;&gt; &lt;tbody&gt;
+ &lt;tr&gt;&lt;th&gt; &lt;/th&gt;&lt;th&gt; Data Interval &lt;/th&gt;&lt;th&gt; Graph Span &lt;/th&gt;&lt;th&gt; Log Rotation &lt;/th&gt;&lt;th&gt; Log File Name &lt;/th&gt;&lt;/tr&gt;
+ &lt;tr&gt;&lt;th&gt; Daily &lt;/th&gt;&lt;td&gt; 200 seconds &lt;/td&gt;&lt;td&gt; 2 days &lt;/td&gt;&lt;td&gt; 1 day &lt;/td&gt;&lt;td&gt; log.1.[0-5].cdf &lt;/td&gt;&lt;/tr&gt;
+ &lt;tr&gt;&lt;th&gt; Weekly &lt;/th&gt;&lt;td&gt; 10 minutes &lt;/td&gt;&lt;td&gt; 7 days &lt;/td&gt;&lt;td&gt; 7 days &lt;/td&gt;&lt;td&gt; log.2.[0-5].cdf &lt;/td&gt;&lt;/tr&gt;
+ &lt;tr&gt;&lt;th&gt; Monthly &lt;/th&gt;&lt;td&gt; 1 hour &lt;/td&gt;&lt;td&gt; 35 days &lt;/td&gt;&lt;td&gt; 35 days &lt;/td&gt;&lt;td&gt; log.3.[0-5].cdf &lt;/td&gt;&lt;/tr&gt;
+ &lt;tr&gt;&lt;th&gt; Yearly &lt;/th&gt;&lt;td&gt; 12 hours &lt;/td&gt;&lt;td&gt; 412.5 days &lt;/td&gt;&lt;td&gt; 412.5 days &lt;/td&gt;&lt;td&gt; log.4.[0-5].cdf &lt;/td&gt;&lt;/tr&gt;
+ &lt;/tbody&gt; &lt;/table&gt;
+ </description>
+ <type>info</type>
+ </field>
</fields>
<custom_php_resync_config_command>
bandwidthd_install_config();
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index 9a291f7a..93c9ec0b 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -578,7 +578,7 @@ function haproxy_writeconf() {
//ssl crt ./server.pem ca-file ./ca.crt verify optional crt-ignore-err all crl-file ./ca_crl.pem
$ssl_crt=" crt /var/etc/{$backend['name']}.{$backend['port']}.crt";
$cert = lookup_cert($backend['ssloffloadcert']);
- $certcontent = base64_decode($cert['crt']).base64_decode($cert['prv']);
+ $certcontent = base64_decode($cert['crt'])."\r\n".base64_decode($cert['prv']);
file_put_contents("/var/etc/{$backend['name']}.{$backend['port']}.crt", $certcontent);
unset($certcontent);
}else{
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc
index 8ab31301..85b67ddf 100644
--- a/config/mailreport/mail_reports.inc
+++ b/config/mailreport/mail_reports.inc
@@ -29,6 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+require_once("globals.inc");
require_once("config.inc");
require_once("filter.inc");
require_once("rrd.inc");
@@ -42,6 +43,28 @@ $graph_length = array(
"year" => 31622400,
"4year" => 126489600);
+$logfile_friendly = array(
+ "dhcpd" => "DHCP",
+ "filter" => "Firewall (raw)",
+ "gateways" => "Gateway Events",
+ "installer" => "Installation",
+ "ipsec" => "IPsec VPN",
+ "l2tps" => "L2TP Server (raw)",
+ "lighttpd" => "Web Server (lighttpd)",
+ "ntpd" => "NTP",
+ "openvpn" => "OpenVPN",
+ "poes" => "PPPoE Server (raw)",
+ "portalauth" => "Captive Portal Authentication",
+ "ppp" => "PPP",
+ "pptps" => "PPTP Server (raw)",
+ "relayd" => "Load Balancer (relayd)",
+ "resolver" => "DNS Resolver",
+ "routing" => "Routing",
+ "system" => "System",
+ "vpn" => "PPTP/L2TP/PPPoE Server Login Events",
+ "wireless" => "Wireless"
+);
+
function get_dates($curperiod, $graph) {
global $graph_length;
$now = time();
@@ -162,7 +185,7 @@ function set_mail_report_cron_jobs($a_mailreports) {
include('phpmailer/class.phpmailer.php');
-function mail_report_send($headertext, $attachments) {
+function mail_report_send($headertext, $cmdtext, $logtext, $attachments) {
global $config, $g;
if (empty($config['notifications']['smtp']['ipaddress']))
@@ -191,7 +214,11 @@ function mail_report_send($headertext, $attachments) {
$address = $config['notifications']['smtp']['notifyemailaddress'];
$mail->AddAddress($address, "Report Recipient");
$mail->Subject = "{$config['system']['hostname']}.{$config['system']['domain']} Graph Report: {$headertext}";
- $mail->Body .= "This is a periodic graph report from your firewall, {$config['system']['hostname']}.{$config['system']['domain']}.<br/><br/>Current report: {$headertext}\n";
+ $mail->Body .= "This is a periodic report from your firewall, {$config['system']['hostname']}.{$config['system']['domain']}.<br /><br />Current report: {$headertext}<br />\n<br />\n";
+ if (!empty($cmdtext))
+ $mail->Body .= $cmdtext;
+ if (!empty($logtext))
+ $mail->Body .= $logtext;
if(is_array($attachments)) {
foreach($attachments as $filename) {
$shortname = basename($filename);
@@ -203,7 +230,7 @@ function mail_report_send($headertext, $attachments) {
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
- echo "<strong>Message sent to {$userid}!</strong>\n";
+ echo "<strong>Message sent to {$address}!</strong>\n";
}
}
@@ -1201,4 +1228,32 @@ function timeDiff($time, $opt = array()) {
return $str;
}
+function mail_report_get_log($logfile, $tail, $grepfor) {
+ global $g, $config;
+ $logfile = "{$g['varlog_path']}/{$logfile}";
+ $logarr = "";
+ $grepline = " ";
+ if(is_array($grepfor))
+ foreach($grepfor as $agrep)
+ $grepline .= " | grep \"$agrep\"";
+ if($config['system']['disablesyslogclog']) {
+ exec("cat {$logfile}{$grepline} | /usr/bin/tail -n {$tail}", $logarr);
+ } else {
+ if(isset($config['system']['usefifolog'])) {
+ exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail -n {$tail}", $logarr);
+ } else {
+ exec("/usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail -n {$tail}", $logarr);
+ }
+ }
+ return($logarr);
+}
+
+function get_friendly_log_name($logfile) {
+ global $logfile_friendly;
+ $friendly = str_replace(".log", "", $logfile);
+ if (!empty($logfile_friendly[$friendly]))
+ $friendly = $logfile_friendly[$friendly];
+ return $friendly;
+}
+
?>
diff --git a/config/mailreport/mail_reports_generate.php b/config/mailreport/mail_reports_generate.php
index 7ff7b71e..a784c596 100644
--- a/config/mailreport/mail_reports_generate.php
+++ b/config/mailreport/mail_reports_generate.php
@@ -53,17 +53,42 @@ if (!$config['mailreports']['schedule'][$id])
exit;
$thisreport = $config['mailreports']['schedule'][$id];
+$cmds = $thisreport['cmd']['row'];
+$logs = $thisreport['log']['row'];
$graphs = $thisreport['row'];
-// No graphs on the report, bail!
-if (!is_array($graphs) || !(count($graphs) > 0))
- exit;
+// If there is nothing to do, bail!
+if ((!is_array($cmds) || !(count($cmds) > 0))
+ && (!is_array($logs) || !(count($logs) > 0))
+ && (!is_array($graphs) || !(count($graphs) > 0)))
+ return;
// Print report header
+// Print command output
+$cmdtext = "";
+foreach ($cmds as $cmd) {
+ $output = "";
+ $cmdtext .= "Command output: {$cmd['descr']} (" . htmlspecialchars($cmd['detail']) . ")<br />\n";
+ exec($cmd['detail'], $output);
+ $cmdtext .= "<pre>\n";
+ $cmdtext .= implode("\n", $output);
+ $cmdtext .= "\n</pre>";
+}
+
+// Print log output
+$logtext = "";
+foreach ($logs as $log) {
+ $lines = empty($log['lines']) ? 50 : $log['lines'];
+ $filter = empty($log['detail']) ? null : array($log['detail']);
+ $logtext .= "Log output: " . get_friendly_log_name($log['logfile']) . " ({$log['logfile']})<br />\n";
+ $logtext .= "<pre>\n";
+ $logtext .= implode("\n", mail_report_get_log($log['logfile'], $lines, $filter));
+ $logtext .= "\n</pre>";
+}
+
// For each graph, print a header and the graph
$attach = array();
-$idx=0;
foreach ($graphs as $thisgraph) {
$dates = get_dates($thisgraph['period'], $thisgraph['timespan']);
$start = $dates['start'];
@@ -71,6 +96,6 @@ foreach ($graphs as $thisgraph) {
$attach[] = mail_report_generate_graph($thisgraph['graph'], $thisgraph['style'], $thisgraph['timespan'], $start, $end);
}
-mail_report_send($thisreport['descr'], $attach);
+mail_report_send($thisreport['descr'], $cmdtext, $logtext, $attach);
?> \ No newline at end of file
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index 613ac42f..d27d3a28 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,7 +37,7 @@
]]>
</copyright>
<name>mailreport</name>
- <version>1.0</version>
+ <version>2.0.4</version>
<title>Status: Mail Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
@@ -70,11 +70,19 @@
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
+ <item>http://www.pfsense.com/packages/config/mailreport/status_mail_report_add_cmd.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <item>http://www.pfsense.com/packages/config/mailreport/status_mail_report_add_log.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
<item>http://www.pfsense.com/packages/config/mailreport/status_mail_report_add_graph.php</item>
</additional_files_needed>
<menu>
- <name>RRD E-Mail Reports</name>
- <tooltiptext>Setup periodic e-mail reports with RRD graphs.</tooltiptext>
+ <name>E-Mail Reports</name>
+ <tooltiptext>Setup periodic e-mail reports.</tooltiptext>
<section>Status</section>
<url>/status_mail_report.php</url>
</menu>
diff --git a/config/mailreport/status_mail_report.php b/config/mailreport/status_mail_report.php
index 4dc195bc..b1705fac 100644
--- a/config/mailreport/status_mail_report.php
+++ b/config/mailreport/status_mail_report.php
@@ -74,11 +74,13 @@ include("head.inc");
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td><div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr><td colspan="4">Here you can define a list of reports, containing multiple RRD graphs, to be sent by e-mail. </td></tr>
+ <tr><td colspan="4">Here you can define a list of reports to be sent by e-mail. </td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
- <td width="45%" class="listhdr"><?=gettext("Description");?></td>
- <td width="35%" class="listhdr"><?=gettext("Schedule");?></td>
+ <td width="35%" class="listhdr"><?=gettext("Description");?></td>
+ <td width="25%" class="listhdr"><?=gettext("Schedule");?></td>
+ <td width="10%" class="listhdr"><?=gettext("Cmds");?></td>
+ <td width="10%" class="listhdr"><?=gettext("Logs");?></td>
<td width="10%" class="listhdr"><?=gettext("Graphs");?></td>
<td width="10%" class="list"><a href="status_mail_report_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
</tr>
@@ -86,6 +88,8 @@ include("head.inc");
<tr ondblclick="document.location='status_mail_report_edit.php?id=<?=$i;?>'">
<td class="listlr"><?php echo $mailreport['descr']; ?></td>
<td class="listlr"><?php echo $mailreport['schedule_friendly']; ?></td>
+ <td class="listlr"><?php echo count($mailreport['cmd']['row']); ?></td>
+ <td class="listlr"><?php echo count($mailreport['log']['row']); ?></td>
<td class="listlr"><?php echo count($mailreport['row']); ?></td>
<td valign="middle" nowrap class="list">
<a href="status_mail_report_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
@@ -95,7 +99,7 @@ include("head.inc");
</tr>
<?php $i++; endforeach; ?>
<tr>
- <td class="list" colspan="3"></td>
+ <td class="list" colspan="5"></td>
<td class="list"><a href="status_mail_report_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
</tr>
<tr>
diff --git a/config/mailreport/status_mail_report_add_cmd.php b/config/mailreport/status_mail_report_add_cmd.php
new file mode 100644
index 00000000..7693f7a4
--- /dev/null
+++ b/config/mailreport/status_mail_report_add_cmd.php
@@ -0,0 +1,146 @@
+<?php
+/* $Id$ */
+/*
+ status_rrd_graph.php
+ Part of pfSense
+ Copyright (C) 2011 Jim Pingle <jimp@pfsense.org>
+ Portions Copyright (C) 2007-2011 Seth Mos <seth.mos@dds.nl>
+ 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.
+*/
+/*
+ pfSense_MODULE: system
+*/
+
+##|+PRIV
+##|*IDENT=page-status-rrdgraphs
+##|*NAME=Status: RRD Graphs page
+##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
+##|*MATCH=status_rrd_graph.php*
+##|-PRIV
+
+require("guiconfig.inc");
+require_once("mail_reports.inc");
+
+$reportid = $_REQUEST['reportid'];
+$id = $_REQUEST['id'];
+
+if (!is_array($config['mailreports']['schedule']))
+ $config['mailreports']['schedule'] = array();
+
+$a_mailreports = &$config['mailreports']['schedule'];
+
+if (!isset($reportid) || !isset($a_mailreports[$reportid])) {
+ header("Location: status_mail_report.php");
+ return;
+}
+
+if (!is_array($a_mailreports[$reportid]['cmd']['row'])) {
+ $a_mailreports[$reportid]['cmd'] = array();
+ $a_mailreports[$reportid]['cmd']['row'] = array();
+}
+$a_cmds = $a_mailreports[$reportid]['cmd']['row'];
+
+if (isset($id) && $a_cmds[$id]) {
+ $pconfig = $a_cmds[$id];
+} else {
+ $pconfig = array();
+}
+
+if (isset($id) && !($a_cmds[$id])) {
+ header("Location: status_mail_report_edit.php?id={$reportid}");
+ return;
+}
+
+if ($_POST) {
+ unset($_POST['__csrf_magic']);
+ $pconfig = $_POST;
+
+ if (isset($id) && $a_cmds[$id])
+ $a_cmds[$id] = $pconfig;
+ else
+ $a_cmds[] = $pconfig;
+
+ $a_mailreports[$reportid]['cmd']['row'] = $a_cmds;
+
+ write_config();
+ header("Location: status_mail_report_edit.php?id={$reportid}");
+ return;
+}
+
+
+$pgtitle = array(gettext("Status"),gettext("Add Mail Report Command"));
+include("head.inc");
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td><div id="mainarea">
+ <form action="status_mail_report_add_cmd.php" method="post" name="iform" id="iform">
+ <table class="tabcont" width="100%" border="0" cellpadding="1" cellspacing="1">
+ <tr>
+ <td class="listtopic" colspan="2">Command Settings</td>
+ </tr>
+ <tr>
+ <td width="20%" class="listhdr">
+ <?=gettext("Name:");?>
+ </td>
+ <td width="80%" class="listhdr">
+ <input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td class="listhdr">
+ <?=gettext("Command:");?>
+ </td>
+ <td class="listhdr">
+ <input name="detail" type="text" class="formfld unknown" id="detail" size="60" value="<?=htmlspecialchars($pconfig['detail']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>
+ <br/>NOTE: Use full paths to commands to ensure they run properly. The command will be run during the report and its stdout output will be included in the report body. Be extremely careful what commands you choose to run, the same warnings apply as those when using Diagnostics &gt; Command.
+ <br/>
+ <br/>Do not use this solely as a way to run a command on a schedule, use the Cron package for that purpose instead.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>">
+ <a href="status_mail_report_edit.php?id=<?php echo $reportid;?>"><input name="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>"></a>
+ <input name="reportid" type="hidden" value="<?=htmlspecialchars($reportid);?>">
+ <?php if (isset($id) && $a_graphs[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
+ <?php endif; ?>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </form>
+ </div></td></tr>
+</table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/mailreport/status_mail_report_add_graph.php b/config/mailreport/status_mail_report_add_graph.php
index c0287367..165124f3 100644
--- a/config/mailreport/status_mail_report_add_graph.php
+++ b/config/mailreport/status_mail_report_add_graph.php
@@ -50,13 +50,8 @@ if(! isset($config['rrd']['enable'])) {
header("Location: status_rrd_graph_settings.php");
}
-$reportid = $_GET['reportid'];
-if (isset($_POST['reportid']))
- $reportid = $_POST['reportid'];
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
- $id = $_POST['id'];
+$reportid = $_REQUEST['reportid'];
+$id = $_REQUEST['id'];
if (!is_array($config['mailreports']['schedule']))
$config['mailreports']['schedule'] = array();
@@ -65,7 +60,7 @@ $a_mailreports = &$config['mailreports']['schedule'];
if (!isset($reportid) || !isset($a_mailreports[$reportid])) {
header("Location: status_mail_report.php");
- exit;
+ return;
}
if (!is_array($a_mailreports[$reportid]['row']))
@@ -80,7 +75,7 @@ if (isset($id) && $a_graphs[$id]) {
if (isset($id) && !($a_graphs[$id])) {
header("Location: status_mail_report_edit.php?id={$reportid}");
- exit;
+ return;
}
@@ -159,7 +154,7 @@ if ($_POST) {
write_config();
header("Location: status_mail_report_edit.php?id={$reportid}");
- exit;
+ return;
}
diff --git a/config/mailreport/status_mail_report_add_log.php b/config/mailreport/status_mail_report_add_log.php
new file mode 100644
index 00000000..75d092b5
--- /dev/null
+++ b/config/mailreport/status_mail_report_add_log.php
@@ -0,0 +1,162 @@
+<?php
+/* $Id$ */
+/*
+ status_rrd_graph.php
+ Part of pfSense
+ Copyright (C) 2011 Jim Pingle <jimp@pfsense.org>
+ Portions Copyright (C) 2007-2011 Seth Mos <seth.mos@dds.nl>
+ 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.
+*/
+/*
+ pfSense_MODULE: system
+*/
+
+##|+PRIV
+##|*IDENT=page-status-rrdgraphs
+##|*NAME=Status: RRD Graphs page
+##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
+##|*MATCH=status_rrd_graph.php*
+##|-PRIV
+
+require("guiconfig.inc");
+require_once("mail_reports.inc");
+
+$reportid = $_REQUEST['reportid'];
+$id = $_REQUEST['id'];
+
+if (!is_array($config['mailreports']['schedule']))
+ $config['mailreports']['schedule'] = array();
+
+$a_mailreports = &$config['mailreports']['schedule'];
+
+if (!isset($reportid) || !isset($a_mailreports[$reportid])) {
+ header("Location: status_mail_report.php");
+ return;
+}
+
+if (!is_array($a_mailreports[$reportid]['log']['row'])) {
+ $a_mailreports[$reportid]['log'] = array();
+ $a_mailreports[$reportid]['log']['row'] = array();
+}
+$a_logs = $a_mailreports[$reportid]['log']['row'];
+
+if (isset($id) && $a_logs[$id]) {
+ $pconfig = $a_logs[$id];
+} else {
+ $pconfig = array();
+}
+
+if (isset($id) && !($a_logs[$id])) {
+ header("Location: status_mail_report_edit.php?id={$reportid}");
+ return;
+}
+
+$logpath = "/var/log/";
+chdir($logpath);
+$logfiles = glob("*.log");
+
+sort($logfiles);
+
+if ($_POST) {
+ unset($_POST['__csrf_magic']);
+ $pconfig = $_POST;
+
+ if (isset($id) && $a_logs[$id])
+ $a_logs[$id] = $pconfig;
+ else
+ $a_logs[] = $pconfig;
+
+ $a_mailreports[$reportid]['log']['row'] = $a_logs;
+
+ write_config();
+ header("Location: status_mail_report_edit.php?id={$reportid}");
+ return;
+}
+
+
+$pgtitle = array(gettext("Status"),gettext("Add Mail Report Log"));
+include("head.inc");
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td><div id="mainarea">
+ <form action="status_mail_report_add_log.php" method="post" name="iform" id="iform">
+ <table class="tabcont" width="100%" border="0" cellpadding="1" cellspacing="1">
+ <tr>
+ <td class="listtopic" colspan="2">Log Settings</td>
+ </tr>
+ <tr>
+ <td width="20%" class="listhdr">
+ <?=gettext("Logs:");?>
+ </td>
+ <td width="80%" class="listhdr">
+ <select name="logfile" class="formselect" style="z-index: -10;">
+ <?php
+ foreach ($logfiles as $logfile) {
+ echo "<option value=\"{$logfile}\"";
+ if ($pconfig['logfile'] == $logfile) {
+ echo " selected";
+ }
+ echo ">" . htmlspecialchars(get_friendly_log_name($logfile)) . "</option>\n";
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" class="listhdr">
+ <?=gettext("# Rows:");?>
+ </td>
+ <td width="80%" class="listhdr">
+ <input name="lines" type="text" class="formfld unknown" id="lines" size="10" value="<?=htmlspecialchars($pconfig['lines']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td class="listhdr">
+ <?=gettext("Filter:");?>
+ </td>
+ <td class="listhdr">
+ <input name="detail" type="text" class="formfld unknown" id="detail" size="60" value="<?=htmlspecialchars($pconfig['detail']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>">
+ <a href="status_mail_report_edit.php?id=<?php echo $reportid;?>"><input name="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>"></a>
+ <input name="reportid" type="hidden" value="<?=htmlspecialchars($reportid);?>">
+ <?php if (isset($id) && $a_logs[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
+ <?php endif; ?>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </form>
+ </div></td></tr>
+</table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php
index 3102e958..7ddb4c36 100644
--- a/config/mailreport/status_mail_report_edit.php
+++ b/config/mailreport/status_mail_report_edit.php
@@ -44,16 +44,13 @@ require_once("mail_reports.inc");
/* if the rrd graphs are not enabled redirect to settings page */
if(! isset($config['rrd']['enable'])) {
header("Location: status_rrd_graph_settings.php");
- exit;
+ return;
}
-$graphid = $_GET['graphid'];
-if (isset($_POST['graphid']))
- $graphid = $_POST['graphid'];
-
-$id = $_GET['id'];
-if (isset($_POST['id']))
- $id = $_POST['id'];
+$cmdid = $_REQUEST['cmdid'];
+$logid = $_REQUEST['logid'];
+$graphid = $_REQUEST['graphid'];
+$id = $_REQUEST['id'];
if (!is_array($config['mailreports']['schedule']))
$config['mailreports']['schedule'] = array();
@@ -63,19 +60,40 @@ if (isset($id) && $a_mailreports[$id]) {
if (!is_array($a_mailreports[$id]['row']))
$a_mailreports[$id]['row'] = array();
$pconfig = $a_mailreports[$id];
+ $a_cmds = $a_mailreports[$id]['cmd']['row'];
+ $a_logs = $a_mailreports[$id]['log']['row'];
$a_graphs = $a_mailreports[$id]['row'];
-} else {
+}
+
+if (!is_array($pconfig))
$pconfig = array();
+if (!is_array($a_cmds))
+ $a_cmds = array();
+if (!is_array($a_logs))
+ $a_logs = array();
+if (!is_array($a_graphs))
$a_graphs = array();
-}
+
if ($_GET['act'] == "del") {
- if ($a_graphs[$graphid]) {
+ if (is_numeric($cmdid) && $a_cmds[$cmdid]) {
+ unset($a_cmds[$cmdid]);
+ $a_mailreports[$id]['cmd']['row'] = $a_cmds;
+ write_config();
+ header("Location: status_mail_report_edit.php?id={$id}");
+ return;
+ } elseif (is_numeric($logid) && $a_logs[$logid]) {
+ unset($a_logs[$logid]);
+ $a_mailreports[$id]['log']['row'] = $a_logs;
+ write_config();
+ header("Location: status_mail_report_edit.php?id={$id}");
+ return;
+ } elseif (is_numeric($graphid) && $a_graphs[$graphid]) {
unset($a_graphs[$graphid]);
$a_mailreports[$id]['row'] = $a_graphs;
write_config();
header("Location: status_mail_report_edit.php?id={$id}");
- exit;
+ return;
}
}
@@ -97,7 +115,7 @@ if ($_POST) {
if ($_POST['Submit'] == "Send Now") {
mwexec_bg("/usr/local/bin/mail_reports_generate.php {$id}");
header("Location: status_mail_report_edit.php?id={$id}");
- exit;
+ return;
}
$friendly = "";
@@ -124,7 +142,9 @@ if ($_POST) {
unset($pconfig['dayofmonth']);
}
- // Copy graphs back into the schedule.
+ // Copy back into the schedule.
+ $pconfig['cmd']["row"] = $a_cmds;
+ $pconfig['log']["row"] = $a_logs;
$pconfig["row"] = $a_graphs;
$pconfig['schedule_friendly'] = $friendly;
@@ -139,7 +159,7 @@ if ($_POST) {
write_config();
configure_cron();
header("Location: status_mail_report.php");
- exit;
+ return;
}
$pgtitle = array(gettext("Status"),gettext("Edit Mail Reports"));
@@ -220,6 +240,78 @@ include("head.inc");
<td></td>
</tr>
<tr>
+ <td class="listtopic" colspan="4">Report Commands</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="30%" class="listhdr"><?=gettext("Name");?></td>
+ <td width="60%" colspan="3" class="listhdr"><?=gettext("Command");?></td>
+ <td width="10%" class="list">
+ <?php if (isset($id) && $a_mailreports[$id]): ?>
+ <a href="status_mail_report_add_cmd.php?reportid=<?php echo $id ;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
+ </td>
+ <?php else: ?>
+ </td>
+ <tr><td colspan="5" align="center"><br/>Save the report first, then items may be added.<br/></td></tr>
+ <?php endif; ?>
+ </tr>
+ <?php $i = 0; foreach ($a_cmds as $cmd): ?>
+ <tr ondblclick="document.location='status_mail_report_add_cmd.php?reportid=<?php echo $id ;?>&amp;id=<?=$i;?>'">
+ <td class="listlr"><?php echo htmlspecialchars($cmd['descr']); ?></td>
+ <td colspan="3" class="listlr"><?php echo htmlspecialchars($cmd['detail']); ?></td>
+ <td valign="middle" nowrap class="list">
+ <a href="status_mail_report_add_cmd.php?reportid=<?php echo $id ;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;
+ <a href="status_mail_report_edit.php?act=del&id=<?php echo $id ;?>&cmdid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list">
+ <?php if (isset($id) && $a_mailreports[$id]): ?>
+ <a href="status_mail_report_add_cmd.php?reportid=<?php echo $id ;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="listtopic" colspan="4">Report Logs</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="30%" class="listhdr"><?=gettext("Log");?></td>
+ <td width="20%" class="listhdr"><?=gettext("# Rows");?></td>
+ <td width="40%" colspan="2" class="listhdr"><?=gettext("Filter");?></td>
+ <td width="10%" class="list">
+ <?php if (isset($id) && $a_mailreports[$id]): ?>
+ <a href="status_mail_report_add_log.php?reportid=<?php echo $id ;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
+ </td>
+ <?php else: ?>
+ </td>
+ <tr><td colspan="5" align="center"><br/>Save the report first, then items may be added.<br/></td></tr>
+ <?php endif; ?>
+ </tr>
+ <?php $i = 0; foreach ($a_logs as $log): ?>
+ <tr ondblclick="document.location='status_mail_report_add_log.php?reportid=<?php echo $id ;?>&amp;id=<?=$i;?>'">
+ <td class="listlr"><?php echo get_friendly_log_name($log['logfile']); ?></td>
+ <td class="listlr"><?php echo $log['lines']; ?></td>
+ <td colspan="2" class="listlr"><?php echo $log['detail']; ?></td>
+ <td valign="middle" nowrap class="list">
+ <a href="status_mail_report_add_cmd.php?reportid=<?php echo $id ;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
+ &nbsp;
+ <a href="status_mail_report_edit.php?act=del&id=<?php echo $id ;?>&logid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list">
+ <?php if (isset($id) && $a_mailreports[$id]): ?>
+ <a href="status_mail_report_add_log.php?reportid=<?php echo $id ;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
<td class="listtopic" colspan="4">Report Graphs</td>
<td></td>
</tr>
@@ -234,7 +326,7 @@ include("head.inc");
</td>
<?php else: ?>
</td>
- <tr><td colspan="5" align="center"><br/>Save the report first, then you may add graphs.<br/></td></tr>
+ <tr><td colspan="5" align="center"><br/>Save the report first, then items may be added.<br/></td></tr>
<?php endif; ?>
</tr>
<?php $i = 0; foreach ($a_graphs as $graph):
@@ -246,7 +338,7 @@ include("head.inc");
}
$prettyprint = ucwords(implode(" :: ", $optionc));
?>
- <tr ondblclick="document.location='status_mail_report_edit.php?id=<?=$i;?>'">
+ <tr ondblclick="document.location='status_mail_report_add_graph.php?reportid=<?php echo $id ;?>&amp;id=<?=$i;?>'">
<td class="listlr"><?php echo $prettyprint; ?></td>
<td class="listlr"><?php echo $graph['style']; ?></td>
<td class="listlr"><?php echo $graph['timespan']; ?></td>
diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc
index eff2855b..45449793 100644
--- a/config/openbgpd/openbgpd.inc
+++ b/config/openbgpd/openbgpd.inc
@@ -79,7 +79,6 @@ function openbgpd_install_conf() {
$openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config'];
$conffile = "# This file was created by the package manager. Do not edit!\n\n";
- $setkeycf = "";
// Setup AS #
if($openbgpd_conf['asnum'])
@@ -114,20 +113,24 @@ function openbgpd_install_conf() {
if(is_array($openbgpd_neighbors)) {
foreach($openbgpd_neighbors as $neighbor) {
if($neighbor['groupname'] == $group['name']) {
- $conffile .= " neighbor {$neighbor['neighbor']} {\n";
- $conffile .= " descr \"{$neighbor['descr']}\"\n";
- $setkeycf .= "delete {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000;\n";
+ $conffile .= "\tneighbor {$neighbor['neighbor']} {\n";
+ $conffile .= "\t\tdescr \"{$neighbor['descr']}\"\n";
if($neighbor['md5sigpass']) {
- $setkeycf .= "add {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000 -A tcp-md5 \"{$neighbor['md5sigpass']}\";\n";
- $conffile .= " tcp md5sig password {$neighbor['md5sigpass']}\n";
+ $conffile .= "\t\ttcp md5sig password {$neighbor['md5sigpass']}\n";
}
if($neighbor['md5sigkey']) {
- $setkeycf .= "add {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000 -A tcp-md5 0x{$neighbor['md5sigkey']};\n";
- $conffile .= " tcp md5sig key {$neighbor['md5sigkey']}\n";
+ $conffile .= "\t\ttcp md5sig key {$neighbor['md5sigkey']}\n";
}
- foreach($neighbor['row'] as $row) {
- $conffile .= " {$row['parameters']} {$row['parmvalue']} \n";
- }
+ $setlocaladdr = true;
+ if (is_array($neighbor['row'])) {
+ foreach($neighbor['row'] as $row) {
+ if ($row['parameters'] == "local-address")
+ $setlocaladdr = false;
+ $conffile .= "\t\t{$row['parameters']} {$row['parmvalue']} \n";
+ }
+ }
+ if ($setlocaladdr == true)
+ $conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n";
$conffile .= "}\n";
}
}
@@ -142,23 +145,25 @@ function openbgpd_install_conf() {
$used_this_item = false;
if($neighbor['groupname'] == "") {
$conffile .= "neighbor {$neighbor['neighbor']} {\n";
- $conffile .= " descr \"{$neighbor['descr']}\"\n";
- $setkeycf .= "delete {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000;\n";
+ $conffile .= "\tdescr \"{$neighbor['descr']}\"\n";
if ($neighbor['md5sigpass']) {
- $setkeycf .= "add {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000 -A tcp-md5 \"{$neighbor['md5sigpass']}\";\n";
- $conffile .= " tcp md5sig password {$neighbor['md5sigpass']}\n";
+ $conffile .= "\ttcp md5sig password {$neighbor['md5sigpass']}\n";
}
if ($neighbor['md5sigkey']) {
- $setkeycf .= "add {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000 -A tcp-md5 0x{$neighbor['md5sigkey']};\n";
- $conffile .= " tcp md5sig key {$neighbor['md5sigkey']}\n";
+ $conffile .= "\ttcp md5sig key {$neighbor['md5sigkey']}\n";
}
- $used_this_item = true;
- foreach($neighbor['row'] as $row) {
- $conffile .= " {$row['parameters']} {$row['parmvalue']} \n";
- }
+ $setlocaladdr = true;
+ if (is_array($neighbor['row'])) {
+ foreach($neighbor['row'] as $row) {
+ if ($row['parameters'] == "local-address")
+ $setlocaladdr = false;
+ $conffile .= "\t{$row['parameters']} {$row['parmvalue']} \n";
+ }
+ }
+ if ($setlocaladdr == true)
+ $conffile .= "\tlocal-address {$openbgpd_conf['listenip']}\n";
}
- if($used_this_item)
- $conffile .= "}\n";
+ $conffile .= "}\n";
}
}
@@ -173,17 +178,13 @@ function openbgpd_install_conf() {
}
}
safe_mkdir($bgpd_config_base);
- $fd = fopen("{$bgpd_config_base}/bgpd.conf", "w");
-
- // Write out the configuration file
- fwrite($fd, $conffile);
-
- // Close file handle
- fclose($fd);
+ // Write out the configuration file
+ @file_put_contents("{$bgpd_config_base}/bgpd.conf", $conffile);
+ @chmod("{$bgpd_config_base}/bgpd.conf", 0600);
// Create rc.d file
$rc_file_stop = <<<EOF
-killall -9 bgpd
+killall -TERM bgpd
EOF;
$rc_file_start = <<<EOF
@@ -195,12 +196,14 @@ if [ `pw usershow {$pkg_login} 2>&1 | grep -c "pw: no such user"` -gt 0 ]; then
fi
/bin/mkdir -p {$bgpd_config_base}
-chmod u+rw,go-rw {$bgpd_config_base}/bgpd.conf
/usr/sbin/chown -R root:wheel {$bgpd_config_base}
+/bin/chmod 0600 {$bgpd_config_base}/bgpd.conf
NUMBGPD=`ps auxw | grep -c '[b]gpd.*parent'`
if [ \${NUMBGPD} -lt 1 ] ; then
{$pkg_bin}/bgpd -f {$bgpd_config_base}/bgpd.conf
+else
+ {$pkg_bin}/bgpctl reload
fi
EOF;
write_rcfile(array(
@@ -210,17 +213,11 @@ EOF;
)
);
- // TCP-MD5 support on freebsd. See tcp(5) for more
- $fd = fopen("{$g['tmp_path']}/bgpdsetkey.conf", "w");
- fwrite($fd, $setkeycf );
- fclose($fd);
- exec("setkey -f {$g['tmp_path']}/bgpdsetkey.conf");
-
// bgpd process running? if so reload, else start.
if(is_openbgpd_running() == true) {
- exec("bgpctl reload");
+ exec("{$pkg_bin}/bgpctl reload");
} else {
- exec("bgpd");
+ exec("{$pkg_bin}/bgpd -f {$bgpd_config_base}/bgpd.conf");
}
conf_mount_ro();
@@ -250,21 +247,6 @@ function openbgpd_put_raw_config($conffile) {
function deinstall_openbgpd() {
global $config, $g;
- if($config['installedpackages']['openbgpd']['config'])
- $openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0];
- if($config['installedpackages']['openbgpdneighbors']['config'])
- $openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config'];
- $setkeycf = "";
- if(is_array($openbgpd_neighbors)) {
- foreach($openbgpd_neighbors as $neighbor)
- $setkeycf .= "delete {$openbgpd_conf['listenip']} {$neighbor['neighbor']} tcp 0x1000;\n";
- }
- // Clear all SADB entries used.
- $fd = fopen("{$g['tmp_path']}/bgpdsetkey.conf", "w");
- fwrite($fd, $setkeycf );
- fclose($fd);
- exec("setkey -f {$g['tmp_path']}/bgpdsetkey.conf");
-
exec("rm /usr/local/etc/rc.d/bgpd.sh");
exec("rm /usr/local/www/openbgpd_status.php");
exec("killall bgpd");
@@ -369,4 +351,4 @@ function is_openbgpd_running() {
return false;
}
-?> \ No newline at end of file
+?>
diff --git a/config/openbgpd/openbgpd_neighbors.xml b/config/openbgpd/openbgpd_neighbors.xml
index efa82384..5553c022 100644
--- a/config/openbgpd/openbgpd_neighbors.xml
+++ b/config/openbgpd/openbgpd_neighbors.xml
@@ -100,13 +100,13 @@
<field>
<fielddescr>TCP-MD5 key</fielddescr>
<fieldname>md5sigkey</fieldname>
- <description>The md5 key to communicate with the peer. Does not work with Cisco BGP routers.</description>
+ <description>The md5 key to communicate with the peer. Does not work with Cisco BGP routers. If the Local Addr option is not set listening ip will be used.</description>
<type>input</type>
</field>
<field>
<fielddescr>TCP-MD5 password</fielddescr>
<fieldname>md5sigpass</fieldname>
- <description>The md5 password to communicate with the peer. Use this when communicating with a Cisco BGP router.</description>
+ <description>The md5 password to communicate with the peer. Use this when communicating with a Cisco BGP router. If the Local Addr option is not set listenning ip will be used.</description>
<type>input</type>
</field>
<field>
diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php
index 3db2781a..e6f69d07 100644
--- a/config/openbgpd/openbgpd_status.php
+++ b/config/openbgpd/openbgpd_status.php
@@ -62,6 +62,7 @@ function doCmdT($title, $command) {
$fd = popen("{$command} 2>&1", "r");
while (($line = fgets($fd)) !== FALSE) {
echo htmlspecialchars($line, ENT_NOQUOTES);
+ ob_flush();
}
pclose($fd);
}
diff --git a/config/pf-blocker/pfblocker.inc b/config/pf-blocker/pfblocker.inc
index 58b93bb5..c40d742e 100755
--- a/config/pf-blocker/pfblocker.inc
+++ b/config/pf-blocker/pfblocker.inc
@@ -52,29 +52,6 @@ function cb_get_real_interface_address($iface) {
return array($ip, long2ip(hexdec($netmask)));
}
-function pfblocker_Range2CIDR($ip_min, $ip_max) {
- #function called without any args
- if ($ip_min == "" || $ip_max == "")
- return "";
- #function called with same ip in min and max
- if ($ip_min == $ip_max)
- return $ip_min. "/32";
- #convert ip to decimal numbers
- $ip_min_long=ip2long($ip_min);
- $ip_max_long=ip2long($ip_max);
- #check long results
- if ($ip_min_long == -1 || $ip_max_long == -1)
- return "";
- #identify bits mask
- $bits=(32 -strlen(decbin($ip_max_long - $ip_min_long)));
- if ($bits < 0)
- return "";
- #identify first ip on range network
- $network=long2ip( $ip_min_long & ((1<<32)-(1<<(32-$bits))-1) );
- #print decbin($ip_min_long)."\n".$network."\n";
- return $network . "/". $bits;
-}
-
function sync_package_pfblocker($cron="") {
global $g,$config;
@@ -290,10 +267,12 @@ function sync_package_pfblocker($cron="") {
foreach ($url_list as $line){
# Network range 192.168.0.0-192.168.0.254
if (preg_match("/(\d+\.\d+\.\d+\.\d+)-(\d+\.\d+\.\d+\.\d+)/",$line,$matches)){
- $cidr= pfblocker_Range2CIDR($matches[1],$matches[2]);
- if ($cidr != ""){
- ${$alias}.= $cidr."\n";
- $new_file.= $cidr."\n";
+ $a_cidr = ip_range_to_subnet_array($matches[1],$matches[2]);
+ if (is_array($a_cidr)) {
+ foreach ($a_cidr as $cidr) {
+ ${$alias}.= $cidr."\n";
+ $new_file.= $cidr."\n";
+ }
}
}
# CIDR format 192.168.0.0/16
diff --git a/config/snort/snort.inc b/config/snort/snort.inc
index c36fc873..27d0b7e5 100755
--- a/config/snort/snort.inc
+++ b/config/snort/snort.inc
@@ -38,11 +38,11 @@ require_once("functions.inc");
require_once("filter.inc");
/* package version */
-$snort_version = "2.9.2.3";
+$snort_version = "2.9.4.1";
$pfSense_snort_version = "2.5.4";
$snort_package_version = "Snort {$snort_version} pkg v. {$pfSense_snort_version}";
-$snort_rules_file = "snortrules-snapshot-2923.tar.gz";
-$emerging_threats_version = "2.9.3";
+$snort_rules_file = "snortrules-snapshot-2941.tar.gz";
+$emerging_threats_version = "2.9.0";
$flowbit_rules_file = "flowbit-required.rules";
$snort_enforcing_rules_file = "snort.rules";
@@ -1855,7 +1855,8 @@ function snort_filter_preproc_rules($snortcfg, &$active_rules) {
***************************************************/
foreach ($active_rules as $k1 => $rulem) {
foreach ($rulem as $k2 => $v) {
- if ($v['disabled'] == 0)
+ /* If rule is already disabled, skip it. */
+ if ($v['disabled'] == 1)
continue;
foreach ($rule_opts_preprocs as $opt => $preproc) {
$pcre = "/\s*\b" . $opt . "/i";
diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc
index 81f9cd96..e57b7597 100644
--- a/config/squidGuard/squidguard_configurator.inc
+++ b/config/squidGuard/squidguard_configurator.inc
@@ -414,7 +414,6 @@ function squid_reconfigure($remove_only = '')
global $squidguard_config;
$conf = '';
$cust_opt = $config['installedpackages']['squid']['config'][0]['custom_options'];
-
# remove old options
if (!empty($cust_opt)) {
$conf = explode(";", $cust_opt);
@@ -444,7 +443,7 @@ function squid_reconfigure($remove_only = '')
if (is_array($conf)) $conf = implode(";", $conf);
/* Only update squid options if we have something to do, otherwise this can interfere with squid's default options in a new install. */
- if (!empty($conf)) {
+ if ($conf != $cust_opt) {
$config['installedpackages']['squid']['config'][0]['custom_options'] = $conf;
write_config('Update redirector options to squid config.');
}
diff --git a/config/systempatches/apply_patches.php b/config/systempatches/apply_patches.php
new file mode 100644
index 00000000..3ac0d671
--- /dev/null
+++ b/config/systempatches/apply_patches.php
@@ -0,0 +1,11 @@
+#!/usr/local/bin/php
+<?php
+require_once("config.inc");
+require_once("patches.inc");
+
+global $g, $config;
+
+echo "Applying patches...";
+bootup_apply_patches();
+echo "Done.\n";
+?> \ No newline at end of file
diff --git a/config/systempatches/patches.inc b/config/systempatches/patches.inc
index 89610565..9b347620 100644
--- a/config/systempatches/patches.inc
+++ b/config/systempatches/patches.inc
@@ -29,11 +29,19 @@
require_once("globals.inc");
require_once("util.inc");
-$git_root_url = "http://github.com/bsdperimeter/pfsense/commit/";
+$git_root_url = "http://github.com/pfsense/pfsense/commit/";
$patch_suffix = ".patch";
$patch_dir = "/var/patches";
$patch_cmd = "/usr/bin/patch";
+function patch_package_install() {
+ patch_add_shellcmd();
+}
+
+function patch_package_deinstall() {
+ patch_remove_shellcmd();
+}
+
function patch_commit($patch, $action, $test=false, $fulldetail=false) {
global $patch_dir, $patch_cmd, $patch_suffix;
$directory = empty($patch['basedir']) ? "/" : $patch['basedir'];
@@ -139,4 +147,55 @@ function is_github_url($url) {
$urlbits = explode("/", $url);
return (substr($urlbits[2], -10) == "github.com");
}
-?> \ No newline at end of file
+
+function bootup_apply_patches() {
+ global $config;
+
+ $a_patches = &$config['installedpackages']['patches']['item'];
+
+ foreach ($a_patches as $patch) {
+ /* Skip the patch if it should not be automatically applied. */
+ 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. */
+ if (patch_test_apply($patch)) {
+ patch_apply($patch);
+ }
+ }
+ }
+}
+
+function patch_add_shellcmd() {
+ global $config;
+ $a_earlyshellcmd = &$config['system']['earlyshellcmd'];
+ if (!is_array($a_earlyshellcmd))
+ $a_earlyshellcmd = array();
+ $found = false;
+ 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");
+ }
+}
+
+function patch_remove_shellcmd() {
+ global $config;
+ $a_earlyshellcmd = &$config['system']['earlyshellcmd'];
+ if (!is_array($a_earlyshellcmd))
+ $a_earlyshellcmd = array();
+ $removed = false;
+ foreach ($a_earlyshellcmd as $idx => $cmd) {
+ if (stristr($cmd, "apply_patches.php")) {
+ unset($a_earlyshellcmd[$idx]);
+ $removed = true;
+ }
+ }
+ 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 1dd6470b..70260e4b 100644
--- a/config/systempatches/system_patches.php
+++ b/config/systempatches/system_patches.php
@@ -179,11 +179,12 @@ include("head.inc");
<tr id="frheader">
<td width="5%" class="list">&nbsp;</td>
<td width="5%" class="listhdrr"><?=gettext("Description");?></td>
-<td width="65%" class="listhdrr"><?=gettext("URL/ID");?></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">
@@ -242,6 +243,9 @@ foreach ($a_patches as $thispatch):
<a href="system_patches.php?id=<?=$i;?>&amp;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>
diff --git a/config/systempatches/system_patches_edit.php b/config/systempatches/system_patches_edit.php
index 260a7300..5b30c9c5 100644
--- a/config/systempatches/system_patches_edit.php
+++ b/config/systempatches/system_patches_edit.php
@@ -127,6 +127,8 @@ if ($_POST) {
}
write_config();
+ if ($thispatch['autoapply'])
+ patch_add_shellcmd();
header("Location: system_patches.php");
return;
}
@@ -165,7 +167,7 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Patch Contents"); ?></td>
<td width="78%" class="vtable">
- <textarea name="patch" class="" id="patch" rows="15" cols="70" wrap="off"><?=base64_decode($pconfig['patch']);?></textarea>
+ <textarea name="patch" class="" id="patch" rows="15" cols="70" wrap="off"><?=htmlspecialchars(base64_decode($pconfig['patch']));?></textarea>
<br /> <span class="vexpl"><?=gettext("The contents of the patch. You can paste a patch here, or enter a URL/commit ID above, it can then be fetched into here automatically."); ?></span></td>
</tr>
<tr>
@@ -192,7 +194,6 @@ include("head.inc");
<span class="vexpl"><?=gettext("Set this option to ignore whitespace in the patch."); ?></span>
</td>
</tr>
-<!-- This isn't ready yet
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Auto Apply"); ?></td>
<td width="78%" class="vtable">
@@ -201,7 +202,6 @@ include("head.inc");
<span class="vexpl"><?=gettext("Set this option to apply the patch automatically when possible, useful for patches to survive after firmware updates."); ?></span>
</td>
</tr>
--->
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">Patch id: <?php echo $pconfig['uniqid']; ?></td>
diff --git a/config/systempatches/systempatches.xml b/config/systempatches/systempatches.xml
index 3802ba58..ea0eee78 100644
--- a/config/systempatches/systempatches.xml
+++ b/config/systempatches/systempatches.xml
@@ -40,8 +40,9 @@
<requirements>None</requirements>
<faq>Applies patches supplied by the user to the firewall.</faq>
<name>System Patches</name>
- <version>0.5.1</version>
+ <version>0.8</version>
<title>System: Patches</title>
+ <include_file>/usr/local/pkg/patches.inc</include_file>
<menu>
<name>Patches</name>
<tooltiptext></tooltiptext>
@@ -59,8 +60,19 @@
<item>http://www.pfsense.com/packages/config/systempatches/system_patches_edit.php</item>
</additional_files_needed>
<additional_files_needed>
+ <prefix>/usr/local/bin/</prefix>
+ <chmod>755</chmod>
+ <item>http://www.pfsense.com/packages/config/systempatches/apply_patches.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>644</chmod>
<item>http://www.pfsense.com/packages/config/systempatches/patches.inc</item>
</additional_files_needed>
+ <custom_php_install_command>
+ patch_package_install();
+ </custom_php_install_command>
+ <custom_php_deinstall_command>
+ patch_package_deinstall();
+ </custom_php_deinstall_command>
</packagegui> \ No newline at end of file