aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/apcupsd/apcupsd.conf.php1
-rw-r--r--config/apcupsd/apcupsd.inc34
-rw-r--r--config/apcupsd/apcupsd.xml22
-rwxr-xr-xconfig/apcupsd/apcupsd_mail.php95
-rw-r--r--config/arpwatch.xml2
-rw-r--r--config/bind/bind.inc31
-rw-r--r--config/bind/bind.xml2
-rw-r--r--config/bind/bind_acls.xml2
-rw-r--r--config/bind/bind_zones.xml2
-rwxr-xr-xconfig/dansguardian/dansguardian.inc4
-rw-r--r--config/haproxy-devel/haproxy.inc14
-rw-r--r--config/imspector-dev/imspector.inc546
-rw-r--r--config/imspector-dev/imspector.xml251
-rw-r--r--config/imspector-dev/services_imspector_logs.php311
-rw-r--r--config/imspector/imspector.inc370
-rw-r--r--config/imspector/imspector.xml276
-rw-r--r--config/imspector/imspector_acls.xml (renamed from config/imspector-dev/imspector_acls.xml)0
-rw-r--r--config/imspector/imspector_logs.php (renamed from config/imspector-dev/imspector_logs.php)0
-rw-r--r--config/imspector/imspector_replacements.xml (renamed from config/imspector-dev/imspector_replacements.xml)0
-rw-r--r--config/imspector/imspector_sync.xml (renamed from config/imspector-dev/imspector_sync.xml)0
-rw-r--r--config/imspector/services_imspector_logs.php38
-rw-r--r--config/imspector/services_imspector_logs2.php (renamed from config/imspector-dev/services_imspector_logs2.php)0
-rw-r--r--config/mailreport/mail_reports.inc6
-rw-r--r--config/mailreport/mailreport.xml10
-rw-r--r--config/mailreport/status_mail_report.php22
-rw-r--r--config/mailreport/status_mail_report_add_cmd.php6
-rw-r--r--config/mailreport/status_mail_report_add_graph.php6
-rw-r--r--config/mailreport/status_mail_report_add_log.php6
-rw-r--r--config/mailreport/status_mail_report_edit.php8
-rw-r--r--config/openbgpd/openbgpd.inc16
-rwxr-xr-xconfig/pf-blocker/pfblocker.inc36
-rwxr-xr-xconfig/pf-blocker/pfblocker_lists.xml40
-rw-r--r--config/unbound/unbound.inc155
-rw-r--r--config/unbound/unbound_advanced.xml11
-rw-r--r--config/varnish3/varnish.inc2
-rw-r--r--config/vnstat2/vnstat2.inc38
-rw-r--r--config/vnstat2/vnstat2.sh1
-rw-r--r--config/vnstat2/vnstat2.xml143
-rw-r--r--config/vnstat2/vnstat_php_frontend/COPYING341
-rw-r--r--config/vnstat2/vnstat_php_frontend/README52
-rw-r--r--config/vnstat2/vnstat_php_frontend/VeraBd.ttfbin0 -> 58716 bytes
-rw-r--r--config/vnstat2/vnstat_php_frontend/config.php69
-rw-r--r--config/vnstat2/vnstat_php_frontend/graph.php303
-rw-r--r--config/vnstat2/vnstat_php_frontend/graph_svg.php362
-rw-r--r--config/vnstat2/vnstat_php_frontend/index.php196
-rw-r--r--config/vnstat2/vnstat_php_frontend/lang/cs.php39
-rw-r--r--config/vnstat2/vnstat_php_frontend/lang/en.php39
-rw-r--r--config/vnstat2/vnstat_php_frontend/lang/nl.php40
-rw-r--r--config/vnstat2/vnstat_php_frontend/localize.php15
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/dark/style.css21
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/dark/theme.php16
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/espresso/style.css170
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php17
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/light/style.css159
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/light/theme.php15
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css170
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php17
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/red/style.css170
-rw-r--r--config/vnstat2/vnstat_php_frontend/themes/red/theme.php16
-rw-r--r--config/vnstat2/vnstat_php_frontend/vera_copyright.txt124
-rw-r--r--config/vnstat2/vnstat_php_frontend/vnstat.php211
-rw-r--r--config/vnstat2/vnstati.xml3
-rw-r--r--config/vnstat2/vnstatoutput.xml3
-rw-r--r--config/vnstat2/www/diag_vnstat.php (renamed from config/vnstat2/bin/diag_vnstat.abc)0
-rw-r--r--config/vnstat2/www/diag_vnstat2.php (renamed from config/vnstat2/bin/diag_vnstat2.abc)0
-rw-r--r--config/vnstat2/www/vnstat2_img.php (renamed from config/vnstat2/bin/vnstat2_img.abc)0
-rw-r--r--config/vnstat2/www/vnstati.php (renamed from config/vnstat2/bin/vnstati.abc)0
-rw-r--r--config/zabbix2/zabbix2-proxy.xml10
-rw-r--r--config/zabbix2/zabbix2.inc2
69 files changed, 3445 insertions, 1642 deletions
diff --git a/config/apcupsd/apcupsd.conf.php b/config/apcupsd/apcupsd.conf.php
index 6a19b915..7a0340cd 100644
--- a/config/apcupsd/apcupsd.conf.php
+++ b/config/apcupsd/apcupsd.conf.php
@@ -109,6 +109,7 @@ UPSCABLE {$upscable}
# default of 3052 will be used.
#
UPSTYPE {$upstype}
+{$device}
# POLLTIME <int>
# Interval (in seconds) at which apcupsd polls the UPS for status. This
diff --git a/config/apcupsd/apcupsd.inc b/config/apcupsd/apcupsd.inc
index 9abc23ba..a2b8d2ff 100644
--- a/config/apcupsd/apcupsd.inc
+++ b/config/apcupsd/apcupsd.inc
@@ -39,6 +39,7 @@ require_once("globals.inc");
function php_install_apcupsd(){
sync_package_apcupsd();
+ apccontrol_scripts_install();
}
function php_deinstall_apcupsd(){
@@ -138,6 +139,7 @@ function sync_package_apcupsd(){
$upsname=$apcupsd_config['upsname'];
$upscable=$apcupsd_config['upscable'];
$upstype=$apcupsd_config['upstype'];
+ $device=($apcupsd_config['device'] != ''? "DEVICE {$apcupsd_config['device']}" : "#DEVICE");
$polltime=($apcupsd_config['polltime'] != ''? $apcupsd_config['polltime'] : "60");
$onbatterydelay=($apcupsd_config['onbatterydelay'] != ''? $apcupsd_config['onbatterydelay'] : "6");
$batterylevel=($apcupsd_config['batterylevel'] != ''? $apcupsd_config['batterylevel'] : "5");
@@ -185,7 +187,37 @@ function sync_package_apcupsd(){
unlink($apcupsd_rcfile);
}
}
-
+
conf_mount_ro();
}
+
+function apccontrol_scripts_install(){
+
+ // check pfsense version
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ if ($pfs_version > 2.0){
+ define('APCUPSD_BASE', '/usr/pbi/apcupsd-' . php_uname("m"));
+ }
+ else {
+ define('APCUPSD_BASE', '/usr/local');
+ }
+
+ $apccontrol_scripts = array("offbattery","onbattery","commfailure","commok","changeme");
+ foreach($apccontrol_scripts as $apccontrol_script) {
+
+ $apccontrol_script_file=<<<EOF
+#!/bin/sh
+
+/usr/local/bin/php -f /usr/local/pkg/apcupsd_mail.php {$apccontrol_script} > /dev/null
+
+exit 0
+
+EOF;
+
+ file_put_contents(APCUPSD_BASE . "/etc/apcupsd/" . $apccontrol_script, $apccontrol_script_file, LOCK_EX);
+ }
+
+}
+
?>
+
diff --git a/config/apcupsd/apcupsd.xml b/config/apcupsd/apcupsd.xml
index 8674af61..85148b2b 100644
--- a/config/apcupsd/apcupsd.xml
+++ b/config/apcupsd/apcupsd.xml
@@ -40,7 +40,7 @@
<name>Apcupsd</name>
<title>Services: Apcupsd (General)</title>
<category>Monitoring</category>
- <version>0.1</version>
+ <version>0.2</version>
<include_file>/usr/local/pkg/apcupsd.inc</include_file>
<addedit_string>Apcupsd has been created/modified.</addedit_string>
<delete_string>Apcupsd has been deleted.</delete_string>
@@ -60,6 +60,11 @@
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/apcupsd/apcupsd_mail.php</item>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ </additional_files_needed>
<menu>
<name>Apcupsd</name>
<tooltiptext>Setup Apcupsd specific settings</tooltiptext>
@@ -152,12 +157,6 @@ UPSTYPE DEVICE Description <br>
catching; you usually want "APC". Port is usually
161. Community is usually "private".<br>
<br>
-<strong>netsnmp hostname:port:vendor:community</strong>
- OBSOLETE
- Same as SNMP above but requires use of the
- net-snmp library. Unless you have a specific need
- for this old driver, you should use 'snmp' instead.<br>
-<br>
<strong>dumb /dev/tty**</strong> Old serial character device for use with
simple-signaling UPSes.<br>
<br>
@@ -178,6 +177,13 @@ UPSTYPE DEVICE Description <br>
<required>true</required>
</field>
<field>
+ <fielddescr>Device</fielddescr>
+ <fieldname>device</fieldname>
+ <description></description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ <field>
<fielddescr>Poll Time</fielddescr>
<fieldname>polltime</fieldname>
<description>Interval (in seconds) at which apcupsd polls the UPS for status. Default is 60</description>
@@ -322,7 +328,7 @@ UPSTYPE DEVICE Description <br>
</options>
</field>
</fields>
- <custom_php_install_command>sync_package_apcupsd();</custom_php_install_command>
+ <custom_php_install_command>php_install_apcupsd();</custom_php_install_command>
<custom_php_command_before_form></custom_php_command_before_form>
<custom_php_after_head_command></custom_php_after_head_command>
<custom_php_after_form_command></custom_php_after_form_command>
diff --git a/config/apcupsd/apcupsd_mail.php b/config/apcupsd/apcupsd_mail.php
new file mode 100755
index 00000000..c9462aac
--- /dev/null
+++ b/config/apcupsd/apcupsd_mail.php
@@ -0,0 +1,95 @@
+<?php
+/*
+ apcupsd_mail.php
+ part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2014 Danilo G. Baio <dbaio@bsd.com.br>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once("pkg-utils.inc");
+require_once("globals.inc");
+require_once("phpmailer/class.phpmailer.php");
+
+global $config, $g;
+
+$apcstatus[killpower] = "UPS now committed to shut down";
+$apcstatus[commfailure] = "Communications with UPS lost";
+$apcstatus[commok] = "Communications with UPS restored";
+$apcstatus[onbattery] = "Power failure. Running on UPS batteries";
+$apcstatus[offbattery] = "Power has returned...";
+$apcstatus[failing] = "UPS battery power exhausted. Doing shutdown";
+$apcstatus[timeout] = "UPS battery runtime limit exceeded. Doing shutdown";
+$apcstatus[loadlimit] = "UPS battery discharge limit reached. Doing shutdown";
+$apcstatus[runlimit] = "UPS battery runtime percent reached. Doing shutdown";
+$apcstatus[doreboot] = "Beginning Reboot Sequence";
+$apcstatus[doshutdown] = "Beginning Shutdown Sequence";
+$apcstatus[annoyme] = "Power problems please logoff";
+$apcstatus[emergency] = "Emergency Shutdown. Possible UPS battery failure";
+$apcstatus[changeme] = "Emergency! UPS batteries have failed. Change them NOW";
+$apcstatus[remotedown] = "Remote Shutdown. Beginning Shutdown Sequence";
+
+if (empty($argv[1]) || empty($apcstatus["$argv[1]"]))
+ return;
+
+$apcsubject = $apcstatus["$argv[1]"];
+
+if (empty($config['notifications']['smtp']['ipaddress']))
+ return;
+
+$mail = new PHPMailer();
+$mail->IsSMTP();
+$mail->Host = $config['notifications']['smtp']['ipaddress'];
+
+if ($config['notifications']['smtp']['ssl'] == "checked")
+ $mail->SMTPSecure = "ssl";
+
+$mail->Port = empty($config['notifications']['smtp']['port']) ? 25 : $config['notifications']['smtp']['port'];
+
+if($config['notifications']['smtp']['username'] &&
+ $config['notifications']['smtp']['password']) {
+ $mail->SMTPAuth = true;
+ $mail->Username = $config['notifications']['smtp']['username'];
+ $mail->Password = $config['notifications']['smtp']['password'];
+}
+
+$mail->ContentType = 'text/html';
+$mail->IsHTML(true);
+$mail->AddReplyTo($config['notifications']['smtp']['fromaddress'], "Apcupsd");
+$mail->SetFrom($config['notifications']['smtp']['fromaddress'], "Apcupsd");
+$address = $config['notifications']['smtp']['notifyemailaddress'];
+$mail->AddAddress($address, "Apcupsd Recipient");
+$mail->Subject = "{$config['system']['hostname']}.{$config['system']['domain']} - {$apcsubject}";
+
+putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
+$mail->Body = "<pre>";
+$ph = popen('apcaccess status 2>&1', "r" );
+while ($line = fgets($ph)) $mail->Body .= htmlspecialchars($line);
+pclose($ph);
+$mail->Body .= "</pre>";
+
+if(!$mail->Send()) {
+ echo "Mailer Error: " . $mail->ErrorInfo;
+}
+
+?>
diff --git a/config/arpwatch.xml b/config/arpwatch.xml
index bf163ad6..7f2e72ef 100644
--- a/config/arpwatch.xml
+++ b/config/arpwatch.xml
@@ -119,7 +119,7 @@
}
$int = convert_friendly_interface_to_real_interface_name($int);
$start = "touch {$log_file}\n";
- $start .= "/usr/local/sbin/arpwatch {$debug} -f {$log_file} {$mail} -i {$int} > /var/log/arpwatch.reports 2>&amp;1 &amp;";
+ $start .= "/usr/local/sbin/arpwatch {$debug} -f {$log_file} \"{$mail}\" -i {$int} > /var/log/arpwatch.reports 2>&amp;1 &amp;";
$stop = "/usr/bin/killall arpwatch";
write_rcfile(array(
"file" => "arpwatch.sh",
diff --git a/config/bind/bind.inc b/config/bind/bind.inc
index 40d626db..156e9eb8 100644
--- a/config/bind/bind.inc
+++ b/config/bind/bind.inc
@@ -43,7 +43,7 @@ $pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version > 2.0)
define('BIND_LOCALBASE', '/usr/pbi/bind-' . php_uname("m"));
else
- define('BIND_LOCALBASE','/usr/local');
+ define('BIND_LOCALBASE','/usr/local');
define('CHROOT_LOCALBASE','/cf/named');
@@ -95,8 +95,7 @@ function bind_zone_validate($post, $input_errors){
}
}
- function bind_sync(){
-
+function bind_sync(){
global $config;
conf_mount_rw();
//create rndc
@@ -164,8 +163,8 @@ EOD;
}
//check ips to listen on
if (preg_match("/All/",$bind['listenon'])){
- $bind_listenonv6="Any;";
- $bind_listenon="Any;";
+ $bind_listenonv6="any;";
+ $bind_listenon="any;";
}
else{
$bind_listenonv6="";
@@ -198,10 +197,10 @@ EOD;
if ($bind_notify == on)
$bind_conf .="\t\tnotify yes;\n";
if ($hide_version == on)
- $bind_conf .="\t\tversion \"N/A\";\n";
+ $bind_conf .="\t\tversion none;\n";
- $bind_conf .="\t\t$custom_options\n";
- $bind_conf .= "\t};\n\n";
+ $bind_conf .= preg_replace("/^/m","\t\t",$custom_options);
+ $bind_conf .= "\n\t};\n\n";
if ($bind_logging == on){
//check if bind is included on syslog
@@ -209,8 +208,9 @@ EOD;
$restart_syslog=0;
foreach ($syslog_files as $syslog_file){
$syslog_file_data=file_get_contents($syslog_file);
- if (!preg_match("/dnsmasq,named,filterdns/",$syslog_file_data)){
+ if ( !preg_match("/dnsmasq,named,filterdns/",$syslog_file_data) || !preg_match("/'dnsmasq','named','filterdns'/",$syslog_file_data) ) {
$syslog_file_data=preg_replace("/dnsmasq,filterdns/","dnsmasq,named,filterdns",$syslog_file_data);
+ $syslog_file_data=preg_replace("/'dnsmasq','filterdns'/","'dnsmasq','named','filterdns'",$syslog_file_data);
file_put_contents($syslog_file,$syslog_file_data);
$restart_syslog++;
}
@@ -244,15 +244,22 @@ EOD;
#Config Zone domain
if(!is_array($config["installedpackages"]["bindacls"]) || !is_array($config["installedpackages"]["bindacls"]["config"])){
- $config["installedpackages"]["bindacls"]["config"][] =array("name"=>"any","description"=>"Default Access list","row" => array("value"=> "","description"=>""));
- write_config("Create Default bind acl 'Any'");
+ $config["installedpackages"]["bindacls"]["config"][] =
+ array("name"=>"none","description"=>"BIND Built-in ACL","row"=>array("value"=>"","description"=>""));
+ $config["installedpackages"]["bindacls"]["config"][] =
+ array("name"=>"any","description"=>"BIND Built-in ACL","row"=>array("value"=>"","description"=>""));
+ $config["installedpackages"]["bindacls"]["config"][] =
+ array("name"=>"localhost","description"=>"BIND Built-in ACL","row"=>array("value"=>"","description"=>""));
+ $config["installedpackages"]["bindacls"]["config"][] =
+ array("name"=>"localnets","description"=>"BIND Built-in ACL","row"=>array("value"=>"","description"=>""));
+ write_config("Create BIND Built-in ACLs");
}
$bindacls = $config["installedpackages"]["bindacls"]["config"];
for ($i=0; $i<sizeof($bindacls); $i++)
{
$aclname = $bindacls[$i]['name'];
$aclhost = $bindacls[$i]['row'];
- if($aclname != "any"){
+ if($aclname != "none" && $aclname != "any" && $aclname != "localhost" && $aclname != "localnets"){
$bind_conf .= "acl \"$aclname\" {\n";
for ($u=0; $u<sizeof($aclhost); $u++)
{
diff --git a/config/bind/bind.xml b/config/bind/bind.xml
index 76fdf523..2f16b966 100644
--- a/config/bind/bind.xml
+++ b/config/bind/bind.xml
@@ -160,7 +160,7 @@
<field>
<fielddescr>Hide Version</fielddescr>
<fieldname>bind_hide_version</fieldname>
- <description>Hide the version of BIND, this prevents discover the version of our servers, use any exploit that exploits a vulnerability in Bind.</description>
+ <description>Hide the version of BIND (do not process queries to version.bind at all). This makes it more difficult to exploit the server.</description>
<type>checkbox</type>
</field>
<field>
diff --git a/config/bind/bind_acls.xml b/config/bind/bind_acls.xml
index b8d10158..dbd9e29d 100644
--- a/config/bind/bind_acls.xml
+++ b/config/bind/bind_acls.xml
@@ -108,7 +108,7 @@
<type>input</type>
</field>
<field>
- <fielddescr>Enter IP or range bloc network.</fielddescr>
+ <fielddescr>Enter IP or range block network.</fielddescr>
<description>Leave blank to allow All</description>
<fieldname>none</fieldname>
<type>rowhelper</type>
diff --git a/config/bind/bind_zones.xml b/config/bind/bind_zones.xml
index be4da9cf..3506df63 100644
--- a/config/bind/bind_zones.xml
+++ b/config/bind/bind_zones.xml
@@ -126,7 +126,7 @@
<fieldname>name</fieldname>
<description><![CDATA[Enter the name for zone (ex:mydomain.com)<br>
For reverse zones, include zone ip in reverse order or following your provider instructions.(Ex: 1.168.192)<br>
- IN-ADDR.ARPA will be automaticaly included on conf files when reveser zone option is checked.]]></description>
+ IN-ADDR.ARPA will be automaticaly included on conf files when reverse zone option is checked.]]></description>
<type>input</type>
<required/>
</field>
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc
index cd453322..0dd8ff99 100755
--- a/config/dansguardian/dansguardian.inc
+++ b/config/dansguardian/dansguardian.inc
@@ -935,8 +935,8 @@ EOF;
}
else{
if ($dansguardian_blacklist['cron']=="force_download"){
- log_error("Blacklist udpate process started");
- file_notice("Dansguardian - Blacklist udpate process started","");
+ log_error("Blacklist update process started");
+ file_notice("Dansguardian - Blacklist update process started","");
file_put_contents("/root/dansguardian_custom.script",base64_decode($dansguardian_blacklist['custom_script']),LOCK_EX);
if ($dansguardian_blacklist['enable_custom_script'] && $dansguardian_blacklist['custom_script'] != "")
mwexec_bg("/root/dansguardian_custom.script");
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index d039b55a..9bc0dd80 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -1137,14 +1137,6 @@ function haproxy_check_run($reload) {
$a_global = &$config['installedpackages']['haproxy'];
$configpath = "{$g['varetc_path']}/haproxy";
- exec("/usr/bin/limits -n 300014");
-
- if(use_transparent_clientip_proxying()) {
- filter_configure();
- load_ipfw_rules();
- } else
- mwexec("/usr/local/sbin/ipfw_context -d haproxy", true);
-
if(isset($a_global['enable'])) {
if (isset($a_global['carpdev'])) {
$status = get_carp_interface_status($a_global['carpdev']);
@@ -1163,6 +1155,12 @@ function haproxy_check_run($reload) {
} else if ($reload == 0)
return (0);
+ if(use_transparent_clientip_proxying()) {
+ filter_configure();
+ load_ipfw_rules();
+ } else
+ mwexec("/usr/local/sbin/ipfw_context -d haproxy", true);
+
if (haproxy_is_running()) {
if (isset($a_global['terminate_on_reload']))
$sf_st = "-st";//terminate old process as soon as the new process is listening
diff --git a/config/imspector-dev/imspector.inc b/config/imspector-dev/imspector.inc
deleted file mode 100644
index 52c7ae1b..00000000
--- a/config/imspector-dev/imspector.inc
+++ /dev/null
@@ -1,546 +0,0 @@
-<?php
-/*
- imspector.inc
- part of pfSense (http://www.pfsense.com/)
- Copyright (C) 2012 Marcello Coutinho.
- Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>.
- Copyright (C) 2011 Bill Marquette <billm@gmail.com>.
- Copyright (C) 2007 Ryan Wagoner <rswagoner@gmail.com>.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
- require_once("config.inc");
- require_once("functions.inc");
- require_once("service-utils.inc");
-
- /* IMSpector */
-
- define('IMSPECTOR_RCFILE', '/usr/local/etc/rc.d/imspector.sh');
- define('IMSPECTOR_ETC', '/usr/local/etc/imspector');
- define('IMSPECTOR_CONFIG', IMSPECTOR_ETC . '/imspector.conf');
-
- function imspector_warn ($msg) { syslog(LOG_WARNING, "imspector: {$msg}"); }
-
- function ims_text_area_decode($text){
- return preg_replace('/\r\n/', "\n",base64_decode($text));
- }
-
- function imspector_action ($action) {
- if (file_exists(IMSPECTOR_RCFILE))
- mwexec(IMSPECTOR_RCFILE.' '.$action);
- }
-
- function write_imspector_config($file, $text) {
- $conf = fopen($file, 'w');
- if(!$conf) {
- imspector_warn("Could not open {$file} for writing.");
- exit;
- }
- fwrite($conf, $text);
- fclose($conf);
- }
-
- function imspector_pf_rdr($iface, $port) {
- return "rdr pass on {$iface} inet proto tcp from any to any port = {$port} -> 127.0.0.1 port 16667\n";
- }
-
- function imspector_pf_rule($iface, $port) {
- return "pass in quick on {$iface} inet proto tcp from any to any port {$port} keep state\n";
- }
-
- function imspector_proto_to_port ($proto)
- {
- switch ($proto) {
- case 'gadu-gadu':
- return 8074;
- case 'jabber':
- return 5222;
- case 'jabber-ssl':
- return 5223;
- case 'msn':
- return 1863;
- case 'icq':
- return 5190;
- case 'yahoo':
- return 5050;
- case 'irc':
- return 6667;
- default:
- return null;
- }
- }
-
- function validate_form_imspector($post, $input_errors) {
- if($post['iface_array'])
- foreach($post['iface_array'] as $iface)
- if($iface == 'wanx')
- $input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field';
- }
-
- function deinstall_package_imspector() {
- imspector_action('stop');
-
- unlink_if_exists(IMSPECTOR_RCFILE);
- unlink_if_exists(IMSPECTOR_CONFIG);
- unlink_if_exists(IMSPECTOR_ETC . '/badwords_custom.txt');
- unlink_if_exists(IMSPECTOR_ETC . '/acl_blacklist.txt');
- unlink_if_exists(IMSPECTOR_ETC . '/acl_whitelist.txt');
- unlink_if_exists('/usr/local/www/imspector_logs.php');
-
- //exec('pkg_delete imspector-0.4');
- }
-
- function imspector_generate_rules($type) {
-
- $rules = "";
- switch ($type) {
- case 'rdr':
- case 'nat':
- $rules = "# IMSpector rdr anchor\n";
- $rules .= "rdr-anchor \"imspector\"\n";
- break;
- case 'rule':
- $rules = "# IMSpector \n";
- $rules .= "anchor \"imspector\"\n";
- break;
- }
-
- return $rules;
- }
-
- function sync_package_imspector() {
- global $config;
- global $input_errors;
-
- /*detect boot process*/
- if (is_array($_POST)){
- if (preg_match("/\w+/",$_POST['__csrf_magic']))
- unset($boot_process);
- else
- $boot_process="on";
- }
-
- if (is_process_running('imspector') && isset($boot_process))
- return;
-
- /* check default options and sample files*/
- $load_samples=0;
-
- #bannedphraselist
- if (!is_array($config['installedpackages']['imspectoracls'])){
- $config['installedpackages']['imspectoracls']['config'][]=array('enable'=> 'on',
- 'description' => 'allow access to all ids',
- 'action' => 'allow',
- 'localid' => 'all',
- 'remoteid' => base64_encode('all'));
- $load_samples++;
- }
- $ims_acls = $config['installedpackages']['imspectoracls']['config'];
-
- if (is_array($config['installedpackages']['imspectorreplacements'])){
- if ($config['installedpackages']['imspectorreplacements']['config'][0]['badwords_list'] == "" && file_exists(IMSPECTOR_ETC . '/badwords.txt')){
- $config['installedpackages']['imspectorreplacements']['config'][0]['badwords_list'] = base64_encode(file_get_contents(IMSPECTOR_ETC . '/badwords.txt'));
- $load_samples++;
- }
- $ims_replacements = $config['installedpackages']['imspectorreplacements']['config'][0];
- }
-
- if (is_array($config['installedpackages']['imspector']))
- $ims_config = $config['installedpackages']['imspector']['config'][0];
-
- if($load_samples > 0)
- write_config();
-
- /*continue sync process*/
- log_error("Imspector: Saving changes.");
- config_lock();
-
- /* remove existing rules */
- exec('/sbin/pfctl -a imspector -Fr > /dev/null');
- exec('/sbin/pfctl -a imspector -Fn > /dev/null');
-
- $ifaces_active = '';
-
- if($ims_config['enable'] && $ims_config['proto_array'])
- $proto_array = explode(',', $ims_config['proto_array']);
-
- if($ims_config['enable'] && $ims_config['iface_array'])
- $iface_array = explode(',', $ims_config['iface_array']);
-
- if($iface_array && $proto_array) {
- foreach($iface_array as $iface) {
- $if = convert_friendly_interface_to_real_interface_name($iface);
- /* above function returns iface if fail */
- if($if!=$iface) {
- $addr = find_interface_ip($if);
- /* non enabled interfaces are displayed in list on imspector settings page */
- /* check that the interface has an ip address before adding parameters */
- if($addr) {
- foreach($proto_array as $proto) {
- if(imspector_proto_to_port($proto)) {
- /* we can use rdr pass to auto create the filter rule */
- $pf_rules .= imspector_pf_rdr($if,imspector_proto_to_port($proto));
- }
- }
- if(!$ifaces_active)
- $ifaces_active = "{$iface}";
- else
- $ifaces_active .= ", {$iface}";
- } else {
- imspector_warn("Interface {$iface} has no ip address, ignoring");
- }
- } else {
- imspector_warn("Could not resolve real interface for {$iface}");
- }
- }
-
-
- /*reload rules*/
- if($pf_rules) {
- log_error("Imspector: Reloading rules.");
- exec("echo \"{$pf_rules}\" | /sbin/pfctl -a imspector -f -");
-
- conf_mount_rw();
-
- /* generate configuration files */
-
- $conf['plugin_dir'] = '/usr/local/lib/imspector';
-
- foreach($proto_array as $proto)
- $conf[$proto . '_protocol'] = 'on';
-
- if($ims_config['log_file']) {
- @mkdir('/var/imspector');
- $conf['file_logging_dir'] = '/var/imspector';
- }
-
- if($ims_config['log_mysql']) {
- $conf['mysql_server'] = $ims_config['mysql_server'];
- $conf['mysql_database'] = $ims_config['mysql_database'];
- $conf['mysql_username'] = $ims_config['mysql_username'];
- $conf['mysql_password'] = $ims_config['mysql_password'];
- }
-
- if($ims_replacements['filter_badwords']) {
- write_imspector_config(IMSPECTOR_ETC . '/badwords_custom.txt', ims_text_area_decode($ims_replacements["badwords_list"]));
- $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords_custom.txt';
- }
-
- if($ims_replacements['block_files'])
- $conf['block_files'] = 'on';
-
- if($ims_replacements['block_webcams'])
- $conf['block_webcams'] = 'on';
-
- $acls="";
- $conf['acl_filename'] = IMSPECTOR_ETC . '/acls.txt';
- foreach ($ims_acls as $rule){
- if ($rule['enable']){
- $acls.= "{$rule['action']} {$rule['localid']} ".preg_replace("/\s+/"," ",base64_decode($rule['remoteid']))."\n";
- }
- }
- write_imspector_config(IMSPECTOR_ETC . '/acls.txt', $acls);
-
- // Handle Jabber SSL options
- if(isset($ims_config["ssl_ca_cert"]) && $ims_config["ssl_ca_cert"] != "none" &&
- isset($ims_config["ssl_server_cert"]) && $ims_config["ssl_server_cert"] != "none") {
- $conf['ssl'] = "on";
- if(!is_dir(IMSPECTOR_ETC . "/ssl"))
- mkdir(IMSPECTOR_ETC . "/ssl");
-
- $ca_cert = lookup_ca($ims_config["ssl_ca_cert"]);
- if ($ca_cert != false) {
- if(base64_decode($ca_cert['prv'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_key.pem", base64_decode($ca_cert['prv']));
- $conf['ssl_ca_key'] = IMSPECTOR_ETC . '/ssl/ssl_ca_key.pem';
- }
- if(base64_decode($ca_cert['crt'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem", base64_decode($ca_cert['crt']));
- $conf['ssl_ca_cert'] = IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem";
- }
- $svr_cert = lookup_cert($ims_config["ssl_server_cert"]);
- if ($svr_cert != false) {
- if(base64_decode($svr_cert['prv'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_server_key.pem", base64_decode($svr_cert['prv']));
- $conf['ssl_key'] = IMSPECTOR_ETC . '/ssl/ssl_server_key.pem';
- }
-
- }
- $conf['ssl_cert_dir'] = IMSPECTOR_ETC . '/ssl';
- }
- } else {
- // SSL Not enabled. Make sure Jabber-SSL is not processed.
- unset($conf['jabber-ssl']);
- unset($conf['ssl']);
- }
-
- if (isset($ims_replacements['responder']) && $ims_replacements['responder'] == 'on') {
- $conf['responder_filename'] = IMSPECTOR_ETC . "/responder.db";
- if (isset($ims_replacements['prefix_message']) && $ims_replacements['prefix_message'] != '' ) {
- $conf['response_prefix'] = " .={$ims_replacements['prefix_message']}=.";
- }
- else{
- $conf['response_prefix'] = " .=Your activities are being logged=.";
- }
- if (isset($ims_replacements['notice_days']) && is_numeric($ims_replacements['notice_days'])) {
- if ($ims_replacements['notice_days'] != 0) {
- $conf['notice_days'] = $ims_replacements['notice_days'];
- }
- } else {
- $conf['notice_days'] = 1;
- }
-
- /*Custom recorded message response*/
- if(isset($ims_replacements['recorded_message']) && $ims_replacements['recorded_message'] != '' ){
- $conf['notice_response'] = ims_text_area_decode($ims_replacements['recorded_message']);
- }
- else{
- $conf['notice_response'] = "Your activities are being logged";
- }
-
- /*Filtered Frequency*/
- if (isset($ims_replacements['filtered_minutes']) && is_numeric($ims_replacements['filtered_minutes'])) {
- if ($ims_replacements['filtered_minutes'] != 0) {
- $conf['filtered_mins'] = $ims_replacements['filtered_minutes'];
- }
- } else {
- $conf['filtered_mins'] = 15;
- }
-
- /*Custom filtered message response*/
- if(isset($ims_replacements['filtered_message']) && $ims_replacements['filtered_message'] != '' ){
- $conf['filtered_response'] = ims_text_area_decode($ims_replacements['filtered_message']);
- }
- else{
- $conf['filtered_response'] = "Your message has been filtered";
- }
- }
-
- $conftext = '';
- foreach($conf as $var => $key)
- $conftext .= "{$var}={$key}\n";
- write_imspector_config(IMSPECTOR_CONFIG, $conftext);
-
- /*Check template settings*/
- if ($ims_config['template'] == "")
- $template="services_imspector_logs.php";
- else
- $template=$ims_config['template'];
-
- /*link template file*/
- $link="/usr/local/www/imspector_logs.php";
- unlink_if_exists($link);
- symlink("/usr/local/www/{$template}", $link);
-
- /* generate rc file start and stop */
- $stop = <<<EOD
-/bin/pkill -x imspector
-/bin/sleep 1
-EOD;
- $start = $stop."\n\tldconfig -m /usr/local/lib/mysql\n";
- $start .= "\t/usr/local/sbin/imspector -c \"".IMSPECTOR_CONFIG."\"";
-
- write_rcfile(array(
- 'file' => 'imspector.sh',
- 'start' => $start,
- 'stop' => $stop
- )
- );
-
- conf_mount_ro();
- }
- }
-
- if(!$iface_array || !$proto_array || !$pf_rules) {
- /* no parameters user does not want imspector running */
- /* lets stop the service and remove the rc file */
-
- if(file_exists(IMSPECTOR_RCFILE)) {
- if(!$ims_config['enable'])
- log_error('Impsector: Stopping service: imspector disabled');
- else
- log_error('Impsector: Stopping service: no interfaces and/or protocols selected');
-
- imspector_action('stop');
-
- conf_mount_rw();
- unlink(IMSPECTOR_RCFILE);
- unlink(IMSPECTOR_CONFIG);
- @unlink(IMSPECTOR_ETC . '/badwords_custom.txt');
- @unlink(IMSPECTOR_ETC . '/acl_blacklist.txt');
- @unlink(IMSPECTOR_ETC . '/acl_whitelist.txt');
- conf_mount_ro();
- }
- }
- else{
- /* if imspector not running start it */
- if(!is_process_running('imspector')) {
- log_error("Impsector: Starting service on interface: {$ifaces_active}");
- imspector_action('start');
- }
- /* or restart imspector if settings were changed */
- else{
- log_error("Impsector: Restarting service on interface: {$ifaces_active}");
- imspector_action('restart');
- }
- }
- config_unlock();
-
- /*check xmlrpc sync*/
- imspector_sync_on_changes();
- }
-
- function imspector_get_ca_certs() {
- global $config;
-
- $ca_arr = array();
- $ca_arr[] = array('refid' => 'none', 'descr' => 'none');
- foreach ($config['ca'] as $ca) {
- $ca_arr[] = array('refid' => $ca['refid'], 'descr' => $ca['descr']);
- }
- return $ca_arr;
- }
-
- function imspector_get_server_certs() {
- global $config;
- $cert_arr = array();
- $cert_arr[] = array('refid' => 'none', 'descr' => 'none');
-
- foreach ($config['cert'] as $cert) {
- $cert_arr[] = array('refid' => $cert['refid'], 'descr' => $cert['descr']);
- }
- return $cert_arr;
- }
-
-/* Uses XMLRPC to synchronize the changes to a remote node */
-function imspector_sync_on_changes() {
- global $config, $g;
-
- $synconchanges = $config['installedpackages']['imspectorsync']['config'][0]['synconchanges'];
- if(!$synconchanges)
- return;
- log_error("Imspector: xmlrpc sync is starting.");
- foreach ($config['installedpackages']['imspectorsync']['config'] as $rs ){
- foreach($rs['row'] as $sh){
- $sync_to_ip = $sh['ipaddress'];
- $password = $sh['password'];
- if($password && $sync_to_ip)
- imspector_do_xmlrpc_sync($sync_to_ip, $password);
- }
- }
- log_error("Imspector: xmlrpc sync is ending.");
-}
-/* Do the actual XMLRPC sync */
-function imspector_do_xmlrpc_sync($sync_to_ip, $password) {
- global $config, $g;
-
- if(!$password)
- return;
-
- if(!$sync_to_ip)
- return;
- $username="admin";
-
- $xmlrpc_sync_neighbor = $sync_to_ip;
- 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 = "80";
- else
- $port = "443";
- }
- $synchronizetoip .= $sync_to_ip;
-
- /* xml will hold the sections to sync */
- $xml = array();
- $xml['imspector'] = $config['installedpackages']['imspector'];
- $xml['imspectorreplacements'] = $config['installedpackages']['imspectorreplacements'];
- $xml['imspectoracls'] = $config['installedpackages']['imspectoracls'];
- /* 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 */
- $url = $synchronizetoip;
- log_error("Imspector: Beginning 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'])
- $cli->setDebug(1);
- /* send our XMLRPC message and timeout after 250 seconds */
- $resp = $cli->send($msg, "250");
- if(!$resp) {
- $error = "A communications error occurred while attempting imspector XMLRPC sync with {$url}:{$port}.";
- log_error($error);
- file_notice("sync_settings", $error, "imspector Settings Sync", "");
- } elseif($resp->faultCode()) {
- $cli->setDebug(1);
- $resp = $cli->send($msg, "250");
- $error = "An error code was received while attempting imspector XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
- log_error($error);
- file_notice("sync_settings", $error, "imspector Settings Sync", "");
- } else {
- log_error("imspector XMLRPC sync successfully completed with {$url}:{$port}.");
- }
-
- /* tell imspector to reload our settings on the destionation sync host. */
- $method = 'pfsense.exec_php';
- $execcmd = "require_once('/usr/local/pkg/imspector.inc');\n";
- $execcmd .= "sync_package_imspector();";
- /* assemble xmlrpc payload */
- $params = array(
- XML_RPC_encode($password),
- XML_RPC_encode($execcmd)
- );
-
- log_error("imspector 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) {
- $error = "A communications error occurred while attempting imspector XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
- log_error($error);
- file_notice("sync_settings", $error, "imspector Settings Sync", "");
- } elseif($resp->faultCode()) {
- $cli->setDebug(1);
- $resp = $cli->send($msg, "250");
- $error = "An error code was received while attempting imspector XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
- log_error($error);
- file_notice("sync_settings", $error, "imspector Settings Sync", "");
- } else {
- log_error("imspector XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
- }
-
-}
-?>
diff --git a/config/imspector-dev/imspector.xml b/config/imspector-dev/imspector.xml
deleted file mode 100644
index c68fc70e..00000000
--- a/config/imspector-dev/imspector.xml
+++ /dev/null
@@ -1,251 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
-<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
-<packagegui>
- <copyright>
- <![CDATA[
-/* ========================================================================== */
-/*
- imspector.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
- Copyright (C) 2011 Bill Marquette <billm@gmail.com>
- Copyright (C) 2007 Ryan Wagoner <rswagoner@gmail.com>
- All rights reserved.
- */
-/* ========================================================================== */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 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>Describe your package here</description>
- <requirements>Describe your package requirements here</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
- <name>imspector</name>
- <version>20111108</version>
- <title>Services: IMSpector</title>
- <savetext>Save</savetext>
- <include_file>/usr/local/pkg/imspector.inc</include_file>
- <menu>
- <name>IMSpector</name>
- <tooltiptext>Set IMSpector settings such as protocols to listen on.</tooltiptext>
- <section>Services</section>
- <url>/services_imspector_logs.php</url>
- </menu>
- <service>
- <name>imspector</name>
- <rcfile>imspector.sh</rcfile>
- <executable>imspector</executable>
- <description><![CDATA[Instant Messenger transparent proxy]]></description>
- </service>
- <tabs>
- <tab>
- <text>Settings</text>
- <url>/pkg_edit.php?xml=imspector.xml&amp;id=0</url>
- <active/>
- </tab>
- <tab>
- <text>Replacements</text>
- <url>/pkg_edit.php?xml=imspector_replacements.xml&amp;id=0</url>
- </tab>
- <tab>
- <text>Access Lists</text>
- <url>/pkg.php?xml=imspector_acls.xml</url>
- </tab>
- <tab>
- <text>Log</text>
- <url>/imspector_logs.php</url>
- </tab>
- <tab>
- <text>Sync</text>
- <url>/pkg_edit.php?xml=imspector_sync.xml</url>
- </tab>
- </tabs>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/imspector_sync.xml</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/imspector_replacements.xml</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/imspector_acls.xml</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/imspector.inc</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/www/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/imspector_logs.php</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/www/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/services_imspector_logs.php</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/www/</prefix>
- <chmod>0755</chmod>
- <item>http://www.pfsense.org/packages/config/imspector-dev/services_imspector_logs2.php</item>
- </additional_files_needed>
- <fields>
- <field>
- <name>General Settings</name>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>Enable IMSpector</fielddescr>
- <fieldname>enable</fieldname>
- <type>checkbox</type>
- </field>
- <field>
- <fielddescr>Interfaces</fielddescr>
- <fieldname>iface_array</fieldname>
- <description><![CDATA[<strong>Generally select internal interface(s) like LAN</strong><br>
- You can use the CTRL or COMMAND key to select multiple interfaces.]]></description>
- <type>interfaces_selection</type>
- <size>3</size>
- <required/>
- <value>lan</value>
- <multiple>true</multiple>
- </field>
- <field>
- <fielddescr>Listen on protocols</fielddescr>
- <fieldname>proto_array</fieldname>
- <description><![CDATA[<strong>NOTE: Gtalk/Jabber-SSL requires SSL certificates.</strong><br>
- You can use the CTRL or COMMAND key to select multiple protocols.]]></description>
- <type>select</type>
- <size>7</size>
- <required/>
- <multiple>true</multiple>
- <options>
- <option><name>MSN</name><value>msn</value></option>
- <option><name>ICQ/AIM</name><value>icq</value></option>
- <option><name>Yahoo</name><value>yahoo</value></option>
- <option><name>IRC</name><value>irc</value></option>
- <option><name>Jabber</name><value>jabber</value></option>
- <option><name>Gtalk/Jabber-SSL</name><value>jabber-ssl</value></option>
- <option><name>Gadu-Gadu</name><value>gadu-gadu</value></option>
- </options>
- </field>
- <field>
- <fielddescr>SSL CA Certificate</fielddescr>
- <fieldname>ssl_ca_cert</fieldname>
- <description>
- Choose the SSL CA Certficate here.
- </description>
- <type>select_source</type>
- <source><![CDATA[imspector_get_ca_certs()]]></source>
- <source_name>descr</source_name>
- <source_value>refid</source_value>
- </field>
- <field>
- <fielddescr>SSL Certificate</fielddescr>
- <fieldname>ssl_server_cert</fieldname>
- <description>
- Choose the SSL Server Certificate here.
- </description>
- <type>select_source</type>
- <source><![CDATA[imspector_get_server_certs()]]></source>
- <source_name>descr</source_name>
- <source_value>refid</source_value>
- </field>
- <field>
- <name>Logging</name>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>Enable file logging</fielddescr>
- <fieldname>log_file</fieldname>
- <description>Log files stored in /var/imspector.</description>
- <type>checkbox</type>
- </field>
- <field>
- <fielddescr>Report limit</fielddescr>
- <fieldname>reportlimit</fieldname>
- <description>Max entries to fetch from log dir(s). Default is 50</description>
- <type>input</type>
- <size>10</size>
- </field>
- <field>
- <fielddescr>Report template</fielddescr>
- <fieldname>template</fieldname>
- <description>Template to use on reports</description>
- <type>select</type>
- <required/>
- <options>
- <option><name>Default Template</name><value>services_imspector_logs.php</value></option>
- <option><name>0guzcan Template</name><value>services_imspector_logs2.php</value></option>
- </options>
- </field>
- <field>
- <fielddescr>Enable mySQL logging</fielddescr>
- <fieldname>log_mysql</fieldname>
- <description>Make sure to specify your MySQL credentials below.</description>
- <type>checkbox</type>
- </field>
- <field>
- <fielddescr>mySQL server</fielddescr>
- <fieldname>mysql_server</fieldname>
- <type>input</type>
- <size>35</size>
- </field>
- <field>
- <fielddescr>mySQL database</fielddescr>
- <fieldname>mysql_database</fieldname>
- <type>input</type>
- <size>35</size>
- </field>
- <field>
- <fielddescr>mySQL username</fielddescr>
- <fieldname>mysql_username</fieldname>
- <type>input</type>
- <size>35</size>
- </field>
- <field>
- <fielddescr>mySQL password</fielddescr>
- <fieldname>mysql_password</fieldname>
- <type>password</type>
- <size>35</size>
- </field>
- </fields>
- <custom_php_validation_command>
- validate_form_imspector($_POST, &amp;$input_errors);
- </custom_php_validation_command>
- <custom_php_resync_config_command>
- sync_package_imspector();
- </custom_php_resync_config_command>
- <custom_php_deinstall_command>
- deinstall_package_imspector();
- </custom_php_deinstall_command>
- <filter_rules_needed>imspector_generate_rules</filter_rules_needed>
-</packagegui> \ No newline at end of file
diff --git a/config/imspector-dev/services_imspector_logs.php b/config/imspector-dev/services_imspector_logs.php
deleted file mode 100644
index adb3fa66..00000000
--- a/config/imspector-dev/services_imspector_logs.php
+++ /dev/null
@@ -1,311 +0,0 @@
-<?php
-/*
- services_imspector_logs.php
- part of pfSense (http://www.pfsense.com/)
-
- JavaScript Code is GPL Licensed from SmoothWall Express.
-
- Copyright (C) 2007 Ryan Wagoner <rswagoner@gmail.com>.
- Copyright (C) 2012 Marcello Coutinho
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-require("guiconfig.inc");
-
-/* variables */
-$log_dir = '/var/imspector';
-$imspector_config = $config['installedpackages']['imspector']['config'][0];
-
-$border_color = '#c0c0c0';
-$default_bgcolor = '#eeeeee';
-
-$list_protocol_color = '#000000';
-$list_local_color = '#000000';
-$list_remote_color = '#000000';
-$list_convo_color = '#000000';
-
-$list_protocol_bgcolor = '#cccccc';
-$list_local_bgcolor = '#dddddd';
-$list_remote_bgcolor = '#eeeeee';
-$list_end_bgcolor = '#bbbbbb';
-
-$convo_title_color = 'black';
-$convo_local_color = 'blue';
-$convo_remote_color = 'red';
-
-$convo_title_bgcolor = '#cccccc';
-$convo_local_bgcolor = '#dddddd';
-$convo_remote_bgcolor = '#eeeeee';
-
-/* functions */
-
-function convert_dir_list ($topdir) {
- global $config;
- if (!is_dir($topdir))
- return;
- $imspector_config = $config['installedpackages']['imspector']['config'][0];
- $limit=(preg_match("/\d+/",$imspector_config['reportlimit'])?$imspector_config['reportlimit']:"50");
- $count=0;
- if ($dh = opendir($topdir)) {
- while (($file = readdir($dh)) !== false) {
- if(!preg_match('/^\./', $file) == 0)
- continue;
- if (is_dir("$topdir/$file"))
- $list .= convert_dir_list("$topdir/$file");
- else
- $list .= "$topdir/$file\n";
- $count ++;
- if($count >= $limit){
- closedir($dh);
- return $list;
- }
- }
- closedir($dh);
- }
- return $list;
- }
-
-/* ajax response */
-if ($_POST['mode'] == "render") {
-
- /* user list */
- print(str_replace(array($log_dir,'/'),array('','|'),convert_dir_list($log_dir)));
- print("--END--\n");
-
- /* log files */
- if ($_POST['section'] != "none") {
- $section = explode('|',$_POST['section']);
- $protocol = $section[0];
- $localuser = $section[1];
- $remoteuser = $section[2];
- $conversation = $section[3];
-
- /* conversation title */
- print(implode(', ', $section)."\n");
- print("--END--\n");
-
- /* conversation content */
- $filename = $log_dir.'/'.implode('/', $section);
- if($fd = fopen($filename, 'r')) {
- print("<table width='100%' border='0' cellpadding='2' cellspacing='0'>\n");
- while (!feof($fd)) {
- $line = fgets($fd);
- if(feof($fd)) continue;
- $new_format = '([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),(.*)';
- $old_format = '([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),(.*)';
- preg_match("/${new_format}|${old_format}/", $line, $matches);
- $address = $matches[1];
- $timestamp = $matches[2];
- $direction = $matches[3];
- $type = $matches[4];
- $filtered = $matches[5];
- if(count($matches) == 8) {
- $category = $matches[6];
- $data = $matches[7];
- } else {
- $category = "";
- $data = $matches[6];
- }
-
- if($direction == '0') {
- $bgcolor = $convo_remote_bgcolor;
- $user = "&lt;<span style='color: $convo_remote_color;'>$remoteuser</span>&gt;";
- }
- if($direction == '1') {
- $bgcolor = $convo_local_bgcolor;
- $user = "&lt;<span style='color: $convo_local_color;'>$localuser</span>&gt;";
- }
-
- $time = strftime("%H:%M:%S", $timestamp);
-
- print("<tr bgcolor='$bgcolor'><td style='width: 30px; vertical-align: top;'>[$time]</td>\n
- <td style=' width: 60px; vertical-align: top;'>$user</td>\n
- <td style=' width: 60px; vertical-align: top;'>$category</td>\n
- <td style='vertical-align: top;'>$data</td></tr>\n");
- }
- print("</table>\n");
- fclose($fd);
- }
- }
- exit;
-}
-/* defaults to this page but if no settings are present, redirect to setup page */
-if(!$imspector_config["enable"] || !$imspector_config["iface_array"] || !$imspector_config["proto_array"])
- Header("Location: /pkg_edit.php?xml=imspector.xml&id=0");
-
-$pgtitle = "Services: IMSpector Log Viewer";
-include("head.inc");
-/* put your custom HTML head content here */
-/* using some of the $pfSenseHead function calls */
-//$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />");
-//echo $pfSenseHead->getHTML();
-?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<?php if ($savemsg) print_info_box($savemsg); ?>
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Settings "), false, "/pkg_edit.php?xml=imspector.xml&id=0");
- $tab_array[] = array(gettext("Replacements "), false, "/pkg_edit.php?xml=imspector_replacements.xml&id=0");
- $tab_array[] = array(gettext("Access Lists "), false, "/pkg.php?xml=imspector_acls.xml");
- $tab_array[] = array(gettext("Log "), true, "/imspector_logs.php");
- $tab_array[] = array(gettext("Sync "), false, "/pkg_edit.php?xml=imspector_sync.xml&id=0");
-
- display_top_tabs($tab_array);
-?>
-</table>
-
-<?php
-$csrf_token= csrf_get_tokens();
-$zz = <<<EOD
-<script type="text/javascript">
-var section = 'none';
-var moveit = 1;
-var the_timeout;
-
-function xmlhttpPost()
-{
- var xmlHttpReq = false;
- var self = this;
-
- if (window.XMLHttpRequest)
- self.xmlHttpReq = new XMLHttpRequest();
- else if (window.ActiveXObject)
- self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
-
- self.xmlHttpReq.open('POST', 'imspector_logs.php', true);
- self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-
- self.xmlHttpReq.onreadystatechange = function() {
- if (self.xmlHttpReq && self.xmlHttpReq.readyState == 4)
- updatepage(self.xmlHttpReq.responseText);
- }
-
- document.getElementById('im_status').style.display = "inline";
- self.xmlHttpReq.send("mode=render&section=" + section + "&__csrf_magic={$csrf_token}");
-}
-
-function updatepage(str)
-{
- /* update the list of conversations ( if we need to ) */
- var parts = str.split("--END--\\n");
- var lines = parts[0].split("\\n");
-
- for (var line = 0 ; line < lines.length ; line ++) {
- var a = lines[line].split("|");
-
- if (!a[1] || !a[2] || !a[3]) continue;
-
- /* create titling information if needed */
- if (!document.getElementById(a[1])) {
- document.getElementById('im_convos').innerHTML +=
- "<div id='" + a[1] + "_t' style='width: 100%; background-color: $list_protocol_bgcolor; color: $list_protocol_color;'>" + a[1] + "</div>" +
- "<div id='" + a[1] + "' style='width: 100%; background-color: $list_local_bgcolor;'></div>";
- }
- if (!document.getElementById(a[1] + "_" + a[2])) {
- var imageref = "";
- if (a[0]) imageref = "<img src='" + a[0] + "' alt='" + a[1] + "'/>";
- document.getElementById(a[1]).innerHTML +=
- "<div id='" + a[1] + "_" + a[2] + "_t' style='width: 100%; color: $list_local_color; padding-left: 5px;'>" + imageref + a[2] + "</div>" +
- "<div id='" + a[1] + "_" + a[2] + "' style='width: 100%; background-color: $list_remote_bgcolor; border-bottom: solid 1px $list_end_bgcolor;'></div>";
- }
- if (!document.getElementById(a[1] + "_" + a[2] + "_" + a[3])) {
- document.getElementById(a[1] + "_" + a[2]).innerHTML +=
- "<div id='" + a[1] + "_" + a[2] + "_" + a[3] + "_t' style='width: 100%; color: $list_remote_color; padding-left: 10px;'>" + a[3] + "</div>" +
- "<div id='" + a[1] + "_" + a[2] + "_" + a[3] + "' style='width: 100%;'></div>";
- }
- if (!document.getElementById(a[1] + "_" + a[2] + "_" + a[3] + "_" + a[4])) {
- document.getElementById(a[1] + "_" + a[2] + "_" + a[3]).innerHTML +=
- "<div id='" + a[1] + "_" + a[2] + "_" + a[3] + "_" + a[4] +
- "' style='width: 100%; color: $list_convo_color; cursor: pointer; padding-left: 15px;' onClick=" +
- '"' + "setsection('" + a[1] + "|" + a[2] + "|" + a[3] + "|" + a[4] + "');" + '"' + "' + >&raquo;" + a[4] + "</div>";
- }
- }
-
- /* determine the title of this conversation */
- var details = parts[1].split(",");
- var title = details[0] + " conversation between <span style='color: $convo_local_color;'>" + details[ 1 ] +
- "</span> and <span style='color: $convo_remote_color;'>" + details[2] + "</span>";
- if (!details[1]) title = "&nbsp;";
- if (!parts[2]) parts[2] = "&nbsp;";
-
- document.getElementById('im_status').style.display = "none";
- var bottom = parseInt(document.getElementById('im_content').scrollTop);
- var bottom2 = parseInt(document.getElementById('im_content').style.height);
- var absheight = parseInt( bottom + bottom2 );
- if (absheight == document.getElementById('im_content').scrollHeight) {
- moveit = 1;
- } else {
- moveit = 0;
- }
- document.getElementById('im_content').innerHTML = parts[2];
- if (moveit == 1) {
- document.getElementById('im_content').scrollTop = 0;
- document.getElementById('im_content').scrollTop = document.getElementById('im_content').scrollHeight;
- }
- document.getElementById('im_content_title').innerHTML = title;
- the_timeout = setTimeout( "xmlhttpPost();", 5000 );
-}
-
-function setsection(value)
-{
- section = value;
- clearTimeout(the_timeout);
- xmlhttpPost();
- document.getElementById('im_content').scrollTop = 0;
- document.getElementById('im_content').scrollTop = document.getElementById('im_content').scrollHeight;
-}
-</script>
-EOD;
-print($zz);
-?>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont">
- <div style='width: 100%; text-align: right;'><span id='im_status' style='display: none;'>Updating</span>&nbsp;</div>
- <table width="100%">
- <tr>
- <td width="15%" bgcolor="<?=$default_bgcolor?>" style="overflow: auto; border: solid 1px <?=$border_color?>;">
- <div id="im_convos" style="height: 400px; overflow: auto; overflow-x: hidden;"></div>
- </td>
- <td width="75%" bgcolor="<?=$default_bgcolor?>" style="border: solid 1px <?=$border_color?>;">
- <div id="im_content_title" style="height: 20px; overflow: auto; vertical-align: top;
- color: <?=$convo_title_color?>; background-color: <?=$convo_title_bgcolor?>;"></div>
- <div id="im_content" style="height: 380px; overflow: auto; vertical-align: bottom; overflow-x: hidden;"></div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-<script type="text/javascript">xmlhttpPost();</script>
-
-</div>
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/imspector/imspector.inc b/config/imspector/imspector.inc
index d2757be8..52c7ae1b 100644
--- a/config/imspector/imspector.inc
+++ b/config/imspector/imspector.inc
@@ -2,6 +2,7 @@
/*
imspector.inc
part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2012 Marcello Coutinho.
Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>.
Copyright (C) 2011 Bill Marquette <billm@gmail.com>.
Copyright (C) 2007 Ryan Wagoner <rswagoner@gmail.com>.
@@ -31,6 +32,7 @@
require_once("config.inc");
require_once("functions.inc");
+ require_once("service-utils.inc");
/* IMSpector */
@@ -38,20 +40,17 @@
define('IMSPECTOR_ETC', '/usr/local/etc/imspector');
define('IMSPECTOR_CONFIG', IMSPECTOR_ETC . '/imspector.conf');
- function imspector_notice ($msg) { syslog(LOG_NOTICE, "imspector: {$msg}"); }
function imspector_warn ($msg) { syslog(LOG_WARNING, "imspector: {$msg}"); }
+ function ims_text_area_decode($text){
+ return preg_replace('/\r\n/', "\n",base64_decode($text));
+ }
+
function imspector_action ($action) {
if (file_exists(IMSPECTOR_RCFILE))
mwexec(IMSPECTOR_RCFILE.' '.$action);
}
- function imspector_running () {
- if((int)exec('pgrep imspector | wc -l') > 0)
- return true;
- return false;
- }
-
function write_imspector_config($file, $text) {
$conf = fopen($file, 'w');
if(!$conf) {
@@ -95,18 +94,19 @@
function validate_form_imspector($post, $input_errors) {
if($post['iface_array'])
foreach($post['iface_array'] as $iface)
- if($iface == 'wan')
+ if($iface == 'wanx')
$input_errors[] = 'It is a security risk to specify WAN in the \'Interface\' field';
}
function deinstall_package_imspector() {
imspector_action('stop');
- @unlink(IMSPECTOR_RCFILE);
- @unlink(IMSPECTOR_CONFIG);
- @unlink(IMSPECTOR_ETC . '/badwords_custom.txt');
- @unlink(IMSPECTOR_ETC . '/acl_blacklist.txt');
- @unlink(IMSPECTOR_ETC . '/acl_whitelist.txt');
+ unlink_if_exists(IMSPECTOR_RCFILE);
+ unlink_if_exists(IMSPECTOR_CONFIG);
+ unlink_if_exists(IMSPECTOR_ETC . '/badwords_custom.txt');
+ unlink_if_exists(IMSPECTOR_ETC . '/acl_blacklist.txt');
+ unlink_if_exists(IMSPECTOR_ETC . '/acl_whitelist.txt');
+ unlink_if_exists('/usr/local/www/imspector_logs.php');
//exec('pkg_delete imspector-0.4');
}
@@ -122,7 +122,7 @@
break;
case 'rule':
$rules = "# IMSpector \n";
- $rules .= "anchor \"miniupnpd\"\n";
+ $rules .= "anchor \"imspector\"\n";
break;
}
@@ -133,21 +133,60 @@
global $config;
global $input_errors;
+ /*detect boot process*/
+ if (is_array($_POST)){
+ if (preg_match("/\w+/",$_POST['__csrf_magic']))
+ unset($boot_process);
+ else
+ $boot_process="on";
+ }
+
+ if (is_process_running('imspector') && isset($boot_process))
+ return;
+
+ /* check default options and sample files*/
+ $load_samples=0;
+
+ #bannedphraselist
+ if (!is_array($config['installedpackages']['imspectoracls'])){
+ $config['installedpackages']['imspectoracls']['config'][]=array('enable'=> 'on',
+ 'description' => 'allow access to all ids',
+ 'action' => 'allow',
+ 'localid' => 'all',
+ 'remoteid' => base64_encode('all'));
+ $load_samples++;
+ }
+ $ims_acls = $config['installedpackages']['imspectoracls']['config'];
+
+ if (is_array($config['installedpackages']['imspectorreplacements'])){
+ if ($config['installedpackages']['imspectorreplacements']['config'][0]['badwords_list'] == "" && file_exists(IMSPECTOR_ETC . '/badwords.txt')){
+ $config['installedpackages']['imspectorreplacements']['config'][0]['badwords_list'] = base64_encode(file_get_contents(IMSPECTOR_ETC . '/badwords.txt'));
+ $load_samples++;
+ }
+ $ims_replacements = $config['installedpackages']['imspectorreplacements']['config'][0];
+ }
+
+ if (is_array($config['installedpackages']['imspector']))
+ $ims_config = $config['installedpackages']['imspector']['config'][0];
+
+ if($load_samples > 0)
+ write_config();
+
+ /*continue sync process*/
+ log_error("Imspector: Saving changes.");
config_lock();
-
- $imspector_config = $config['installedpackages']['imspector']['config'][0];
-
+
/* remove existing rules */
- exec('/sbin/pfctl -a imspector -Fr');
- exec('/sbin/pfctl -a imspector -Fn');
+ exec('/sbin/pfctl -a imspector -Fr > /dev/null');
+ exec('/sbin/pfctl -a imspector -Fn > /dev/null');
$ifaces_active = '';
- if($imspector_config['enable'] && $imspector_config['proto_array'])
- $proto_array = explode(',', $imspector_config['proto_array']);
+ if($ims_config['enable'] && $ims_config['proto_array'])
+ $proto_array = explode(',', $ims_config['proto_array']);
- if($imspector_config['enable'] && $imspector_config['iface_array'])
- $iface_array = explode(',', $imspector_config['iface_array']);
+ if($ims_config['enable'] && $ims_config['iface_array'])
+ $iface_array = explode(',', $ims_config['iface_array']);
if($iface_array && $proto_array) {
foreach($iface_array as $iface) {
@@ -175,8 +214,11 @@
imspector_warn("Could not resolve real interface for {$iface}");
}
}
-
+
+
+ /*reload rules*/
if($pf_rules) {
+ log_error("Imspector: Reloading rules.");
exec("echo \"{$pf_rules}\" | /sbin/pfctl -a imspector -f -");
conf_mount_rw();
@@ -188,69 +230,59 @@
foreach($proto_array as $proto)
$conf[$proto . '_protocol'] = 'on';
- if($imspector_config['log_file']) {
+ if($ims_config['log_file']) {
@mkdir('/var/imspector');
$conf['file_logging_dir'] = '/var/imspector';
}
- if($imspector_config['log_mysql']) {
- $conf['mysql_server'] = $imspector_config['mysql_server'];
- $conf['mysql_database'] = $imspector_config['mysql_database'];
- $conf['mysql_username'] = $imspector_config['mysql_username'];
- $conf['mysql_password'] = $imspector_config['mysql_password'];
+ if($ims_config['log_mysql']) {
+ $conf['mysql_server'] = $ims_config['mysql_server'];
+ $conf['mysql_database'] = $ims_config['mysql_database'];
+ $conf['mysql_username'] = $ims_config['mysql_username'];
+ $conf['mysql_password'] = $ims_config['mysql_password'];
}
- if($imspector_config['filter_badwords']) {
- if(!empty($imspector_config["badwords_list"])) {
- $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords_custom.txt';
- write_imspector_config(IMSPECTOR_ETC . '/badwords_custom.txt',
- str_replace("\r", '', base64_decode($imspector_config["badwords_list"])));
- } else
- $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords.txt';
- }
+ if($ims_replacements['filter_badwords']) {
+ write_imspector_config(IMSPECTOR_ETC . '/badwords_custom.txt', ims_text_area_decode($ims_replacements["badwords_list"]));
+ $conf['badwords_filename'] = IMSPECTOR_ETC . '/badwords_custom.txt';
+ }
- if($imspector_config['block_files'])
+ if($ims_replacements['block_files'])
$conf['block_files'] = 'on';
-
- if($imspector_config['block_unlisted'])
- $conf['block_unlisted'] = 'on';
-
- if(!empty($imspector_config['acl_whitelist'])) {
- $conf['whitelist_filename'] = IMSPECTOR_ETC . '/acl_whitelist.txt';
- write_imspector_config(IMSPECTOR_ETC . '/acl_whitelist.txt',
- str_replace("\r", '', base64_decode($imspector_config["acl_whitelist"])));
- }
-
- if(!empty($imspector_config['acl_blacklist'])) {
- $conf['blacklist_filename'] = IMSPECTOR_ETC . '/acl_blacklist.txt';
- write_imspector_config(IMSPECTOR_ETC . '/acl_blacklist.txt',
- str_replace("\r", '', base64_decode($imspector_config["acl_blacklist"])));
- }
+
+ if($ims_replacements['block_webcams'])
+ $conf['block_webcams'] = 'on';
+
+ $acls="";
+ $conf['acl_filename'] = IMSPECTOR_ETC . '/acls.txt';
+ foreach ($ims_acls as $rule){
+ if ($rule['enable']){
+ $acls.= "{$rule['action']} {$rule['localid']} ".preg_replace("/\s+/"," ",base64_decode($rule['remoteid']))."\n";
+ }
+ }
+ write_imspector_config(IMSPECTOR_ETC . '/acls.txt', $acls);
// Handle Jabber SSL options
- if(isset($imspector_config["ssl_ca_cert"]) && $imspector_config["ssl_ca_cert"] != "none" &&
- isset($imspector_config["ssl_server_cert"]) && $imspector_config["ssl_server_cert"] != "none") {
+ if(isset($ims_config["ssl_ca_cert"]) && $ims_config["ssl_ca_cert"] != "none" &&
+ isset($ims_config["ssl_server_cert"]) && $ims_config["ssl_server_cert"] != "none") {
$conf['ssl'] = "on";
if(!is_dir(IMSPECTOR_ETC . "/ssl"))
mkdir(IMSPECTOR_ETC . "/ssl");
- $ca_cert = lookup_ca($imspector_config["ssl_ca_cert"]);
+ $ca_cert = lookup_ca($ims_config["ssl_ca_cert"]);
if ($ca_cert != false) {
if(base64_decode($ca_cert['prv'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_key.pem",
- base64_decode($ca_cert['prv']));
+ file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_key.pem", base64_decode($ca_cert['prv']));
$conf['ssl_ca_key'] = IMSPECTOR_ETC . '/ssl/ssl_ca_key.pem';
}
if(base64_decode($ca_cert['crt'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem",
- base64_decode($ca_cert['crt']));
+ file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem", base64_decode($ca_cert['crt']));
$conf['ssl_ca_cert'] = IMSPECTOR_ETC . "/ssl/ssl_ca_cert.pem";
}
- $svr_cert = lookup_cert($imspector_config["ssl_server_cert"]);
+ $svr_cert = lookup_cert($ims_config["ssl_server_cert"]);
if ($svr_cert != false) {
if(base64_decode($svr_cert['prv'])) {
- file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_server_key.pem",
- base64_decode($svr_cert['prv']));
+ file_put_contents(IMSPECTOR_ETC . "/ssl/ssl_server_key.pem", base64_decode($svr_cert['prv']));
$conf['ssl_key'] = IMSPECTOR_ETC . '/ssl/ssl_server_key.pem';
}
@@ -263,42 +295,68 @@
unset($conf['ssl']);
}
- if (isset($imspector_config['resonder']) && $imspector_config['resonder'] == 'on') {
+ if (isset($ims_replacements['responder']) && $ims_replacements['responder'] == 'on') {
$conf['responder_filename'] = IMSPECTOR_ETC . "/responder.db";
- if (isset($imspector_config['prefix_message']) && $imspector_config['prefix_message'] != '' ) {
- $conf['response_prefix'] = base64_decode($imspector_config['prefix_message']) . " -=";
+ if (isset($ims_replacements['prefix_message']) && $ims_replacements['prefix_message'] != '' ) {
+ $conf['response_prefix'] = " .={$ims_replacements['prefix_message']}=.";
}
- if (isset($imspector_config['notice_days']) && is_numeric($imspector_config['notice_days'])) {
- if ($imspector_config['notice_days'] != 0) {
- $conf['notice_days'] = $imspector_config['notice_days'];
+ else{
+ $conf['response_prefix'] = " .=Your activities are being logged=.";
+ }
+ if (isset($ims_replacements['notice_days']) && is_numeric($ims_replacements['notice_days'])) {
+ if ($ims_replacements['notice_days'] != 0) {
+ $conf['notice_days'] = $ims_replacements['notice_days'];
}
} else {
$conf['notice_days'] = 1;
}
- $conf['notice_response'] = "Your activities are being logged";
- if (isset($imspector_config['filtered_minutes']) && is_numeric($imspector_config['filtered_minutes'])) {
- if ($imspector_config['filtered_minutes'] != 0) {
- $conf['filtered_mins'] = $imspector_config['filtered_minutes'];
+
+ /*Custom recorded message response*/
+ if(isset($ims_replacements['recorded_message']) && $ims_replacements['recorded_message'] != '' ){
+ $conf['notice_response'] = ims_text_area_decode($ims_replacements['recorded_message']);
+ }
+ else{
+ $conf['notice_response'] = "Your activities are being logged";
+ }
+
+ /*Filtered Frequency*/
+ if (isset($ims_replacements['filtered_minutes']) && is_numeric($ims_replacements['filtered_minutes'])) {
+ if ($ims_replacements['filtered_minutes'] != 0) {
+ $conf['filtered_mins'] = $ims_replacements['filtered_minutes'];
}
} else {
$conf['filtered_mins'] = 15;
}
- $conf['filtered_response'] = "Your message has been filtered";
+
+ /*Custom filtered message response*/
+ if(isset($ims_replacements['filtered_message']) && $ims_replacements['filtered_message'] != '' ){
+ $conf['filtered_response'] = ims_text_area_decode($ims_replacements['filtered_message']);
+ }
+ else{
+ $conf['filtered_response'] = "Your message has been filtered";
+ }
}
$conftext = '';
foreach($conf as $var => $key)
$conftext .= "{$var}={$key}\n";
write_imspector_config(IMSPECTOR_CONFIG, $conftext);
+
+ /*Check template settings*/
+ if ($ims_config['template'] == "")
+ $template="services_imspector_logs.php";
+ else
+ $template=$ims_config['template'];
+ /*link template file*/
+ $link="/usr/local/www/imspector_logs.php";
+ unlink_if_exists($link);
+ symlink("/usr/local/www/{$template}", $link);
+
/* generate rc file start and stop */
$stop = <<<EOD
-if [ `pgrep imspector | wc -l` != 0 ]; then
- /usr/bin/killall imspector
- while [ `pgrep imspector | wc -l` != 0 ]; do
- sleep 1
- done
- fi
+/bin/pkill -x imspector
+/bin/sleep 1
EOD;
$start = $stop."\n\tldconfig -m /usr/local/lib/mysql\n";
$start .= "\t/usr/local/sbin/imspector -c \"".IMSPECTOR_CONFIG."\"";
@@ -310,18 +368,7 @@ EOD;
)
);
- conf_mount_ro();
-
- /* if imspector not running start it */
- if(!imspector_running()) {
- imspector_notice("Starting service on interface: {$ifaces_active}");
- imspector_action('start');
- }
- /* or restart imspector if settings were changed */
- elseif($_POST['iface_array']) {
- imspector_notice("Restarting service on interface: {$ifaces_active}");
- imspector_action('restart');
- }
+ conf_mount_ro();
}
}
@@ -330,10 +377,10 @@ EOD;
/* lets stop the service and remove the rc file */
if(file_exists(IMSPECTOR_RCFILE)) {
- if(!$imspector_config['enable'])
- imspector_notice('Stopping service: imspector disabled');
+ if(!$ims_config['enable'])
+ log_error('Impsector: Stopping service: imspector disabled');
else
- imspector_notice('Stopping service: no interfaces and/or protocols selected');
+ log_error('Impsector: Stopping service: no interfaces and/or protocols selected');
imspector_action('stop');
@@ -345,9 +392,23 @@ EOD;
@unlink(IMSPECTOR_ETC . '/acl_whitelist.txt');
conf_mount_ro();
}
+ }
+ else{
+ /* if imspector not running start it */
+ if(!is_process_running('imspector')) {
+ log_error("Impsector: Starting service on interface: {$ifaces_active}");
+ imspector_action('start');
+ }
+ /* or restart imspector if settings were changed */
+ else{
+ log_error("Impsector: Restarting service on interface: {$ifaces_active}");
+ imspector_action('restart');
+ }
}
-
- config_unlock();
+ config_unlock();
+
+ /*check xmlrpc sync*/
+ imspector_sync_on_changes();
}
function imspector_get_ca_certs() {
@@ -371,4 +432,115 @@ EOD;
}
return $cert_arr;
}
-?> \ No newline at end of file
+
+/* Uses XMLRPC to synchronize the changes to a remote node */
+function imspector_sync_on_changes() {
+ global $config, $g;
+
+ $synconchanges = $config['installedpackages']['imspectorsync']['config'][0]['synconchanges'];
+ if(!$synconchanges)
+ return;
+ log_error("Imspector: xmlrpc sync is starting.");
+ foreach ($config['installedpackages']['imspectorsync']['config'] as $rs ){
+ foreach($rs['row'] as $sh){
+ $sync_to_ip = $sh['ipaddress'];
+ $password = $sh['password'];
+ if($password && $sync_to_ip)
+ imspector_do_xmlrpc_sync($sync_to_ip, $password);
+ }
+ }
+ log_error("Imspector: xmlrpc sync is ending.");
+}
+/* Do the actual XMLRPC sync */
+function imspector_do_xmlrpc_sync($sync_to_ip, $password) {
+ global $config, $g;
+
+ if(!$password)
+ return;
+
+ if(!$sync_to_ip)
+ return;
+ $username="admin";
+
+ $xmlrpc_sync_neighbor = $sync_to_ip;
+ 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 = "80";
+ else
+ $port = "443";
+ }
+ $synchronizetoip .= $sync_to_ip;
+
+ /* xml will hold the sections to sync */
+ $xml = array();
+ $xml['imspector'] = $config['installedpackages']['imspector'];
+ $xml['imspectorreplacements'] = $config['installedpackages']['imspectorreplacements'];
+ $xml['imspectoracls'] = $config['installedpackages']['imspectoracls'];
+ /* 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 */
+ $url = $synchronizetoip;
+ log_error("Imspector: Beginning 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'])
+ $cli->setDebug(1);
+ /* send our XMLRPC message and timeout after 250 seconds */
+ $resp = $cli->send($msg, "250");
+ if(!$resp) {
+ $error = "A communications error occurred while attempting imspector XMLRPC sync with {$url}:{$port}.";
+ log_error($error);
+ file_notice("sync_settings", $error, "imspector Settings Sync", "");
+ } elseif($resp->faultCode()) {
+ $cli->setDebug(1);
+ $resp = $cli->send($msg, "250");
+ $error = "An error code was received while attempting imspector XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
+ log_error($error);
+ file_notice("sync_settings", $error, "imspector Settings Sync", "");
+ } else {
+ log_error("imspector XMLRPC sync successfully completed with {$url}:{$port}.");
+ }
+
+ /* tell imspector to reload our settings on the destionation sync host. */
+ $method = 'pfsense.exec_php';
+ $execcmd = "require_once('/usr/local/pkg/imspector.inc');\n";
+ $execcmd .= "sync_package_imspector();";
+ /* assemble xmlrpc payload */
+ $params = array(
+ XML_RPC_encode($password),
+ XML_RPC_encode($execcmd)
+ );
+
+ log_error("imspector 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) {
+ $error = "A communications error occurred while attempting imspector XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
+ log_error($error);
+ file_notice("sync_settings", $error, "imspector Settings Sync", "");
+ } elseif($resp->faultCode()) {
+ $cli->setDebug(1);
+ $resp = $cli->send($msg, "250");
+ $error = "An error code was received while attempting imspector XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
+ log_error($error);
+ file_notice("sync_settings", $error, "imspector Settings Sync", "");
+ } else {
+ log_error("imspector XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
+ }
+
+}
+?>
diff --git a/config/imspector/imspector.xml b/config/imspector/imspector.xml
index d42e7a18..72969778 100644
--- a/config/imspector/imspector.xml
+++ b/config/imspector/imspector.xml
@@ -43,10 +43,9 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>imspector</name>
- <version>0.9</version>
+ <version>20111108</version>
<title>Services: IMSpector</title>
- <savetext>Change</savetext>
- <aftersaveredirect>/services_imspector_logs.php</aftersaveredirect>
+ <savetext>Save</savetext>
<include_file>/usr/local/pkg/imspector.inc</include_file>
<menu>
<name>IMSpector</name>
@@ -58,38 +57,81 @@
<name>imspector</name>
<rcfile>imspector.sh</rcfile>
<executable>imspector</executable>
+ <description><![CDATA[Instant Messenger transparent proxy]]></description>
</service>
<tabs>
<tab>
- <text>IMSpector Log Viewer</text>
- <url>/services_imspector_logs.php</url>
- </tab>
- <tab>
- <text>IMSpector Settings</text>
+ <text>Settings</text>
<url>/pkg_edit.php?xml=imspector.xml&amp;id=0</url>
<active/>
</tab>
+ <tab>
+ <text>Replacements</text>
+ <url>/pkg_edit.php?xml=imspector_replacements.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Access Lists</text>
+ <url>/pkg.php?xml=imspector_acls.xml</url>
+ </tab>
+ <tab>
+ <text>Log</text>
+ <url>/imspector_logs.php</url>
+ </tab>
+ <tab>
+ <text>Sync</text>
+ <url>/pkg_edit.php?xml=imspector_sync.xml</url>
+ </tab>
</tabs>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/imspector/imspector_sync.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/imspector/imspector_replacements.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/imspector/imspector_acls.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/imspector/imspector.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/imspector/imspector_logs.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/imspector/services_imspector_logs.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/imspector/services_imspector_logs2.php</item>
+ </additional_files_needed>
<fields>
<field>
+ <name>General Settings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
<fielddescr>Enable IMSpector</fielddescr>
<fieldname>enable</fieldname>
<type>checkbox</type>
</field>
<field>
- <fielddescr>Interfaces (generally LAN)</fielddescr>
+ <fielddescr>Interfaces</fielddescr>
<fieldname>iface_array</fieldname>
- <description>You can use the CTRL or COMMAND key to select multiple interfaces.</description>
+ <description><![CDATA[<strong>Generally select internal interface(s) like LAN</strong><br>
+ You can use the CTRL or COMMAND key to select multiple interfaces.]]></description>
<type>interfaces_selection</type>
<size>3</size>
<required/>
@@ -99,203 +141,101 @@
<field>
<fielddescr>Listen on protocols</fielddescr>
<fieldname>proto_array</fieldname>
- <description>You can use the CTRL or COMMAND key to select multiple protocols. NOTE: Gtalk/Jabber-SSL requires SSL certificates.</description>
+ <description><![CDATA[<strong>NOTE: Gtalk/Jabber-SSL requires SSL certificates.</strong><br>
+ You can use the CTRL or COMMAND key to select multiple protocols.]]></description>
<type>select</type>
<size>7</size>
<required/>
<multiple>true</multiple>
<options>
- <option>
- <name>MSN</name>
- <value>msn</value>
- </option>
- <option>
- <name>ICQ/AIM</name>
- <value>icq</value>
- </option>
- <option>
- <name>Yahoo</name>
- <value>yahoo</value>
- </option>
- <option>
- <name>IRC</name>
- <value>irc</value>
- </option>
- <option>
- <name>Jabber</name>
- <value>jabber</value>
- </option>
- <option>
- <name>Gtalk/Jabber-SSL</name>
- <value>jabber-ssl</value>
- </option>
- <option>
- <name>Gadu-Gadu</name>
- <value>gadu-gadu</value>
- </option>
+ <option><name>MSN</name><value>msn</value></option>
+ <option><name>ICQ/AIM</name><value>icq</value></option>
+ <option><name>Yahoo</name><value>yahoo</value></option>
+ <option><name>IRC</name><value>irc</value></option>
+ <option><name>Jabber</name><value>jabber</value></option>
+ <option><name>Gtalk/Jabber-SSL</name><value>jabber-ssl</value></option>
+ <option><name>Gadu-Gadu</name><value>gadu-gadu</value></option>
</options>
</field>
<field>
- <fielddescr>Enable file logging</fielddescr>
- <fieldname>log_file</fieldname>
- <description>Log files stored in /var/imspector.</description>
- <type>checkbox</type>
- </field>
- <field>
- <fielddescr>Enable mySQL logging</fielddescr>
- <fieldname>log_mysql</fieldname>
- <description>Make sure to specify your MySQL credentials below.</description>
- <type>checkbox</type>
- </field>
- <field>
- <fielddescr>mySQL server</fielddescr>
- <fieldname>mysql_server</fieldname>
- <type>input</type>
- </field>
- <field>
- <fielddescr>mySQL database</fielddescr>
- <fieldname>mysql_database</fieldname>
- <type>input</type>
- </field>
- <field>
- <fielddescr>mySQL username</fielddescr>
- <fieldname>mysql_username</fieldname>
- <type>input</type>
- </field>
- <field>
- <fielddescr>mySQL password</fielddescr>
- <fieldname>mysql_password</fieldname>
- <type>password</type>
- </field>
- <field>
- <fielddescr>SSL Certificate</fielddescr>
- <fieldname>ssl_server_cert</fieldname>
+ <fielddescr>SSL CA Certificate</fielddescr>
+ <fieldname>ssl_ca_cert</fieldname>
<description>
- Choose the SSL Server Certificate here.
+ Choose the SSL CA Certficate here.
</description>
<type>select_source</type>
- <source><![CDATA[imspector_get_server_certs()]]></source>
+ <source><![CDATA[imspector_get_ca_certs()]]></source>
<source_name>descr</source_name>
<source_value>refid</source_value>
</field>
<field>
- <fielddescr>SSL CA Certificate</fielddescr>
- <fieldname>ssl_ca_cert</fieldname>
+ <fielddescr>SSL Certificate</fielddescr>
+ <fieldname>ssl_server_cert</fieldname>
<description>
- Choose the SSL CA Certficate here.
+ Choose the SSL Server Certificate here.
</description>
<type>select_source</type>
- <source><![CDATA[imspector_get_ca_certs()]]></source>
+ <source><![CDATA[imspector_get_server_certs()]]></source>
<source_name>descr</source_name>
<source_value>refid</source_value>
</field>
<field>
- <fielddescr>Enable bad word filtering</fielddescr>
- <fieldname>filter_badwords</fieldname>
- <description>Replace characters of matched bad word with *.</description>
- <type>checkbox</type>
+ <name>Logging</name>
+ <type>listtopic</type>
</field>
<field>
- <fielddescr>Enable response messages</fielddescr>
- <fieldname>resonder</fieldname>
- <description>
- Inform the users (both local and remote) that the conversation they are having is being recorded. This might be needed for legal reasons.
- Inform the sender that a file (or message) was blocked. This is useful because the sender will know a block occured, instead of the transfer simply failing.</description>
+ <fielddescr>Enable file logging</fielddescr>
+ <fieldname>log_file</fieldname>
+ <description>Log files stored in /var/imspector.</description>
<type>checkbox</type>
</field>
<field>
- <fielddescr>Notification frequency</fielddescr>
- <fieldname>notice_days</fieldname>
- <type>input</type>
- <description>Frequency in number of days for notifying users they are being logged. Default 1 day if responses are enabled, set to 0 to disable</description>
- </field>
- <field>
- <fielddescr>Filtered frequency</fielddescr>
- <fieldname>filtered_minutes</fieldname>
+ <fielddescr>Report limit</fielddescr>
+ <fieldname>reportlimit</fieldname>
+ <description>Max entries to fetch from log dir(s). Default is 50</description>
<type>input</type>
- <description>The time between sending "filtered" in minutes. Default 15 minutes if responses are enabled, set to 0 to disable</description>
- </field>
- <field>
- <fielddescr>Custom message prefix</fielddescr>
- <fieldname>prefix_message</fieldname>
- <description>
- Message to prepend to all IMSpector generated messages. The default is "Message from IMSpector"
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
- </field>
- <field>
- <fielddescr>Custom recorded message response</fielddescr>
- <fieldname>recorded_message</fieldname>
- <description>
- Message to send to users to let them know they are being recorded. The default is "Your activities are being logged"
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
+ <size>10</size>
</field>
<field>
- <fielddescr>Custom filtered message response</fielddescr>
- <fieldname>filtered_message</fieldname>
- <description>
- Message to send to users to let them know about filtered messages.
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
+ <fielddescr>Report template</fielddescr>
+ <fieldname>template</fieldname>
+ <description>Template to use on reports</description>
+ <type>select</type>
+ <required/>
+ <options>
+ <option><name>Default Template</name><value>services_imspector_logs.php</value></option>
+ <option><name>0guzcan Template</name><value>services_imspector_logs2.php</value></option>
+ </options>
</field>
-
<field>
- <fielddescr>Bad words list</fielddescr>
- <fieldname>badwords_list</fieldname>
- <description>
- Place one word or phrase to match per line.&lt;br /&gt;
- If left blank the default list in /usr/local/etc/imspector/badwords.txt will be used.
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
+ <fielddescr>Enable mySQL logging</fielddescr>
+ <fieldname>log_mysql</fieldname>
+ <description>Make sure to specify your MySQL credentials below.</description>
+ <type>checkbox</type>
</field>
<field>
- <fielddescr>Block file transfers</fielddescr>
- <fieldname>block_files</fieldname>
- <description>Block file transfers on supported protocols.</description>
- <type>checkbox</type>
+ <fielddescr>mySQL server</fielddescr>
+ <fieldname>mysql_server</fieldname>
+ <type>input</type>
+ <size>35</size>
</field>
<field>
- <fielddescr>Block non ACL defined</fielddescr>
- <fieldname>block_unlisted</fieldname>
- <description>Overide the default of allowing user's not defined the whitelist or blacklist ACLs.</description>
- <type>checkbox</type>
+ <fielddescr>mySQL database</fielddescr>
+ <fieldname>mysql_database</fieldname>
+ <type>input</type>
+ <size>35</size>
</field>
<field>
- <fielddescr>ACL whitelist</fielddescr>
- <fieldname>acl_whitelist</fieldname>
- <description>
- Example (allow specific access): localuser: remoteuser1 remoteuser2&lt;br /&gt;
- Example (allow full access): localuser:
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
+ <fielddescr>mySQL username</fielddescr>
+ <fieldname>mysql_username</fieldname>
+ <type>input</type>
+ <size>35</size>
</field>
<field>
- <fielddescr>ACL blacklist</fielddescr>
- <fieldname>acl_blacklist</fieldname>
- <description>
- Example (block specifc access): localuser: remoteuser1 remoteuser2&lt;br /&gt;
- Example (block all access): localuser:
- </description>
- <type>textarea</type>
- <encoding>base64</encoding>
- <rows>5</rows>
- <cols>40</cols>
+ <fielddescr>mySQL password</fielddescr>
+ <fieldname>mysql_password</fieldname>
+ <type>password</type>
+ <size>35</size>
</field>
</fields>
<custom_php_validation_command>
@@ -308,4 +248,4 @@
deinstall_package_imspector();
</custom_php_deinstall_command>
<filter_rules_needed>imspector_generate_rules</filter_rules_needed>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/imspector-dev/imspector_acls.xml b/config/imspector/imspector_acls.xml
index 3176c75f..3176c75f 100644
--- a/config/imspector-dev/imspector_acls.xml
+++ b/config/imspector/imspector_acls.xml
diff --git a/config/imspector-dev/imspector_logs.php b/config/imspector/imspector_logs.php
index e44ef35f..e44ef35f 100644
--- a/config/imspector-dev/imspector_logs.php
+++ b/config/imspector/imspector_logs.php
diff --git a/config/imspector-dev/imspector_replacements.xml b/config/imspector/imspector_replacements.xml
index 7f53bbd4..7f53bbd4 100644
--- a/config/imspector-dev/imspector_replacements.xml
+++ b/config/imspector/imspector_replacements.xml
diff --git a/config/imspector-dev/imspector_sync.xml b/config/imspector/imspector_sync.xml
index 3ff88d41..3ff88d41 100644
--- a/config/imspector-dev/imspector_sync.xml
+++ b/config/imspector/imspector_sync.xml
diff --git a/config/imspector/services_imspector_logs.php b/config/imspector/services_imspector_logs.php
index fce9b892..adb3fa66 100644
--- a/config/imspector/services_imspector_logs.php
+++ b/config/imspector/services_imspector_logs.php
@@ -6,6 +6,7 @@
JavaScript Code is GPL Licensed from SmoothWall Express.
Copyright (C) 2007 Ryan Wagoner <rswagoner@gmail.com>.
+ Copyright (C) 2012 Marcello Coutinho
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -60,20 +61,30 @@ $convo_remote_bgcolor = '#eeeeee';
/* functions */
function convert_dir_list ($topdir) {
- if (!is_dir($topdir)) return;
+ global $config;
+ if (!is_dir($topdir))
+ return;
+ $imspector_config = $config['installedpackages']['imspector']['config'][0];
+ $limit=(preg_match("/\d+/",$imspector_config['reportlimit'])?$imspector_config['reportlimit']:"50");
+ $count=0;
if ($dh = opendir($topdir)) {
while (($file = readdir($dh)) !== false) {
- if(!preg_match('/^\./', $file) == 0) continue;
- if (is_dir("$topdir/$file")) {
+ if(!preg_match('/^\./', $file) == 0)
+ continue;
+ if (is_dir("$topdir/$file"))
$list .= convert_dir_list("$topdir/$file");
- } else {
+ else
$list .= "$topdir/$file\n";
+ $count ++;
+ if($count >= $limit){
+ closedir($dh);
+ return $list;
+ }
}
- }
closedir($dh);
- }
+ }
return $list;
-}
+ }
/* ajax response */
if ($_POST['mode'] == "render") {
@@ -157,13 +168,18 @@ include("head.inc");
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php
$tab_array = array();
- $tab_array[] = array(gettext("IMSpector Log Viewer "), true, "/services_imspector_logs.php");
- $tab_array[] = array(gettext("IMSpector Settings "), false, "/pkg_edit.php?xml=imspector.xml&id=0");
+ $tab_array[] = array(gettext("Settings "), false, "/pkg_edit.php?xml=imspector.xml&id=0");
+ $tab_array[] = array(gettext("Replacements "), false, "/pkg_edit.php?xml=imspector_replacements.xml&id=0");
+ $tab_array[] = array(gettext("Access Lists "), false, "/pkg.php?xml=imspector_acls.xml");
+ $tab_array[] = array(gettext("Log "), true, "/imspector_logs.php");
+ $tab_array[] = array(gettext("Sync "), false, "/pkg_edit.php?xml=imspector_sync.xml&id=0");
+
display_top_tabs($tab_array);
?>
</table>
<?php
+$csrf_token= csrf_get_tokens();
$zz = <<<EOD
<script type="text/javascript">
var section = 'none';
@@ -180,7 +196,7 @@ function xmlhttpPost()
else if (window.ActiveXObject)
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
- self.xmlHttpReq.open('POST', 'services_imspector_logs.php', true);
+ self.xmlHttpReq.open('POST', 'imspector_logs.php', true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
@@ -189,7 +205,7 @@ function xmlhttpPost()
}
document.getElementById('im_status').style.display = "inline";
- self.xmlHttpReq.send("mode=render&section=" + section);
+ self.xmlHttpReq.send("mode=render&section=" + section + "&__csrf_magic={$csrf_token}");
}
function updatepage(str)
diff --git a/config/imspector-dev/services_imspector_logs2.php b/config/imspector/services_imspector_logs2.php
index 30f63058..30f63058 100644
--- a/config/imspector-dev/services_imspector_logs2.php
+++ b/config/imspector/services_imspector_logs2.php
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc
index 94c7500c..746b4759 100644
--- a/config/mailreport/mail_reports.inc
+++ b/config/mailreport/mail_reports.inc
@@ -209,11 +209,11 @@ function mail_report_send($headertext, $cmdtext, $logtext, $attachments) {
$mail->ContentType = 'text/html';
$mail->IsHTML(true);
- $mail->AddReplyTo($config['notifications']['smtp']['fromaddress'], "Firewall Graph Report");
- $mail->SetFrom($config['notifications']['smtp']['fromaddress'], "Firewall Graph Report");
+ $mail->AddReplyTo($config['notifications']['smtp']['fromaddress'], "Firewall Email Report");
+ $mail->SetFrom($config['notifications']['smtp']['fromaddress'], "Firewall Email Report");
$address = $config['notifications']['smtp']['notifyemailaddress'];
$mail->AddAddress($address, "Report Recipient");
- $mail->Subject = "{$config['system']['hostname']}.{$config['system']['domain']} Graph Report: {$headertext}";
+ $mail->Subject = "{$config['system']['hostname']}.{$config['system']['domain']} Email Report: {$headertext}";
$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;
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index d9c5dfff..72fe6c87 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,8 +37,8 @@
]]>
</copyright>
<name>mailreport</name>
- <version>2.0.9</version>
- <title>Status: Mail Reports</title>
+ <version>2.0.10</version>
+ <title>Status: Email Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
<chmod>0755</chmod>
@@ -81,8 +81,8 @@
<item>http://www.pfsense.com/packages/config/mailreport/status_mail_report_add_graph.php</item>
</additional_files_needed>
<menu>
- <name>E-Mail Reports</name>
- <tooltiptext>Setup periodic e-mail reports.</tooltiptext>
+ <name>Email Reports</name>
+ <tooltiptext>Setup periodic email reports.</tooltiptext>
<section>Status</section>
<url>/status_mail_report.php</url>
</menu>
@@ -101,4 +101,4 @@
exec("rm /usr/local/www/status_mail_report_add_graph.php");
]]>
</custom_php_deinstall_command>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/mailreport/status_mail_report.php b/config/mailreport/status_mail_report.php
index e08a7272..b530587f 100644
--- a/config/mailreport/status_mail_report.php
+++ b/config/mailreport/status_mail_report.php
@@ -33,8 +33,8 @@
##|+PRIV
##|*IDENT=page-status-mailreports
-##|*NAME=Status: E-Mail Reports page
-##|*DESCR=Allow access to the 'Status: E-Mail Reports' page.
+##|*NAME=Status: Email Reports page
+##|*DESCR=Allow access to the 'Status: Email Reports' page.
##|*MATCH=status_mail_report.php*
##|-PRIV
@@ -54,14 +54,14 @@ if ($_GET['act'] == "del") {
// Fix up cron job(s)
set_mail_report_cron_jobs($a_mailreports);
- write_config("Removed Mail Report '{$name}'");
+ write_config("Removed Email Report '{$name}'");
configure_cron();
header("Location: status_mail_report.php");
exit;
}
}
-$pgtitle = array(gettext("Status"),gettext("Mail Reports"));
+$pgtitle = array(gettext("Status"),gettext("Email Reports"));
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
@@ -69,15 +69,15 @@ 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 to be sent by e-mail. </td></tr>
+ <tr><td colspan="4">Here you can define a list of reports to be sent by email. </td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
- <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>
+ <td width="34%" class="listhdr"><?=gettext("Description");?></td>
+ <td width="24%" class="listhdr"><?=gettext("Schedule");?></td>
+ <td width="12%" class="listhdr"><?=gettext("Commands");?></td>
+ <td width="12%" class="listhdr"><?=gettext("Logs");?></td>
+ <td width="12%" class="listhdr"><?=gettext("Graphs");?></td>
+ <td width="6%" 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>
<?php $i = 0; foreach ($a_mailreports as $mailreport): ?>
<tr ondblclick="document.location='status_mail_report_edit.php?id=<?=$i;?>'">
diff --git a/config/mailreport/status_mail_report_add_cmd.php b/config/mailreport/status_mail_report_add_cmd.php
index b4527584..6a924142 100644
--- a/config/mailreport/status_mail_report_add_cmd.php
+++ b/config/mailreport/status_mail_report_add_cmd.php
@@ -34,8 +34,8 @@
##|+PRIV
##|*IDENT=page-status-mailreportsaddcmd
-##|*NAME=Status: E-Mail Reports: Add Command page
-##|*DESCR=Allow access to the 'Status: E-Mail Reports: Add Command' page.
+##|*NAME=Status: Email Reports: Add Command page
+##|*DESCR=Allow access to the 'Status: Email Reports: Add Command' page.
##|*MATCH=status_mail_report_add_cmd.php*
##|-PRIV
@@ -89,7 +89,7 @@ if ($_POST) {
}
-$pgtitle = array(gettext("Status"),gettext("Add Mail Report Command"));
+$pgtitle = array(gettext("Status"),gettext("Add Email Report Command"));
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
diff --git a/config/mailreport/status_mail_report_add_graph.php b/config/mailreport/status_mail_report_add_graph.php
index 663d8f9b..3f629d56 100644
--- a/config/mailreport/status_mail_report_add_graph.php
+++ b/config/mailreport/status_mail_report_add_graph.php
@@ -34,8 +34,8 @@
##|+PRIV
##|*IDENT=page-status-mailreportsaddgraph
-##|*NAME=Status: E-Mail Reports: Add Graph page
-##|*DESCR=Allow access to the 'Status: E-Mail Reports: Add Graph' page.
+##|*NAME=Status: Email Reports: Add Graph page
+##|*DESCR=Allow access to the 'Status: Email Reports: Add Graph' page.
##|*MATCH=status_mail_report_add_graph.php*
##|-PRIV
@@ -158,7 +158,7 @@ if ($_POST) {
}
-$pgtitle = array(gettext("Status"),gettext("Add Mail Report Graph"));
+$pgtitle = array(gettext("Status"),gettext("Add Email Report Graph"));
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
diff --git a/config/mailreport/status_mail_report_add_log.php b/config/mailreport/status_mail_report_add_log.php
index 0b140723..83786994 100644
--- a/config/mailreport/status_mail_report_add_log.php
+++ b/config/mailreport/status_mail_report_add_log.php
@@ -34,8 +34,8 @@
##|+PRIV
##|*IDENT=page-status-mailreportsaddlog
-##|*NAME=Status: E-Mail Reports: Add Log page
-##|*DESCR=Allow access to the 'Status: E-Mail Reports: Add Log' page.
+##|*NAME=Status: Email Reports: Add Log page
+##|*DESCR=Allow access to the 'Status: Email Reports: Add Log' page.
##|*MATCH=status_mail_report_add_log.php*
##|-PRIV
@@ -95,7 +95,7 @@ if ($_POST) {
}
-$pgtitle = array(gettext("Status"),gettext("Add Mail Report Log"));
+$pgtitle = array(gettext("Status"),gettext("Add Email Report Log"));
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php
index 6cbb8a67..e51a4fc6 100644
--- a/config/mailreport/status_mail_report_edit.php
+++ b/config/mailreport/status_mail_report_edit.php
@@ -33,8 +33,8 @@
##|+PRIV
##|*IDENT=page-status-mailreportsedit
-##|*NAME=Status: E-Mail Reports: Edit Report page
-##|*DESCR=Allow access to the 'Status: E-Mail Reports: Edit Report' page.
+##|*NAME=Status: Email Reports: Edit Report page
+##|*DESCR=Allow access to the 'Status: Email Reports: Edit Report' page.
##|*MATCH=status_mail_report_edit.php*
##|-PRIV
@@ -203,7 +203,7 @@ if ($_POST) {
return;
}
-$pgtitle = array(gettext("Status"),gettext("Edit Mail Reports"));
+$pgtitle = array(gettext("Status"),gettext("Edit Email Reports"));
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
@@ -235,7 +235,7 @@ include("head.inc");
<option value="<?php echo $freq; ?>" <?php if($pconfig["frequency"] === $freq) echo "selected"; ?>><?php echo ucwords($freq); ?></option>
<?php endforeach; ?>
</select>
- <br/>Select the frequency for the report to be sent via e-mail.
+ <br/>Select the frequency for the report to be sent via email.
<br/>
</td>
<td></td>
diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc
index 9af83758..76aeb54f 100644
--- a/config/openbgpd/openbgpd.inc
+++ b/config/openbgpd/openbgpd.inc
@@ -90,9 +90,11 @@ function openbgpd_install_conf() {
$conffile .= "holdtime {$openbgpd_conf['holdtime']}\n";
// Specify listen ip
- if($openbgpd_conf['listenip'])
+ if(!empty($openbgpd_conf['listenip']))
$conffile .= "listen on {$openbgpd_conf['listenip']}\n";
-
+ else
+ $conffile .= "listen on 0.0.0.0\n";
+
// Specify router id
if($openbgpd_conf['routerid'])
$conffile .= "router-id {$openbgpd_conf['routerid']}\n";
@@ -127,8 +129,11 @@ function openbgpd_install_conf() {
$conffile .= "\t\t{$row['parameters']} {$row['parmvalue']} \n";
}
}
- if ($setlocaladdr == true)
+ if ($setlocaladdr == true && !empty($openbgpd_conf['listenip']))
$conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n";
+ else
+ $conffile .= "\t\tlocal-address 0.0.0.0\n";
+
$conffile .= "}\n";
}
}
@@ -157,8 +162,11 @@ function openbgpd_install_conf() {
$conffile .= "\t{$row['parameters']} {$row['parmvalue']} \n";
}
}
- if ($setlocaladdr == true)
+ if ($setlocaladdr == true && !empty($openbgpd_conf['listenip']))
$conffile .= "\tlocal-address {$openbgpd_conf['listenip']}\n";
+ else
+ $conffile .= "\tlocal-address 0.0.0.0\n";
+
$conffile .= "}\n";
}
}
diff --git a/config/pf-blocker/pfblocker.inc b/config/pf-blocker/pfblocker.inc
index c40d742e..9740dce5 100755
--- a/config/pf-blocker/pfblocker.inc
+++ b/config/pf-blocker/pfblocker.inc
@@ -167,15 +167,6 @@ function sync_package_pfblocker($cron="") {
#Create rule if action permits
switch($continent_config['action']){
case "Deny_Both":
- $rule = $base_rule;
- $rule["type"] = $deny_action_inbound;
- $rule["descr"]= "$pfb_alias auto rule";
- $rule["source"]= array("address"=> $pfb_alias);
- $rule["destination"]=array("any"=>"");
- if ($pfblocker_config['enable_log']){
- $rule["log"]="";
- }
- $deny_inbound[]=$rule;
case "Deny_Outbound":
$rule = $base_rule;
$rule["type"] = $deny_action_outbound;
@@ -185,8 +176,9 @@ function sync_package_pfblocker($cron="") {
if ($pfblocker_config['enable_log']){
$rule["log"]="";
}
- $deny_outbound[]=$rule;
- break;
+ $deny_outbound[]=$rule;
+ if ($continent_config['action'] != "Deny_Both")
+ break;
case "Deny_Inbound":
$rule = $base_rule;
$rule["type"] = $deny_action_inbound;
@@ -198,6 +190,7 @@ function sync_package_pfblocker($cron="") {
}
$deny_inbound[]=$rule;
break;
+ case "Permit_Both":
case "Permit_Outbound":
$rule = $base_rule;
$rule["type"] = "pass";
@@ -208,7 +201,8 @@ function sync_package_pfblocker($cron="") {
$rule["log"]="";
}
$permit_outbound[]=$rule;
- break;
+ if ($continent_config['action'] != "Permit_Both")
+ break;
case "Permit_Inbound":
$rule = $base_rule;
$rule["type"] = "pass";
@@ -317,15 +311,6 @@ function sync_package_pfblocker($cron="") {
#Create rule if action permits
switch($list['action']){
case "Deny_Both":
- $rule = $base_rule;
- $rule["type"] = $deny_action_inbound;
- $rule["descr"]= "$alias auto rule";
- $rule["source"]= array("address"=> $alias);
- $rule["destination"]=array("any"=>"");
- if ($pfblocker_config['enable_log']){
- $rule["log"]="";
- }
- $deny_inbound[]=$rule;
case "Deny_Outbound":
$rule = $base_rule;
$rule["type"] = $deny_action_outbound;
@@ -335,8 +320,9 @@ function sync_package_pfblocker($cron="") {
if ($pfblocker_config['enable_log']){
$rule["log"]="";
}
- $deny_outbound[]=$rule;
- break;
+ $deny_outbound[]=$rule;
+ if ($list['action'] != "Deny_Both")
+ break;
case "Deny_Inbound":
$rule = $base_rule;
$rule["type"] = $deny_action_inbound;
@@ -348,6 +334,7 @@ function sync_package_pfblocker($cron="") {
}
$deny_inbound[]=$rule;
break;
+ case "Permit_Both":
case "Permit_Outbound":
$rule = $base_rule;
$rule["type"] = "pass";
@@ -358,7 +345,8 @@ function sync_package_pfblocker($cron="") {
$rule["log"]="";
}
$permit_outbound[]=$rule;
- break;
+ if ($list['action'] != "Permit_Both")
+ break;
case "Permit_Inbound":
$rule = $base_rule;
$rule["type"] = "pass";
diff --git a/config/pf-blocker/pfblocker_lists.xml b/config/pf-blocker/pfblocker_lists.xml
index 4bde4b49..f1798d36 100755
--- a/config/pf-blocker/pfblocker_lists.xml
+++ b/config/pf-blocker/pfblocker_lists.xml
@@ -18,13 +18,16 @@
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
@@ -63,20 +66,24 @@
<active/>
</tab>
+
<tab>
<text>Top Spammers</text>
<url>/pkg_edit.php?xml=pfblocker_topspammers.xml&amp;id=0</url>
</tab>
-
+
+
<tab>
<text>Africa</text>
<url>/pkg_edit.php?xml=pfblocker_Africa.xml&amp;id=0</url>
-
+
+
</tab>
<tab>
<text>Asia</text>
<url>/pkg_edit.php?xml=pfblocker_Asia.xml&amp;id=0</url>
-
+
+
</tab>
<tab>
<text>Europe</text>
@@ -109,6 +116,7 @@
<fieldname>description</fieldname>
</columnitem>
+
<columnitem>
<fielddescr>Action</fielddescr>
<fieldname>action</fieldname>
@@ -176,15 +184,19 @@
<fielddescr>List Action</fielddescr>
<description><![CDATA[Default:<strong>Deny Inbound</strong><br>
Select action for network on lists you have selected.<br><br>
- <strong>Note: </strong><br>'Deny Both' - Will deny access on Both directions.<br>
- 'Deny Inbound' - Will deny access from selected lists to your network.<br>
- 'Deny Outbound' - Will deny access from your users to ip lists you selected to block.<br>
- 'Permit Inbound' - Will allow access from selected lists to your network.<br>
- 'Permit Outbound' - Will allow access from your users to ip lists you selected to block.<br>
- 'Disabled' - Will just keep selection and do nothing to selected Lists.<br>
- 'Alias Only' - Will create an alias with selected Lists to help custom rule assignments.<br><br>
- <strong>While creating rules with this list, keep aliasname in the beggining of rule description and do not end description with 'rule'.<br></strong>
- custom rules with 'Aliasname something rule' description will be removed by package.]]></description>
+ <strong>'Deny' Rules:</strong><br>
+ 'Deny' rules create high priority 'block' or 'reject' rules on the stated interfaces. They don't change the 'pass' rules on other interfaces. Typical uses of 'Deny' rules are:<br>
+ <ul><li><strong>Deny Both</strong> - blocks all traffic in both directions, if the source or destination IP is in the block list</li>
+ <li><strong>Deny Inbound/Deny Outbound</strong> - blocks all traffic in one direction <u>unless</u> it is part of a session started by traffic sent in the other direction. Does not affect traffic in the other direction. </li>
+ <li>One way 'Deny' rules can be used to selectively block <u>unsolicited</u> incoming (new session) packets in one direction, while still allowing <u>deliberate</u> outgoing sessions to be created in the other direction.</li></ul>
+ <strong>'Permit' Rules:</strong><br>
+ 'Permit' rules create high priority 'pass' rules on the stated interfaces. They are not the opposite of Deny rules, and don't create any 'blocking' effect anywhere. They have priority over all Deny rules. Typical uses of 'Permit' rules are:<br>
+ <ul><li><strong>To ensure</strong> that traffic to/from the listed IPs will <u>always</u> be allowed in the stated directions. They override <u>almost all other</u> Firewall rules on the stated interfaces.</li>
+ <li><strong>To act as a whitelist</strong> for Deny rule exceptions, for example if a large IP range or pre-created blocklist blocks a few IPs that should be accessible.</li></ul>
+ <strong>'Alias' and 'Disabled' Rules:</strong><br>
+ <ul><li><strong>'Alias'</strong> rules create an <a href="/firewall_aliases.php">alias</a> for the list (and do nothing else). This enables a Pfblocker list to be used by name, in any firewall rule or Pfsense function, as desired.</li>
+ <li><strong>'Disabled'</strong> rules are kept for future use, but nothing is done with them.</li></ul><br>
+ <strong>While creating rules with this list, keep aliasname in the beginning of rule description and do not end description with 'rule'.</strong> Custom rules with 'Aliasname something rule' description will be removed by package.]]></description>
<fieldname>action</fieldname>
<type>select</type>
<options>
@@ -193,6 +205,7 @@
<option><name>Deny Both</name><value>Deny_Both</value></option>
<option><name>Permit Inbound</name><value>Permit_Inbound</value></option>
<option><name>Permit Outbound</name><value>Permit_Outbound</value></option>
+ <option><name>Permit Both</name><value>Permit_Both</value></option>
<option><name>Alias only</name><value>Alias_only</value></option>
<option><name>Disabled</name><value>Disabled</value></option>
</options>
@@ -238,4 +251,5 @@
<custom_php_resync_config_command>
sync_package_pfblocker();
</custom_php_resync_config_command>
-</packagegui> \ No newline at end of file
+</packagegui>
+
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 6e55d577..342b1f2b 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -124,10 +124,8 @@ function unbound_rc_setup() {
<?php
require_once(\"/usr/local/pkg/unbound.inc\");
echo \"Starting and configuring Unbound...\";
- fetch_root_hints();
unbound_control(\"anchor_update\");
unbound_control(\"start\");
- unbound_control(\"forward\");
unbound_control(\"restore_cache\");
echo \"done.\\n\";
?>
@@ -164,37 +162,6 @@ function unbound_control($action) {
$cache_dumpfile = "/var/tmp/unbound_cache";
switch ($action) {
- case "forward":
- /* Dont utilize forward cmd if Unbound is doing DNS queries directly
- * XXX: We could make this an option to then make pfSense use Unbound
- * as the recursive nameserver instead of upstream ones(?)
- */
- if ($unbound_config['forwarding_mode'] == "on") {
- // Get configured DNS servers and add them as forwarders
- if (!isset($config['system']['dnsallowoverride'])) {
- $ns = array_unique(get_nameservers());
- foreach($ns as $nameserver) {
- if($nameserver)
- $dns_servers .= " $nameserver";
- }
- } else {
- $ns = array_unique(get_dns_servers());
- foreach($ns as $nameserver) {
- if($nameserver)
- $dns_servers .= " $nameserver";
- }
- }
-
- if(is_service_running("unbound")) {
- unbound_ctl_exec("forward $dns_servers");
- } else {
- unbound_control("start");
- sleep(1);
- unbound_control("forward");
- }
- }
- break;
-
case "start":
//Start unbound
if($unbound_config['enable'] == "on") {
@@ -206,7 +173,6 @@ function unbound_control($action) {
mwexec("/bin/ln -s /var/run/unbound.pid /var/run/dnsmasq.pid");
}
mwexec_bg("/usr/local/bin/unbound_monitor.sh");
- fetch_root_hints();
}
break;
@@ -456,7 +422,7 @@ function unbound_resync_config() {
}
// Private-address support for DNS Rebinding
- if($unbound_config['private_address'] == "on") {
+ if ($unbound_config['private_address'] == "on") {
$pvt_addr = <<<EOF
# For DNS Rebinding prevention
private-address: 10.0.0.0/8
@@ -475,26 +441,26 @@ EOF;
//Setup optimization
$optimization = unbound_optimization();
- $unbound_config = &$config['installedpackages']['unboundadvanced']['config'][0];
+ $adv_config = &$config['installedpackages']['unboundadvanced']['config'][0];
// Setup Advanced options
- $log_verbosity = (isset($unbound_config['unbound_verbosity'])) ? $unbound_config['unbound_verbosity'] : "1";
- $hide_id = ($unbound_config['hide_id'] == "on") ? "yes" : "no";
- $hide_version = ($unbound_config['hide_version'] == "on") ? "yes" : "no";
- $harden_glue = ($unbound_config['harden_glue'] == "on") ? "yes" : "no";
- $harden_dnssec_stripped = ($unbound_config['harden_dnssec_stripped'] == "on") ? "yes" : "no";
- $prefetch = ($unbound_config['prefetch'] == "on") ? "yes" : "no";
- $prefetch_key = ($unbound_config['prefetch_key'] == "on") ? "yes" : "no";
- $outgoing_num_tcp = (!empty($unbound_config['outgoing_num_tcp'])) ? $unbound_config['outgoing_num_tcp'] : "10";
- $incoming_num_tcp = (!empty($unbound_config['incoming_num_tcp'])) ? $unbound_config['incoming_num_tcp'] : "10";
- $edns_buffer_size = (!empty($unbound_config['edns_buffer_size'])) ? $unbound_config['edns_buffer_size'] : "4096";
- $num_queries_per_thread = (!empty($unbound_config['num_queries_per_thread'])) ? $unbound_config['num_queries_per_thread'] : "4096";
- $jostle_timeout = (!empty($unbound_config['jostle_timeout'])) ? $unbound_config['jostle_timeout'] : "200";
- $cache_max_ttl = (!empty($unbound_config['cache_max_ttl'])) ? $unbound_config['cache_max_ttl'] : "86400";
- $cache_min_ttl = (!empty($unbound_config['cache_min_ttl'])) ? $unbound_config['cache_min_ttl'] : "0";
- $infra_host_ttl = (!empty($unbound_config['infra_host_ttl'])) ? $unbound_config['infra_host_ttl'] : "900";
- $infra_lame_ttl = (!empty($unbound_config['infra_lame_ttl'])) ? $unbound_config['infra_lame_ttl'] : "900";
- $infra_cache_numhosts = (!empty($unbound_config['infra_cache_numhosts'])) ? $unbound_config['infra_cache_numhosts'] : "10000";
- $unwanted_reply_threshold = (!empty($unbound_config['unwanted_reply_threshold'])) ? $unbound_config['unwanted_reply_threshold'] : "0";
+ $log_verbosity = (isset($adv_config['unbound_verbosity'])) ? $adv_config['unbound_verbosity'] : "1";
+ $hide_id = ($adv_config['hide_id'] == "on") ? "yes" : "no";
+ $hide_version = ($adv_config['hide_version'] == "on") ? "yes" : "no";
+ $harden_glue = ($adv_config['harden_glue'] == "on") ? "yes" : "no";
+ $harden_dnssec_stripped = ($adv_config['harden_dnssec_stripped'] == "on") ? "yes" : "no";
+ $prefetch = ($adv_config['prefetch'] == "on") ? "yes" : "no";
+ $prefetch_key = ($adv_config['prefetch_key'] == "on") ? "yes" : "no";
+ $outgoing_num_tcp = isset($adv_config['outgoing_num_tcp']) ? $adv_config['outgoing_num_tcp'] : "10";
+ $incoming_num_tcp = isset($adv_config['incoming_num_tcp']) ? $adv_config['incoming_num_tcp'] : "10";
+ $edns_buffer_size = (!empty($adv_config['edns_buffer_size'])) ? $adv_config['edns_buffer_size'] : "4096";
+ $num_queries_per_thread = (!empty($adv_config['num_queries_per_thread'])) ? $adv_config['num_queries_per_thread'] : "4096";
+ $jostle_timeout = (!empty($adv_config['jostle_timeout'])) ? $adv_config['jostle_timeout'] : "200";
+ $cache_max_ttl = (!empty($adv_config['cache_max_ttl'])) ? $adv_config['cache_max_ttl'] : "86400";
+ $cache_min_ttl = (!empty($adv_config['cache_min_ttl'])) ? $adv_config['cache_min_ttl'] : "0";
+ $infra_host_ttl = (!empty($adv_config['infra_host_ttl'])) ? $adv_config['infra_host_ttl'] : "900";
+ $infra_lame_ttl = (!empty($adv_config['infra_lame_ttl'])) ? $adv_config['infra_lame_ttl'] : "900";
+ $infra_cache_numhosts = (!empty($adv_config['infra_cache_numhosts'])) ? $adv_config['infra_cache_numhosts'] : "10000";
+ $unwanted_reply_threshold = (!empty($adv_config['unwanted_reply_threshold'])) ? $adv_config['unwanted_reply_threshold'] : "0";
$unbound_conf = <<<EOD
@@ -510,7 +476,6 @@ chroot: ""
username: "unbound"
directory: "{$unbound_base}/etc/unbound"
pidfile: "{$g['varrun_path']}/unbound.pid"
-root-hints: "root.hints"
harden-referral-path: no
prefetch: {$prefetch}
prefetch-key: {$prefetch_key}
@@ -527,7 +492,8 @@ unwanted-reply-threshold: {$unwanted_reply_threshold}
num-queries-per-thread: {$num_queries_per_thread}
jostle-timeout: {$jostle_timeout}
infra-host-ttl: {$infra_host_ttl}
-infra-lame-ttl: {$infra_lame_ttl}
+prefetch: {$prefetch}
+prefetch-key: {$prefetch_key}
infra-cache-numhosts: {$infra_cache_numhosts}
outgoing-num-tcp: {$outgoing_num_tcp}
incoming-num-tcp: {$incoming_num_tcp}
@@ -538,6 +504,9 @@ statistics-cumulative: {$cumulative_stats}
cache-max-ttl: {$cache_max_ttl}
cache-min-ttl: {$cache_min_ttl}
harden-dnssec-stripped: {$harden_dnssec_stripped}
+hide-identity: {$hide_id}
+hide-version: {$hide_version}
+harden-glue: {$harden_glue}
{$optimization['number_threads']}
{$optimization['msg_cache_slabs']}
{$optimization['rrset_cache_slabs']}
@@ -549,6 +518,7 @@ outgoing-range: 8192
{$optimization['so_rcvbuf']}
{$optimization['so_sndbuf']}
+
# Interface IP(s) to bind to
{$unbound_bind_interfaces}
@@ -572,11 +542,38 @@ access-control: ::1 allow
EOD;
# Handle custom options
- if(!empty($unbound_config['custom_options'])) {
- $custom_options = explode(";", ($unbound_config['custom_options']));
- $unbound_conf .= "# Unbound Custom options\n";
- foreach ($custom_options as $ent) {
+ if (!empty($adv_config['custom_options'])) {
+ $custom_options = explode(";", ($adv_config['custom_options']));
+ $unbound_conf .= "\n# Unbound Custom options\n";
+ foreach ($custom_options as $ent)
$unbound_conf .= $ent."\n";
+ }
+
+ // Set up forward-zones if configured
+ if ($unbound_config['forwarding_mode'] == "on") {
+ $dnsservers = array();
+ if (isset($config['system']['dnsallowoverride'])) {
+ $ns = array_unique(get_nameservers());
+ foreach($ns as $nameserver) {
+ if ($nameserver)
+ $dnsservers[] = $nameserver;
+ }
+ } else {
+ $ns = array_unique(get_dns_servers());
+ foreach($ns as $nameserver) {
+ if ($nameserver)
+ $dnsservers[] = $nameserver;
+ }
+ }
+
+ if (!empty($dnsservers)) {
+ $unbound_conf .=<<<EOD
+forward-zone:
+ name: "."
+
+EOD;
+ foreach($dnsservers as $dnsserver)
+ $unbound_conf .= "\tforward-addr: $dnsserver\n";
}
}
@@ -622,7 +619,7 @@ function unbound_optimization() {
// Set the number of threads equal to number of CPUs.
// Use 1 (disable threading) if for some reason this sysctl fails.
$numprocs = intval(trim(`/sbin/sysctl kern.smp.cpus | /usr/bin/cut -d" " -f2`));
- if($numprocs > 1) {
+ if ($numprocs > 1) {
$optimization['number_threads'] = "num-threads: {$numprocs}";
$optimize_num = pow(2,floor(log($numprocs,2)));
} else {
@@ -669,32 +666,6 @@ function unbound_optimization() {
return $optimization;
}
-function fetch_root_hints() {
-
- $destination_file = UNBOUND_BASE . "/etc/unbound/root.hints";
- if (filesize($destination_file) == 0 ) {
- conf_mount_rw();
- $fout = fopen($destination_file, "w");
- $url = "ftp://ftp.internic.net/domain/named.cache";
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '25');
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- $data = curl_exec($ch);
- curl_close($ch);
-
- fwrite($fout, $data);
- fclose($fout);
- conf_mount_ro();
-
- return ($http_code == 200) ? true : $http_code;
- } else {
- return false;
- }
-}
-
function unbound_validate($post, $type=null) {
global $config, $input_errors;
@@ -728,8 +699,6 @@ function unbound_validate($post, $type=null) {
$input_errors[] = "You must enter a valid number in 'Minimum TTL for RRsets and messages'.";
if(!is_numeric($post['infra_host_ttl']))
$input_errors[] = "You must enter a valid number in 'TTL for Host cache entries'.";
- if(!is_numeric($post['infra_lame_ttl']))
- $input_errors[] = "You must enter a valid number in 'TTL for lame delegation'.";
if(!is_numeric($post['infra_cache_numhosts']))
$input_errors[] = "You must enter a valid number in 'Number of Hosts to cache'.";
@@ -746,19 +715,17 @@ function unbound_reconfigure() {
$unbound_config = $config['installedpackages']['unbound']['config'][0];
if ($unbound_config['enable'] != "on") {
- if(is_service_running("unbound"))
+ if (is_service_running("unbound"))
unbound_control("termstop");
} else {
- if(is_service_running("unbound")) {
+ if (is_service_running("unbound")) {
unbound_control("dump_cache");
unbound_control("termstop");
}
unbound_resync_config();
unbound_control("start");
- if(is_service_running("unbound")) {
- unbound_control("forward");
+ if (is_service_running("unbound"))
unbound_control("restore_cache");
- }
}
}
diff --git a/config/unbound/unbound_advanced.xml b/config/unbound/unbound_advanced.xml
index 2da5b505..f9914a22 100644
--- a/config/unbound/unbound_advanced.xml
+++ b/config/unbound/unbound_advanced.xml
@@ -262,16 +262,7 @@
<field>
<fielddescr>TTL for Host cache entries</fielddescr>
<fieldname>infra_host_ttl</fieldname>
- <description>Time to live for entries in the host cache. The host cache contains roundtrip timing and EDNS support information. The default is 900 seconds.</description>
- <type>input</type>
- <size>5</size>
- <default_value>900</default_value>
- <advancedfield/>
- </field>
- <field>
- <fielddescr>TTL for lame delegation</fielddescr>
- <fieldname>infra_lame_ttl</fieldname>
- <description>Time to live for when a delegation is considered to be lame. The default is 900 seconds.</description>
+ <description>Time to live for entries in the host cache. The host cache contains roundtrip timing, lameness and EDNS support information. The default is 900 seconds.</description>
<type>input</type>
<size>5</size>
<default_value>900</default_value>
diff --git a/config/varnish3/varnish.inc b/config/varnish3/varnish.inc
index 1895d214..2a986710 100644
--- a/config/varnish3/varnish.inc
+++ b/config/varnish3/varnish.inc
@@ -688,7 +688,7 @@ function varnish_sync_on_changes() {
break;
case "auto":
if (is_array($config['hasync'])){
- $hasync=$config['hasync'][0];
+ $hasync=$config['hasync'];
$rs[0]['ipaddress']=$hasync['synchronizetoip'];
$rs[0]['username']=$hasync['username'];
$rs[0]['password']=$hasync['password'];
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index 54a15aa6..9a684aa1 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -2,17 +2,12 @@
function vnstat_install_deinstall() {
conf_mount_rw();
global $config;
-// Remove Vnstat package and files
- exec("cd /var/db/pkg/ && pkg_delete `ls | grep vnstat`");
+// Remove Vnstat package and files
exec("rm -d -R /usr/local/www/vnstat2");
exec("rm -d -R /usr/local/www/vnstati");
- exec("rm /usr/local/pkg/vnstat_php_frontend.xml");
- exec("rm /usr/local/pkg/vnstat2.sh");
- exec("rm /usr/local/etc/vnstat2.conf");
- exec("rm /usr/local/www/diag_vnstat.php");
- exec("rm /usr/local/www/diag_vnstat2.php");
- exec("rm /usr/local/www/vnstati.php");
- exec("rm /usr/local/www/vnstat2_img.php");
+ exec("rm -d -R /usr/local/pkg/vnstat2");
+ exec("rm /usr/local/etc/vnstat.conf");
+
// Remove vnstat cron entry from config.xml
vnstat2_install_cron(false);
conf_mount_ro();
@@ -25,7 +20,7 @@ function vnstat2_install_cron($vnstat_cron_value) {
return;
$x=0;
foreach($config['cron']['item'] as $item) {
- if(strstr($item['command'], "/usr/local/pkg/vnstat2.sh")) {
+ if(strstr($item['command'], "/usr/local/pkg/vnstat2/vnstat2.sh")) {
$is_installed = true;
break;
}
@@ -41,7 +36,7 @@ function vnstat2_install_cron($vnstat_cron_value) {
$cron_item['month'] = "*";
$cron_item['wday'] = "*";
$cron_item['who'] = "root";
- $cron_item['command'] = "/usr/local/pkg/vnstat2.sh";
+ $cron_item['command'] = "/usr/local/pkg/vnstat2/vnstat2.sh";
$config['cron']['item'][] = $cron_item;
write_config();
configure_cron();
@@ -70,10 +65,10 @@ function change_vnstat_conf(){
$no_vnstat_phpfrontend = $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'];
if ($no_vnstat_phpfrontend == "on"){
vnstat_php_frontend();
- }
+ }
else {
exec("[ -d /usr/local/www/vnstat2 ] && rm -d -R /usr/local/www/vnstat2");
-}
+ }
conf_mount_ro();
}
@@ -149,16 +144,11 @@ function vnstat_install_config() {
conf_mount_rw();
// Create vnstat database dir where it also will work for nanobsd
// exec("[ -d /var/db/vnstat ] && mv /var/db/vnstat /conf/vnstat");
- exec("[ -d /usr/local/pkg/vnstat ] && mv /usr/local/pkg/vnstat /conf/vnstat");
+ exec("[ -d /usr/local/pkg/vnstat2/vnstat ] && mv /usr/local/pkg/vnstat2/vnstat /conf/vnstat");
exec("[ ! -d /conf/vnstat ] && mkdir /conf/vnstat");
// Check for pbi install and arch type then create symlinks
if (file_exists('/usr/pbi/vnstat-i386')) { exec("ln -s /usr/local/etc/vnstat.conf /usr/pbi/vnstat-i386/etc/vnstat.conf"); }
if (file_exists('/usr/pbi/vnstat-amd64')) { exec("ln -s /usr/local/etc/vnstat.conf /usr/pbi/vnstat-amd64/etc/vnstat.conf"); }
-// Copy files to web dir
- exec("[ ! -f /usr/local/www/diag_vnstat2.php ] && cp /usr/local/pkg/diag_vnstat2.abc /usr/local/www/diag_vnstat2.php");
- exec("[ ! -f /usr/local/www/diag_vnstat.php ] && cp /usr/local/pkg/diag_vnstat.abc /usr/local/www/diag_vnstat.php");
- exec("[ ! -f /usr/local/www/vnstati.php ] && cp /usr/local/pkg/vnstati.abc /usr/local/www/vnstati.php");
- exec("[ ! -f /usr/local/www/vnstat2_img.php ] && cp /usr/local/pkg/vnstat2_img.abc /usr/local/www/vnstat2_img.php");
// Add MonthRotate value to config.xml and write /usr/local/etc/vnstat.conf
$no_monthrotate = $config['installedpackages']['vnstat2']['config'][0]['monthrotate'];
if ($no_monthrotate == ""){
@@ -197,10 +187,8 @@ function vnstat_install_config() {
function vnstat_php_frontend(){
global $config;
-// Unpack and move Vnstat frontend
- exec("cd ..");
- exec("tar -zxovf /usr/local/pkg/vnstat_php_frontend-1.5.1-updated.tar.gz");
- exec("mv vnstat_php_frontend-1.5.1-updated /usr/local/www/vnstat2");
+// Copy vnstat_php_frontend to www
+ exec("cp -a /usr/local/pkg/vnstat2/vnstat_php_frontend/. /usr/local/www/vnstat2/");
// Find information to be writing in config.php
// $iface_list_array_items
exec("ls /conf/vnstat/ | grep -v '\.'", $vnstat_nic_in);
@@ -228,8 +216,8 @@ function vnstat_php_frontend(){
$iface_title_array = implode($iface_title_array_items2);
// php in php static items
// added to new items for the front end version 1.5.1
- $locale = "\$locale = 'en_US.UTF-8';";
- $language = "\$language = 'en';";
+ $locale = "\$locale = 'en_US.UTF-8';";
+ $language = "\$language = 'en';";
$vnstat_bin2 = "\$vnstat_bin = '/usr/local/bin/vnstat';";
$data_dir2 = "\$data_dir = './dumps';";
$graph_format2 ="\$graph_format='svg';";
diff --git a/config/vnstat2/vnstat2.sh b/config/vnstat2/vnstat2.sh
index 05fb1136..54f30843 100644
--- a/config/vnstat2/vnstat2.sh
+++ b/config/vnstat2/vnstat2.sh
@@ -1,5 +1,6 @@
#!/bin/sh
+
/etc/rc.conf_mount_rw
/usr/local/bin/vnstat -u
sleep 0.2
diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml
index 6d8ba41a..9bca9726 100644
--- a/config/vnstat2/vnstat2.xml
+++ b/config/vnstat2/vnstat2.xml
@@ -10,9 +10,9 @@
<version>1.0</version>
<title>Vnstat2</title>
<aftersaveredirect>/pkg_edit.php?xml=vnstat2.xml&amp;id=0</aftersaveredirect>
- <include_file>/usr/local/pkg/vnstat2.inc</include_file>
+ <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file>
<menu>
- <name>vnstat2</name>
+ <name>Vnstat2</name>
<tooltiptext></tooltiptext>
<section>Status</section>
<url>/pkg_edit.php?xml=vnstat2.xml&amp;id=0</url>
@@ -41,49 +41,159 @@
</tab>
</tabs>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/pkg/vnstat2/</prefix>
<chmod>0644</chmod>
<item>http://www.pfsense.com/packages/config/vnstat2/vnstat2.inc</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://files.pfsense.org/packages/8/vnstat/vnstat_php_frontend-1.5.1-updated.tar.gz</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstati.xml</item>
</additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstati.xml</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstatoutput.xml</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/pkg/vnstat2/</prefix>
<chmod>0744</chmod>
<item>http://www.pfsense.com/packages/config/vnstat2/vnstat2.sh</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/www/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/vnstatoutput.xml</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/www/diag_vnstat.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/www/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat.abc</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/www/diag_vnstat2.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/www/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat2.abc</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/www/vnstat2_img.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/www/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/vnstat2_img.abc</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/www/vnstati.php</item>
</additional_files_needed>
<additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/lang/cs.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/lang/en.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/lang/nl.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/dark/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/dark/style.css</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/dark/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/espresso/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/espresso/style.css</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/espresso/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/light/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/light/style.css</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/light/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/light/theme.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/pfSense/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/pfSense/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/red/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/red/style.css</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/red/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/themes/red/theme.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/config.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/COPYING</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/graph.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/graph_svg.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/index.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/localize.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/README</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/vera_copyright.txt</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/VeraBd.ttf</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix>
<chmod>0644</chmod>
- <item>http://www.pfsense.com/packages/config/vnstat2/bin/vnstati.abc</item>
+ <item>http://www.pfsense.com/packages/config/vnstat2/vnstat_php_frontend/vnstat.php</item>
</additional_files_needed>
<fields>
<field>
@@ -136,3 +246,4 @@
<custom_php_install_command>vnstat_install_config();</custom_php_install_command>
<custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command>
</packagegui>
+
diff --git a/config/vnstat2/vnstat_php_frontend/COPYING b/config/vnstat2/vnstat_php_frontend/COPYING
new file mode 100644
index 00000000..a17bdaff
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/COPYING
@@ -0,0 +1,341 @@
+GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
diff --git a/config/vnstat2/vnstat_php_frontend/README b/config/vnstat2/vnstat_php_frontend/README
new file mode 100644
index 00000000..20053152
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/README
@@ -0,0 +1,52 @@
+0. WHAT IS IT?
+
+This is a PHP frontend end to vnstat, a network traffic logger.
+Since vnstat is console mode only I created this script to
+make a 'nice' report of the data collected by vnstat.
+For more information about vnstat check out http://humdi.net/vnstat/
+For updates to this script check http://www.sqweek.com
+
+
+1. REQUIREMENTS
+
+- vnstat setup and collecting data
+- webserver with PHP
+- php-gd extension installed for PNG graphs
+
+
+2. INSTALL
+
+Installation should be really straightforward:
+
+Put the files from this package somewhere inside the webroot of
+your webserver. Then edit the few configuration options in config.php
+to suit your situation and your good to go. The various options are
+explained in config.php.
+
+
+3. LICENSE
+
+vnstat PHP frontend 1.5.1
+Copyright (c)2006-2008 Bjorge Dijkstra (bjd@jooz.net)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+NOTE:
+ The Truetype font file VeraBd.ttf is copyright by Bitstream Inc.
+ See vera_copyright.txt for more information.
+
+
+
diff --git a/config/vnstat2/vnstat_php_frontend/VeraBd.ttf b/config/vnstat2/vnstat_php_frontend/VeraBd.ttf
new file mode 100644
index 00000000..51d6111d
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/VeraBd.ttf
Binary files differ
diff --git a/config/vnstat2/vnstat_php_frontend/config.php b/config/vnstat2/vnstat_php_frontend/config.php
new file mode 100644
index 00000000..3a4cd51a
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/config.php
@@ -0,0 +1,69 @@
+<?php
+ //
+ // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
+ //
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation; either version 2 of the License, or
+ // (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License
+ // along with this program; if not, write to the Free Software
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ //
+ //
+ // see file COPYING or at http://www.gnu.org/licenses/gpl.html
+ // for more information.
+ //
+ error_reporting(E_ALL | E_NOTICE);
+
+ //
+ // configuration parameters
+ //
+ // edit these to reflect your particular situation
+ //
+ $locale = 'en_US.UTF-8';
+ $language = 'en';
+
+ // list of network interfaces monitored by vnStat
+ $iface_list = array('em0', 'em1');
+
+ //
+ // optional names for interfaces
+ // if there's no name set for an interface then the interface identifier
+ // will be displayed instead
+ $iface_title['em0'] = 'WAN';
+ $iface_title['em1'] = 'LAN';
+
+ //
+ // There are two possible sources for vnstat data. If the $vnstat_bin
+ // variable is set then vnstat is called directly from the PHP script
+ // to get the interface data.
+ //
+ // The other option is to periodically dump the vnstat interface data to
+ // a file (e.g. by a cronjob). In that case the $vnstat_bin variable
+ // must be cleared and set $data_dir to the location where the dumps
+ // are stored. Dumps must be named 'vnstat_dump_$iface'.
+ //
+ // You can generate vnstat dumps with the command:
+ // vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface
+ //
+ $vnstat_bin = '/usr/local/bin/vnstat';
+ $data_dir = './dumps';
+
+ // graphics format to use: svg or png
+ $graph_format='svg';
+
+ // Font to use for PNG graphs
+ define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');
+
+ // Font to use for SVG graphs
+ define('SVG_FONT', 'Verdana');
+
+ define('DEFAULT_COLORSCHEME', 'pfSense');
+?> \ No newline at end of file
diff --git a/config/vnstat2/vnstat_php_frontend/graph.php b/config/vnstat2/vnstat_php_frontend/graph.php
new file mode 100644
index 00000000..fb00be67
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/graph.php
@@ -0,0 +1,303 @@
+<?php
+ //
+ // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
+ //
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation; either version 2 of the License, or
+ // (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License
+ // along with this program; if not, write to the Free Software
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ //
+ //
+ // see file COPYING or at http://www.gnu.org/licenses/gpl.html
+ // for more information.
+ //
+ require 'config.php';
+ require 'localize.php';
+ require 'vnstat.php';
+
+ validate_input();
+
+ require "./themes/$style/theme.php";
+
+ function allocate_color($im, $colors)
+ {
+ return imagecolorallocatealpha($im, $colors[0], $colors[1], $colors[2], $colors[3]);
+ }
+
+ function init_image()
+ {
+ global $im, $xlm, $xrm, $ytm, $ybm, $iw, $ih,$graph, $cl, $iface, $colorscheme, $style;
+
+ if ($graph == 'none')
+ return;
+
+ //
+ // image object
+ //
+ $xlm = 70;
+ $xrm = 20;
+ $ytm = 35;
+ $ybm = 60;
+ if ($graph == 'small')
+ {
+ $iw = 300 + $xrm + $xlm;
+ $ih = 100 + $ytm + $ybm;
+ }
+ else
+ {
+ $iw = 600 + $xrm + $xlm;
+ $ih = 200 + $ytm + $ybm;
+ }
+
+ $im = imagecreatetruecolor($iw,$ih);
+
+ //
+ // colors
+ //
+ $cs = $colorscheme;
+ $cl['image_background'] = allocate_color($im, $cs['image_background']);
+ $cl['background'] = allocate_color($im, $cs['graph_background']);
+ $cl['background_2'] = allocate_color($im, $cs['graph_background_2']);
+ $cl['grid_stipple_1'] = allocate_color($im, $cs['grid_stipple_1']);
+ $cl['grid_stipple_2'] = allocate_color($im, $cs['grid_stipple_2']);
+ $cl['text'] = allocate_color($im, $cs['text']);
+ $cl['border'] = allocate_color($im, $cs['border']);
+ $cl['rx'] = allocate_color($im, $cs['rx']);
+ $cl['rx_border'] = allocate_color($im, $cs['rx_border']);
+ $cl['tx'] = allocate_color($im, $cs['tx']);
+ $cl['tx_border'] = allocate_color($im, $cs['tx_border']);
+
+ imagefilledrectangle($im,0,0,$iw,$ih,$cl['image_background']);
+ imagefilledrectangle($im,$xlm,$ytm,$iw-$xrm,$ih-$ybm, $cl['background']);
+
+ $x_step = ($iw - $xlm - $xrm) / 12;
+ $depth = ($x_step / 8) + 4;
+ imagefilledpolygon($im, array($xlm, $ytm, $xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $xlm - $depth, $ytm + $depth), 4, $cl['background_2']);
+ imagefilledpolygon($im, array($xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $iw - $xrm - $depth, $ih - $ybm + $depth, $iw - $xrm, $ih - $ybm), 4, $cl['background_2']);
+
+ // draw title
+ $text = T('Traffic data for')." $iface";
+ $bbox = imagettfbbox(10, 0, GRAPH_FONT, $text);
+ $textwidth = $bbox[2] - $bbox[0];
+ imagettftext($im, 10, 0, ($iw-$textwidth)/2, ($ytm/2), $cl['text'], GRAPH_FONT, $text);
+
+ }
+
+ function draw_border()
+ {
+ global $im,$cl,$iw,$ih;
+
+ imageline($im, 0, 0,$iw-1, 0, $cl['border']);
+ imageline($im, 0,$ih-1,$iw-1,$ih-1, $cl['border']);
+ imageline($im, 0, 0, 0,$ih-1, $cl['border']);
+ imageline($im, $iw-1, 0,$iw-1,$ih-1, $cl['border']);
+ }
+
+ function draw_grid($x_ticks, $y_ticks)
+ {
+ global $im, $cl, $iw, $ih, $xlm, $xrm, $ytm, $ybm;
+ $x_step = ($iw - $xlm - $xrm) / $x_ticks;
+ $y_step = ($ih - $ytm - $ybm) / $y_ticks;
+
+ $depth = 10;//($x_step / 8) + 4;
+
+ $ls = array($cl['grid_stipple_1'],$cl['grid_stipple_2']);
+ imagesetstyle($im, $ls);
+ for ($i=$xlm;$i<=($iw-$xrm); $i += $x_step)
+ {
+ imageline($im, $i, $ytm, $i, $ih - $ybm, IMG_COLOR_STYLED);
+ imageline($im, $i, $ih - $ybm, $i - $depth, $ih - $ybm + $depth, IMG_COLOR_STYLED);
+ }
+ for ($i=$ytm;$i<=($ih-$ybm); $i += $y_step)
+ {
+ imageline($im, $xlm, $i, $iw - $xrm, $i, IMG_COLOR_STYLED);
+ imageline($im, $xlm, $i, $xlm - $depth, $i + $depth, IMG_COLOR_STYLED);
+ }
+ imageline($im, $xlm, $ytm, $xlm, $ih - $ybm, $cl['border']);
+ imageline($im, $xlm, $ih - $ybm, $iw - $xrm, $ih - $ybm, $cl['border']);
+ }
+
+
+ function draw_data($data)
+ {
+ global $im,$cl,$iw,$ih,$xlm,$xrm,$ytm,$ybm;
+
+ sort($data);
+
+ $x_ticks = count($data);
+ $y_ticks = 10;
+ $y_scale = 1;
+ $prescale = 1;
+ $unit = 'K';
+ $offset = 0;
+ $gr_h = $ih - $ytm - $ybm;
+ $x_step = ($iw - $xlm - $xrm) / $x_ticks;
+ $y_step = ($ih - $ytm - $ybm) / $y_ticks;
+ $bar_w = ($x_step / 2) ;
+
+ //
+ // determine scale
+ //
+ $low = 99999999999;
+ $high = 0;
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ if ($data[$i]['rx'] < $low)
+ $low = $data[$i]['rx'];
+ if ($data[$i]['tx'] < $low)
+ $low = $data[$i]['tx'];
+ if ($data[$i]['rx'] > $high)
+ $high = $data[$i]['rx'];
+ if ($data[$i]['tx'] > $high)
+ $high = $data[$i]['tx'];
+ }
+
+ while ($high > ($prescale * $y_scale * $y_ticks))
+ {
+ $y_scale = $y_scale * 2;
+ if ($y_scale >= 1024)
+ {
+ $prescale = $prescale * 1024;
+ $y_scale = $y_scale / 1024;
+ if ($unit == 'K')
+ $unit = 'M';
+ else if ($unit == 'M')
+ $unit = 'G';
+ else if ($unit == 'G')
+ $unit = 'T';
+ }
+ }
+
+ draw_grid($x_ticks, $y_ticks);
+
+ //
+ // graph scale factor (per pixel)
+ //
+ imagesetthickness($im, 1);
+ $sf = ($prescale * $y_scale * $y_ticks) / $gr_h;
+
+ if ($data[0] == 'nodata')
+ {
+ $text = 'no data available';
+ $bbox = imagettfbbox(10, 0, GRAPH_FONT, $text);
+ $textwidth = $bbox[2] - $bbox[0];
+ imagettftext($im, 10, 0, ($iw-$textwidth)/2, $ytm + 80, $cl['text'], GRAPH_FONT, $text);
+ }
+ else
+ {
+ //
+ // draw bars
+ //
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ $x = $xlm + ($i * $x_step);
+ $y = $ytm + ($ih - $ytm - $ybm) - (($data[$i]['rx'] - $offset) / $sf);
+
+ $depth = $x_step / 8;
+ $space = 0;
+
+ $x1 = $x;
+ $y1 = $y;
+ $x2 = $x + $bar_w - $space;
+ $y2 = $ih - $ybm;
+
+ imagefilledrectangle($im, $x1, $y1, $x2, $y2, $cl['rx']);
+ imagerectangle($im, $x1, $y1, $x2, $y2, $cl['rx_border']);
+
+ imagefilledrectangle($im, $x1 - $depth, $y1 + $depth, $x2 -$depth, $y2 + $depth, $cl['rx']);
+ imagerectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['rx_border']);
+
+ imagefilledpolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['rx']);
+ imagepolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['rx_border']);
+ imagefilledpolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['rx']);
+ imagepolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['rx_border']);
+
+ $y1 = $ytm + ($ih - $ytm - $ybm) - (($data[$i]['tx'] - $offset) / $sf);
+ $x1 = $x1 + $bar_w;
+ $x2 = $x2 + $bar_w;
+
+ imagefilledrectangle($im, $x1, $y1, $x2, $y2, $cl['tx']);
+ imagerectangle($im, $x1, $y1, $x2, $y2, $cl['tx_border']);
+
+ imagefilledrectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['tx']);
+ imagerectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['tx_border']);
+
+ imagefilledpolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['tx']);
+ imagepolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['tx_border']);
+ imagefilledpolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['tx']);
+ imagepolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['tx_border']);
+ }
+
+ //
+ // axis labels
+ //
+ for ($i=0; $i<=$y_ticks; $i++)
+ {
+ $label = ($i * $y_scale).$unit;
+ $bbox = imagettfbbox(8, 0, GRAPH_FONT, $label);
+ $textwidth = $bbox[2] - $bbox[0];
+ imagettftext($im, 8, 0, $xlm - $textwidth - 16, ($ih - $ybm) - ($i * $y_step) + 8 + $depth, $cl['text'], GRAPH_FONT, $label);
+ }
+
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ $label = $data[$i]['img_label'];
+ $bbox = imagettfbbox(9, 0, GRAPH_FONT, $label);
+ $textwidth = $bbox[2] - $bbox[0];
+ imagettftext($im, 9, 0, $xlm + ($i * $x_step) + ($x_step / 2) - ($textwidth / 2) - $depth - 4, $ih - $ybm + 20 + $depth, $cl['text'], GRAPH_FONT, $label);
+ }
+ }
+
+ draw_border();
+
+
+ //
+ // legend
+ //
+ imagefilledrectangle($im, $xlm, $ih-$ybm+39, $xlm+8,$ih-$ybm+47,$cl['rx']);
+ imagerectangle($im, $xlm, $ih-$ybm+39, $xlm+8,$ih-$ybm+47,$cl['text']);
+ imagettftext($im, 8,0, $xlm+14, $ih-$ybm+48,$cl['text'], GRAPH_FONT,'bytes in');
+
+ imagefilledrectangle($im, $xlm+120 , $ih-$ybm+39, $xlm+128,$ih-$ybm+47,$cl['tx']);
+ imagerectangle($im, $xlm+120, $ih-$ybm+39, $xlm+128,$ih-$ybm+47,$cl['text']);
+ imagettftext($im, 8,0, $xlm+134, $ih-$ybm+48,$cl['text'], GRAPH_FONT,'bytes out');
+ }
+
+ function output_image()
+ {
+ global $page,$hour,$day,$month,$im,$iface;
+
+ if ($page == 'summary')
+ return;
+
+ init_image();
+
+ if ($page == 'h')
+ {
+ draw_data($hour);
+ }
+ else if ($page == 'd')
+ {
+ draw_data($day);
+ }
+ else if ($page == 'm')
+ {
+ draw_data($month);
+ }
+
+ header('Content-type: image/png');
+ imagepng($im);
+ }
+
+ get_vnstat_data();
+ output_image();
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/graph_svg.php b/config/vnstat2/vnstat_php_frontend/graph_svg.php
new file mode 100644
index 00000000..8992ed12
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/graph_svg.php
@@ -0,0 +1,362 @@
+<?php
+ //
+ // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
+ //
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation; either version 2 of the License, or
+ // (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License
+ // along with this program; if not, write to the Free Software
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ //
+ //
+ // see file COPYING or at http://www.gnu.org/licenses/gpl.html
+ // for more information.
+ //
+ require 'config.php';
+ require 'localize.php';
+ require 'vnstat.php';
+
+ validate_input();
+
+ require "./themes/$style/theme.php";
+
+ function svg_create($width, $height)
+ {
+ header('Content-type: image/svg+xml');
+ print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
+ print "<svg width=\"$width\" height=\"$height\" version=\"1.2\" baseProfile=\"tiny\" xmlns=\"http://www.w3.org/2000/svg\">\n";
+ print "<g style=\"shape-rendering: crispEdges\">\n";
+ }
+
+ function svg_end()
+ {
+ print "</g>\n";
+ print "</svg>\n";
+ }
+
+ function svg_options($options)
+ {
+ foreach ($options as $key => $value) {
+ print "$key=\"$value\" ";
+ }
+ }
+
+ function svg_group($options)
+ {
+ print "<g ";
+ svg_options($options);
+ print ">\n";
+ }
+
+ function svg_group_end()
+ {
+ print "</g>\n";
+ }
+
+ function svg_text($x, $y, $text, $options = array())
+ {
+ printf("<text x=\"%F\" y=\"%F\" ", $x, $y);
+ svg_options($options);
+ print ">$text</text>\n";
+ }
+
+ function svg_line($x1, $y1, $x2, $y2, $options = array())
+ {
+ printf("<line x1=\"%F\" y1=\"%F\" x2=\"%F\" y2=\"%F\" ", $x1, $y1, $x2, $y2);
+ svg_options($options);
+ print "/>\n";
+ }
+
+ function svg_rect($x, $y, $w, $h, $options = array())
+ {
+ printf("<rect x=\"%F\" y=\"%F\" width=\"%F\" height=\"%F\" ", $x, $y, $w, $h);
+ svg_options($options);
+ print "/>\n";
+ }
+
+ function svg_poly($points, $options = array())
+ {
+ print "<polygon points=\"";
+ for ($p = 0; $p < count($points); $p += 2) {
+ printf("%F,%F ", $points[$p], $points[$p+1]);
+ }
+ svg_options($options);
+ print "\"/>\n";
+ }
+
+ function allocate_color($colors)
+ {
+ $col['rgb'] = sprintf("#%02X%02X%02X", $colors[0], $colors[1], $colors[2]);
+ $col['opacity'] = sprintf("%F", (127 - $colors[3]) / 127);
+ return $col;
+ }
+
+ function init_image()
+ {
+ global $xlm, $xrm, $ytm, $ybm, $iw, $ih,$graph, $cl, $iface, $colorscheme, $style;
+
+ if ($graph == 'none')
+ return;
+
+ //
+ // image object
+ //
+ $xlm = 70;
+ $xrm = 20;
+ $ytm = 35;
+ $ybm = 60;
+ if ($graph == 'small')
+ {
+ $iw = 300 + $xrm + $xlm;
+ $ih = 100 + $ytm + $ybm;
+ }
+ else
+ {
+ $iw = 600 + $xrm + $xlm;
+ $ih = 200 + $ytm + $ybm;
+ }
+
+ svg_create($iw, $ih);
+
+ //
+ // colors
+ //
+ $cs = $colorscheme;
+ $cl['image_background'] = allocate_color($cs['image_background']);
+ $cl['background'] = allocate_color($cs['graph_background']);
+ $cl['background_2'] = allocate_color($cs['graph_background_2']);
+ $cl['grid_stipple_1'] = allocate_color($cs['grid_stipple_1']);
+ $cl['grid_stipple_2'] = allocate_color($cs['grid_stipple_2']);
+ $cl['text'] = allocate_color($cs['text']);
+ $cl['border'] = allocate_color($cs['border']);
+ $cl['rx'] = allocate_color($cs['rx']);
+ $cl['rx_border'] = allocate_color($cs['rx_border']);
+ $cl['tx'] = allocate_color($cs['tx']);
+ $cl['tx_border'] = allocate_color($cs['tx_border']);
+
+ svg_rect(0, 0, $iw, $ih, array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['image_background']['rgb']) );
+ svg_rect($xlm, $ytm, $iw-$xrm-$xlm, $ih-$ybm-$ytm, array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['background']['rgb']) );
+
+ $depth = 12;
+ svg_group( array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['background_2']['rgb'], 'fill-opacity' => $cl['background_2']['opacity']) );
+ svg_poly(array($xlm, $ytm, $xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $xlm - $depth, $ytm + $depth));
+ svg_poly(array($xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $iw - $xrm - $depth, $ih - $ybm + $depth, $iw - $xrm, $ih - $ybm));
+ svg_group_end();
+
+ // draw title
+ $text = T('Traffic data for')." $iface";
+ svg_text($iw / 2, ($ytm / 2), $text, array( 'stroke' => $cl['text'], 'fill' => $cl['text']['rgb'],'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-weight' => 'bold', 'text-anchor' => 'middle' ));
+ }
+
+ function draw_border()
+ {
+ global $cl, $iw, $ih;
+ svg_rect(1, 1, $iw-2, $ih-2, array( 'stroke' => $cl['border']['rgb'], 'stroke-opacity' => $cl['border']['opacity'], 'stroke-width' => 1, 'fill' => 'none') );
+ }
+
+ function draw_grid($x_ticks, $y_ticks)
+ {
+ global $cl, $iw, $ih, $xlm, $xrm, $ytm, $ybm;
+ $x_step = ($iw - $xlm - $xrm) / $x_ticks;
+ $y_step = ($ih - $ytm - $ybm) / $y_ticks;
+
+ $depth = 12;
+
+ svg_group( array( 'stroke' => $cl['grid_stipple_1']['rgb'], 'stroke-opacity' => $cl['grid_stipple_1']['opacity'], 'stroke-width' => '1px', 'stroke-dasharray' => '1,1' ) );
+ for ($i = $xlm; $i <= ($iw - $xrm); $i += $x_step)
+ {
+ svg_line($i, $ytm, $i, $ih-$ybm);
+ svg_line($i, $ih-$ybm, $i-$depth, $ih-$ybm+$depth);
+ }
+ for ($i = $ytm; $i <= ($ih - $ybm); $i += $y_step)
+ {
+ svg_line($xlm, $i, $iw - $xrm, $i);
+ svg_line($xlm, $i, $xlm - $depth, $i + $depth);
+ }
+ svg_group_end();
+
+ svg_group( array( 'stroke' => $cl['border']['rgb'], 'stroke-width' => '1px', 'stroke-opacity' => $cl['border']['opacity'] ) );
+ svg_line($xlm, $ytm, $xlm, $ih - $ybm);
+ svg_line($xlm, $ih - $ybm, $iw - $xrm, $ih - $ybm);
+ svg_group_end();
+ }
+
+
+ function draw_data($data)
+ {
+ global $cl,$iw,$ih,$xlm,$xrm,$ytm,$ybm;
+
+ sort($data);
+
+ $x_ticks = count($data);
+ $y_ticks = 10;
+ $y_scale = 1;
+ $prescale = 1;
+ $unit = 'K';
+ $offset = 0;
+ $gr_h = $ih - $ytm - $ybm;
+ $x_step = ($iw - $xlm - $xrm) / $x_ticks;
+ $y_step = ($ih - $ytm - $ybm) / $y_ticks;
+ $bar_w = ($x_step / 2) ;
+
+ //
+ // determine scale
+ //
+ $low = 99999999999;
+ $high = 0;
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ if ($data[$i]['rx'] < $low)
+ $low = $data[$i]['rx'];
+ if ($data[$i]['tx'] < $low)
+ $low = $data[$i]['tx'];
+ if ($data[$i]['rx'] > $high)
+ $high = $data[$i]['rx'];
+ if ($data[$i]['tx'] > $high)
+ $high = $data[$i]['tx'];
+ }
+
+ while ($high > ($prescale * $y_scale * $y_ticks))
+ {
+ $y_scale = $y_scale * 2;
+ if ($y_scale >= 1024)
+ {
+ $prescale = $prescale * 1024;
+ $y_scale = $y_scale / 1024;
+ if ($unit == 'K')
+ $unit = 'M';
+ else if ($unit == 'M')
+ $unit = 'G';
+ else if ($unit == 'G')
+ $unit = 'T';
+ }
+ }
+
+ draw_grid($x_ticks, $y_ticks);
+
+ //
+ // graph scale factor (per pixel)
+ //
+ $sf = ($prescale * $y_scale * $y_ticks) / $gr_h;
+
+ if ($data[0] == 'nodata')
+ {
+ $text = 'no data available';
+ svg_text($iw/2, $ytm + 80, $text, array( 'stroke' => $cl['text']['rgb'], 'fill' => $cl['text']['rgb'], 'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-size' => '16pt', 'text-anchor' => 'middle') );
+ }
+ else
+ {
+ //
+ // draw bars
+ //
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ $x = $xlm + ($i * $x_step);
+ $y = $ytm + ($ih - $ytm - $ybm) - (($data[$i]['rx'] - $offset) / $sf);
+
+ $depth = ($x_ticks < 20) ? 8 : 6;
+ $space = 0;
+
+ $x1 = (int)$x;
+ $y1 = (int)$y;
+ $w = (int)($bar_w - $space);
+ $h = (int)($ih - $ybm - $y);
+ $x2 = (int)($x + $bar_w - $space);
+ $y2 = (int)($ih - $ybm);
+
+ svg_group( array( 'stroke' => $cl['rx_border']['rgb'], 'stroke-opacity' => $cl['rx_border']['opacity'],
+ 'stroke-width' => 1, 'stroke-linejoin' => 'round',
+ 'fill' => $cl['rx']['rgb'], 'fill-opacity' => $cl['rx']['opacity'] ) );
+ svg_rect($x1, $y1, $w, $h);
+ svg_rect($x1 - $depth, $y1 + $depth, $w, $h);
+ svg_poly(array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth));
+ svg_poly(array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth));
+ svg_group_end();
+
+ $y1 = (int)($ytm + ($ih - $ytm - $ybm) - (($data[$i]['tx'] - $offset) / $sf));
+ $x1 = (int)($x1 + $bar_w);
+ $x2 = (int)($x2 + $bar_w);
+ $w = (int)($bar_w - $space);
+ $h = (int)($ih - $ybm - $y1 - 1);
+
+ svg_group( array( 'stroke' => $cl['tx_border']['rgb'], 'stroke-opacity' => $cl['tx_border']['opacity'],
+ 'stroke-width' => 1, 'stroke-linejoin' => 'round',
+ 'fill' => $cl['tx']['rgb'], 'fill-opacity' => $cl['tx']['opacity'] ) );
+ svg_rect($x1, $y1, $w, $h);
+ svg_rect($x1 - $depth, $y1 + $depth, $w, $h);
+ svg_poly(array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth));
+ svg_poly(array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth));
+ svg_group_end();
+ }
+
+ //
+ // axis labels
+ //
+ svg_group( array( 'fill' => $cl['text']['rgb'], 'fill-opacity' => $cl['text']['opacity'], 'stroke-width' => '0', 'font-family' => SVG_FONT, 'font-size' => '10pt', 'text-anchor' => 'end' ) );
+ for ($i=0; $i<=$y_ticks; $i++)
+ {
+ $label = ($i * $y_scale).$unit;
+ $tx = $xlm - 16;
+ $ty = (int)(($ih - $ybm) - ($i * $y_step) + 8 + $depth);
+ svg_text($tx, $ty, $label);
+ }
+ svg_group_end();
+
+ svg_group( array( 'fill' => $cl['text']['rgb'], 'fill-opacity' => $cl['text']['opacity'], 'stroke-width' => '0', 'font-family' => SVG_FONT, 'font-size' => '10pt', 'text-anchor' => 'middle' ) );
+ for ($i=0; $i<$x_ticks; $i++)
+ {
+ $label = $data[$i]['img_label'];
+ svg_text($xlm + ($i * $x_step) + ($x_step / 2) - $depth - 4, $ih - $ybm + 20 + $depth, $label);
+ }
+ svg_group_end();
+ }
+
+ draw_border();
+
+
+ //
+ // legend
+ //
+ svg_rect($xlm, $ih-$ybm+39, 8, 8, array( 'stroke' => $cl['text']['rgb'], 'stroke-width' => 1, 'fill' => $cl['rx']['rgb']) );
+ svg_text($xlm+14, $ih-$ybm+48, T('bytes in'), array( 'fill' => $cl['text']['rgb'], 'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-size' => '8pt') );
+
+ svg_rect($xlm+120 , $ih-$ybm+39, 8, 8, array( 'stroke' => $cl['text']['rgb'], 'stroke-width' => 1, 'fill' => $cl['tx']['rgb']) );
+ svg_text($xlm+134, $ih-$ybm+48, T('bytes out'), array( 'fill' => $cl['text']['rgb'], 'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-size' => '8pt') );
+ }
+
+ function output_image()
+ {
+ global $page,$hour,$day,$month,$iface;
+
+ if ($page == 'summary')
+ return;
+
+ init_image();
+
+ if ($page == 'h')
+ {
+ draw_data($hour);
+ }
+ else if ($page == 'd')
+ {
+ draw_data($day);
+ }
+ else if ($page == 'm')
+ {
+ draw_data($month);
+ }
+
+ svg_end();
+ }
+
+ get_vnstat_data();
+ output_image();
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/index.php b/config/vnstat2/vnstat_php_frontend/index.php
new file mode 100644
index 00000000..70c0427f
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/index.php
@@ -0,0 +1,196 @@
+<?php
+ //
+ // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
+ //
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation; either version 2 of the License, or
+ // (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License
+ // along with this program; if not, write to the Free Software
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ //
+ //
+ // see file COPYING or at http://www.gnu.org/licenses/gpl.html
+ // for more information.
+ //
+ require 'config.php';
+ require 'localize.php';
+ require 'vnstat.php';
+
+ validate_input();
+
+ require "./themes/$style/theme.php";
+
+ function write_side_bar()
+ {
+ global $iface, $page, $graph, $script, $style;
+ global $iface_list, $iface_title;
+ global $page_list, $page_title;
+
+ $p = "&amp;graph=$graph&amp;style=$style";
+
+ print "<ul class=\"iface\">\n";
+ foreach ($iface_list as $if)
+ {
+ print "<li class=\"iface\">";
+ if (isset($iface_title[$if]))
+ {
+ print $iface_title[$if];
+ }
+ else
+ {
+ print $if;
+ }
+ print "<ul class=\"page\">\n";
+ foreach ($page_list as $pg)
+ {
+ print "<li class=\"page\"><a href=\"$script?if=$if$p&amp;page=$pg\">".$page_title[$pg]."</a></li>\n";
+ }
+ print "</ul></li>\n";
+
+ }
+ print "</ul>\n";
+ }
+
+
+ function kbytes_to_string($kb)
+ {
+ $units = array('TB','GB','MB','KB');
+ $scale = 1024*1024*1024;
+ $ui = 0;
+
+ while (($kb < $scale) && ($scale > 1))
+ {
+ $ui++;
+ $scale = $scale / 1024;
+ }
+ return sprintf("%0.2f %s", ($kb/$scale),$units[$ui]);
+ }
+
+ function write_summary()
+ {
+ global $summary,$top,$day,$hour,$month;
+
+ $trx = $summary['totalrx']*1024+$summary['totalrxk'];
+ $ttx = $summary['totaltx']*1024+$summary['totaltxk'];
+
+ //
+ // build array for write_data_table
+ //
+ $sum[0]['act'] = 1;
+ $sum[0]['label'] = T('This hour');
+ $sum[0]['rx'] = $hour[0]['rx'];
+ $sum[0]['tx'] = $hour[0]['tx'];
+
+ $sum[1]['act'] = 1;
+ $sum[1]['label'] = T('This day');
+ $sum[1]['rx'] = $day[0]['rx'];
+ $sum[1]['tx'] = $day[0]['tx'];
+
+ $sum[2]['act'] = 1;
+ $sum[2]['label'] = T('This month');
+ $sum[2]['rx'] = $month[0]['rx'];
+ $sum[2]['tx'] = $month[0]['tx'];
+
+ $sum[3]['act'] = 1;
+ $sum[3]['label'] = T('All time');
+ $sum[3]['rx'] = $trx;
+ $sum[3]['tx'] = $ttx;
+
+ write_data_table(T('Summary'), $sum);
+ print "<br/>\n";
+ write_data_table(T('Top 10 days'), $top);
+ }
+
+
+ function write_data_table($caption, $tab)
+ {
+ print "<table width=\"100%\" cellspacing=\"0\">\n";
+ print "<caption>$caption</caption>\n";
+ print "<tr>";
+ print "<th class=\"label\" style=\"width:120px;\">&nbsp;</th>";
+ print "<th class=\"label\">".T('In')."</th>";
+ print "<th class=\"label\">".T('Out')."</th>";
+ print "<th class=\"label\">".T('Total')."</th>";
+ print "</tr>\n";
+
+ for ($i=0; $i<count($tab); $i++)
+ {
+ if ($tab[$i]['act'] == 1)
+ {
+ $t = $tab[$i]['label'];
+ $rx = kbytes_to_string($tab[$i]['rx']);
+ $tx = kbytes_to_string($tab[$i]['tx']);
+ $total = kbytes_to_string($tab[$i]['rx']+$tab[$i]['tx']);
+ $id = ($i & 1) ? 'odd' : 'even';
+ print "<tr>";
+ print "<td class=\"label_$id\">$t</td>";
+ print "<td class=\"numeric_$id\">$rx</td>";
+ print "<td class=\"numeric_$id\">$tx</td>";
+ print "<td class=\"numeric_$id\">$total</td>";
+ print "</tr>\n";
+ }
+ }
+ print "</table>\n";
+ }
+
+ get_vnstat_data();
+
+ //
+ // html start
+ //
+ header('Content-type: text/html; charset=utf-8');
+ print '<?xml version="1.0"?>';
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>vnStat - PHP frontend</title>
+ <link rel="stylesheet" type="text/css" href="themes/<?php echo $style ?>/style.css"/>
+</head>
+<body>
+
+<div id="wrap">
+ <div id="sidebar"><?php write_side_bar(); ?></div>
+ <div id="content">
+ <div id="header"><?php print T('Traffic data for')." $iface_title[$iface] ($iface)";?></div>
+ <div id="main">
+ <?php
+ $graph_params = "if=$iface&amp;page=$page&amp;style=$style";
+ if ($page != 's')
+ if ($graph_format == 'svg') {
+ print "<object type=\"image/svg+xml\" width=\"692\" height=\"297\" data=\"graph_svg.php?$graph_params\"></object>\n";
+ } else {
+ print "<img src=\"graph.php?$graph_params\" alt=\"graph\"/>\n";
+ }
+
+ if ($page == 's')
+ {
+ write_summary();
+ }
+ else if ($page == 'h')
+ {
+ write_data_table(T('Last 24 hours'), $hour);
+ }
+ else if ($page == 'd')
+ {
+ write_data_table(T('Last 30 days'), $day);
+ }
+ else if ($page == 'm')
+ {
+ write_data_table(T('Last 12 months'), $month);
+ }
+ ?>
+ </div>
+ <div id="footer"><a href="http://www.sqweek.com/">vnStat PHP frontend</a> 1.5.1 - &copy;2006-2010 Bjorge Dijkstra (bjd _at_ jooz.net)</div>
+ </div>
+</div>
+
+</body></html>
diff --git a/config/vnstat2/vnstat_php_frontend/lang/cs.php b/config/vnstat2/vnstat_php_frontend/lang/cs.php
new file mode 100644
index 00000000..e6955964
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/lang/cs.php
@@ -0,0 +1,39 @@
+<?php
+
+// sidebar labels
+$L['summary'] = 'shrnutí';
+$L['hours'] = 'hodiny';
+$L['days'] = 'dny';
+$L['months'] = 'měsíce';
+
+// main table headers
+$L['Summary'] = 'Shrnutí';
+$L['Top 10 days'] = 'Nej 10 dní';
+$L['Last 24 hours'] = 'Posledních 24 hodin';
+$L['Last 30 days'] = 'Posledních 30 dní';
+$L['Last 12 months'] = 'Posledních 12 měsíců';
+
+// traffic table columns
+$L['In'] = 'Stahování';
+$L['Out'] = 'Odesílání';
+$L['Total'] = 'Celkem';
+
+// summary rows
+$L['This hour'] = 'Tato hodina';
+$L['This day'] = 'Tento den';
+$L['This month'] = 'Tento měsíc';
+$L['All time'] = 'Za celou dobu';
+
+// graph text
+$L['Traffic data for'] = 'Přehled pro';
+$L['bytes in'] = 'bytů staženo';
+$L['bytes out'] = 'bytů odesláno';
+
+// date formats
+$L['datefmt_days'] = '%d. %B';
+$L['datefmt_days_img'] = '%d';
+$L['datefmt_months'] = '%B %Y';
+$L['datefmt_months_img'] = '%b';
+$L['datefmt_hours'] = '%k%p';
+$L['datefmt_hours_img'] = '%k';
+$L['datefmt_top'] = '%d. %B %Y';
diff --git a/config/vnstat2/vnstat_php_frontend/lang/en.php b/config/vnstat2/vnstat_php_frontend/lang/en.php
new file mode 100644
index 00000000..b5e6cf0b
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/lang/en.php
@@ -0,0 +1,39 @@
+<?php
+
+// sidebar labels
+$L['summary'] = 'summary';
+$L['hours'] = 'hours';
+$L['days'] = 'days';
+$L['months'] = 'months';
+
+// main table headers
+$L['Summary'] = 'Summary';
+$L['Top 10 days'] = 'Top 10 days';
+$L['Last 24 hours'] = 'Last 24 hours';
+$L['Last 30 days'] = 'Last 30 days';
+$L['Last 12 months'] = 'Last 12 months';
+
+// traffic table columns
+$L['In'] = 'In';
+$L['Out'] = 'Out';
+$L['Total'] = 'Total';
+
+// summary rows
+$L['This hour'] = 'This hour';
+$L['This day'] = 'This day';
+$L['This month'] = 'This month';
+$L['All time'] = 'All time';
+
+// graph text
+$L['Traffic data for'] = 'Traffic data for';
+$L['bytes in'] = 'bytes in';
+$L['bytes out'] = 'bytes out';
+
+// date formats
+$L['datefmt_days'] = '%d %B';
+$L['datefmt_days_img'] = '%d';
+$L['datefmt_months'] = '%B %Y';
+$L['datefmt_months_img'] = '%b';
+$L['datefmt_hours'] = '%l%p';
+$L['datefmt_hours_img'] = '%l';
+$L['datefmt_top'] = '%d %B %Y';
diff --git a/config/vnstat2/vnstat_php_frontend/lang/nl.php b/config/vnstat2/vnstat_php_frontend/lang/nl.php
new file mode 100644
index 00000000..76691e0a
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/lang/nl.php
@@ -0,0 +1,40 @@
+<?php
+
+// sidebar labels
+$L['summary'] = 'samenvatting';
+$L['hours'] = 'uren';
+$L['days'] = 'dagen';
+$L['months'] = 'maanden';
+
+// main table headers
+$L['Summary'] = 'Samenvatting';
+$L['Top 10 days'] = 'Top 10 dagen';
+$L['Last 24 hours'] = 'Afgelopen 24 uur';
+$L['Last 30 days'] = 'Afgelopen 30 dagen';
+$L['Last 12 months'] = 'Afgelopen 12 maanden';
+
+// traffic table columns
+$L['In'] = 'In';
+$L['Out'] = 'Uit';
+$L['Total'] = 'Totaal';
+
+// summary rows
+$L['This hour'] = 'Dit uur';
+$L['This day'] = 'Deze dag';
+$L['This month'] = 'Deze maand';
+$L['All time'] = 'Altijd';
+
+// graph text
+$L['Traffic data for'] = 'Data verkeer voor';
+$L['bytes in'] = 'bytes in';
+$L['bytes out'] = 'bytes uit';
+
+// date formats
+$L['datefmt_days'] = '%d %B';
+$L['datefmt_days_img'] = '%d';
+$L['datefmt_months'] = '%B %Y';
+$L['datefmt_months_img'] = '%b';
+$L['datefmt_hours'] = '%H:%M';
+$L['datefmt_hours_img'] = '%H';
+$L['datefmt_top'] = '%d %B %Y';
+
diff --git a/config/vnstat2/vnstat_php_frontend/localize.php b/config/vnstat2/vnstat_php_frontend/localize.php
new file mode 100644
index 00000000..3695912f
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/localize.php
@@ -0,0 +1,15 @@
+<?php
+ // setup locale and translation
+ setlocale(LC_ALL, $locale);
+ require "lang/$language.php";
+
+ function T($str)
+ {
+ global $L;
+ if (isset($L[$str]))
+ return $L[$str];
+ else
+ return $str;
+ }
+
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/themes/dark/style.css b/config/vnstat2/vnstat_php_frontend/themes/dark/style.css
new file mode 100644
index 00000000..8cf475fe
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/dark/style.css
@@ -0,0 +1,21 @@
+* {margin:0; padding:0;}
+body {background:#2f2f2f; font-family:Verdana; font-size:12px;}
+#wrap {width: 960px; background:#242424; padding:10px; margin:0 auto; border:1px solid #474747;}
+#sidebar {width: 160px; float: left; padding: 3px 4px; color: #fff; background-color: #2F2F2F; border:1px solid #474747; -moz-border-radius:8px;}
+#sidebar ul.iface {}
+#sidebar li.iface {list-style-type:none; color:#08BB08; text-transform:uppercase; padding-bottom:10px; text-align:center;}
+#sidebar a{color:#aaa;}
+#sidebar ul.page {}
+#sidebar li.page {list-style-type:none; text-transform:none;}
+#content {margin-left: 180px; width: 780px;}
+#header {padding: 3px; color: #fff; background-color: #2F2F2F; text-align: center; border:1px solid #474747; font-size:14px; font-weight:bold; -moz-border-radius:8px;}
+#footer {padding: 3px; color: #fff; background-color: #2F2F2F; text-align: center; border:1px solid #474747; font-size:11px; -moz-border-radius:8px; clear:both; margin-top:10px;}
+#footer a {color:#fff;}
+#main {padding: 10px 10px 10px 10px; color: #fff; background-color: #2F2F2F; text-align: center; border:1px solid #474747; -moz-border-radius:8px; margin-top:10px;}
+#main td {padding:1px 0;}
+#main td.numeric_odd {text-align: right; color: #fff; background:#474747;}
+#main td.numeric_even {text-align: right; color: #fff; background:#242424;}
+#main td.label_odd {color: #fff; background:#474747;}
+#main td.label_even {color: #fff; background:#242424;}
+#main th.label {color: #fff; padding:2px 0; border-bottom:1px solid #fff;}
+#main caption {padding: 3px 0 4px 0; color:#08BB08; text-transform:uppercase;} \ No newline at end of file
diff --git a/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php b/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php
new file mode 100644
index 00000000..6df45cb2
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php
@@ -0,0 +1,16 @@
+<?php
+ // A dark colorscheme based on a contribution by Mart Visser
+ $colorscheme = array(
+ 'image_background' => array( 36, 36, 36, 0 ),
+ 'graph_background' => array( 220, 220, 230, 0 ),
+ 'graph_background_2' => array( 205, 205, 220, 0 ),
+ 'grid_stipple_1' => array( 140, 140, 140, 0 ),
+ 'grid_stipple_2' => array( 200, 200, 200, 0 ),
+ 'border' => array( 71, 71, 71, 0 ),
+ 'text' => array( 255, 255, 255,0 ),
+ 'rx' => array( 10, 180, 10, 50 ),
+ 'rx_border' => array( 0, 120, 0, 90 ),
+ 'tx' => array( 130, 130, 130, 50 ),
+ 'tx_border' => array( 60, 60, 60, 90 )
+ );
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/themes/espresso/style.css b/config/vnstat2/vnstat_php_frontend/themes/espresso/style.css
new file mode 100644
index 00000000..e5dff7f9
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/espresso/style.css
@@ -0,0 +1,170 @@
+body
+{
+ background-color: #363330;
+ margin: 8px;
+ padding: 0;
+}
+
+#content
+{
+ width: 898px;
+}
+
+#sidebar
+{
+ position: absolute;
+ left: 8px;
+ top: 8px;
+ width: 160px;
+ border-right: 1px solid #D3CAAA;
+ border-collapse: collapse;
+ float: left;
+}
+
+#sidebar ul.iface
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #D3CAAA;
+ background-color: #363330;
+ color: #D3CAAA;
+}
+
+#sidebar li.iface
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 0px;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ border-bottom: 1px dashed #D3CAAA;
+}
+
+#sidebar a
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+}
+
+#sidebar ul.page
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #D3CAAA;
+}
+
+#sidebar li.page
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 4px;
+ border: none;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.75em;
+ font-weight: normal;
+ text-align: right;
+ background-color: #413D39;
+ color: #D3CAAA;
+}
+
+
+#header
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 0px 8px 0px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: dashed solid dashed solid;
+ border-color: #D3CAAA;
+ border-collapse: collapse;
+ background-color: #363330;
+ color: #D3CAAA;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#footer
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 2px 8px 2px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #D3CAAA;
+ border-collapse: collapse;
+ background-color: #363330;
+ color: #D3CAAA;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.70em;
+ text-align: center;
+}
+
+#main
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 8px 8px 8px 8px;
+ border-left: 1px solid #D3CAAA;
+ border-right: 1px solid #D3CAAA;
+ border-collapse: collapse;
+}
+
+#main td
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.8em;
+}
+
+#main td.numeric_odd
+{
+ text-align: right;
+ background-color: #756F68;
+ color: #D3CAAA;
+}
+
+#main td.numeric_even
+{
+ text-align: right;
+ background-color: #544C4A;
+ color: #D3CAAA;
+}
+
+#main td.label_odd
+{
+ background-color: #413D39;
+ color: #D3CAAA;
+}
+
+#main td.label_even
+{
+ background-color: #5A514F;
+ color: #D3CAAA;
+}
+
+#main th.label
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ background-color: #413D39;
+ color: #D3CAAA;
+}
+
+#main caption
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1.25em;
+ font-weight: bold;
+ padding: 4px;
+ color: #D3CAAA;
+}
+
+a
+{
+ text-decoration: none;
+ color: #D3CAAA;
+}
diff --git a/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php b/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php
new file mode 100644
index 00000000..3c7818f5
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php
@@ -0,0 +1,17 @@
+<?php
+ // A dark colorscheme based on a contribution by Márcio Bremm
+ // It is based also on Espresso (gtkrc theme) by Jesse L. Kay
+ $colorscheme = array(
+ 'image_background' => array( 065, 061, 057, 0 ),
+ 'graph_background' => array( 117, 111, 104, 30 ),
+ 'graph_background_2' => array( 128, 122, 102, 30 ),
+ 'grid_stipple_1' => array( 140, 140, 140, 0 ),
+ 'grid_stipple_2' => array( 200, 200, 200, 0 ),
+ 'border' => array( 211, 202, 170, 0 ),
+ 'text' => array( 211, 202, 170, 0 ),
+ 'rx' => array( 211, 202, 170, 50 ),
+ 'rx_border' => array( 80, 40, 40, 90 ),
+ 'tx' => array( 163, 156, 131, 50 ),
+ 'tx_border' => array( 60, 60, 60, 90 )
+ );
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/themes/light/style.css b/config/vnstat2/vnstat_php_frontend/themes/light/style.css
new file mode 100644
index 00000000..28503f1d
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/light/style.css
@@ -0,0 +1,159 @@
+body
+{
+ margin: 0;
+ padding: 0;
+}
+
+#wrap
+{
+ xwidth: 868px;
+}
+
+#sidebar
+{
+ width: 160px;
+ border-right: 1px solid #99b;
+ border-collapse: collapse;
+ float: left;
+}
+
+#sidebar ul.iface
+{
+ margin: 0;
+ padding: 0;
+ border-top: 1px solid #99b;
+ color: #000;
+ background-color: #eef;
+}
+
+#sidebar li.iface
+{
+ margin: 0;
+ padding: 0;
+ list-style-type: none;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ xborder-top: 1px solid #99b;
+ border-bottom: 1px solid #99b;
+}
+
+#sidebar a
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+}
+
+#sidebar ul.page
+{
+ margin: 0;
+ padding: 0;
+ border-top: 1px solid #99b;
+}
+
+#sidebar li.page
+{
+ margin: 0;
+ padding: 4px;
+ border: none;
+ list-style-type: none;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.75em;
+ font-weight: normal;
+ text-align: right;
+ color: #000;
+ background-color: #fff;
+}
+
+#content
+{
+ margin-left: 160px;
+ width: 720px;
+}
+
+
+#header
+{
+ padding: 0px 8px 0px 8px;
+ border-width: 1px;
+ border-style: solid solid solid solid;
+ border-color: #99b;
+ border-collapse: collapse;
+ color: #000;
+ background-color: #eef;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#footer
+{
+ padding: 2px 8px 2px 8px;
+ border: 1px solid #99b;
+ border-collapse: collapse;
+ color: #000;
+ background-color: #eef;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.65em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#main
+{
+ padding: 8px;
+ border-left: 1px solid #99b;
+ border-right: 1px solid #99b;
+ border-collapse: collapse;
+}
+
+#main td
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.8em;
+}
+
+#main td.numeric_odd
+{
+ text-align: right;
+ color: #000;
+ background-color: #eef;
+}
+
+#main td.numeric_even
+{
+ text-align: right;
+ color: #000;
+ background-color: #fff;
+}
+
+#main td.label_odd
+{
+ color: #000;
+ background-color: #dde;
+}
+
+#main td.label_even
+{
+ color: #000;
+ background-color: #eee;
+}
+
+#main th.label
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ color: #000;
+ background-color: #dde;
+}
+
+#main caption
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1.25em;
+ font-weight: bold;
+ padding: 4px;
+}
diff --git a/config/vnstat2/vnstat_php_frontend/themes/light/theme.php b/config/vnstat2/vnstat_php_frontend/themes/light/theme.php
new file mode 100644
index 00000000..2516c874
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/light/theme.php
@@ -0,0 +1,15 @@
+<?php
+ $colorscheme = array(
+ 'image_background' => array( 255, 255, 255, 0 ),
+ 'graph_background' => array( 220, 220, 230, 0 ),
+ 'graph_background_2' => array( 205, 205, 220, 0 ),
+ 'grid_stipple_1' => array( 140, 140, 140, 0 ),
+ 'grid_stipple_2' => array( 200, 200, 200, 0 ),
+ 'border' => array( 0, 0, 0, 0 ),
+ 'text' => array( 0, 0, 0, 0 ),
+ 'rx' => array( 190, 190, 20, 50 ),
+ 'rx_border' => array( 40, 80, 40, 90 ),
+ 'tx' => array( 130, 160, 100, 50 ),
+ 'tx_border' => array( 80, 40, 40, 90 )
+ );
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css b/config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css
new file mode 100644
index 00000000..0136624d
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css
@@ -0,0 +1,170 @@
+body
+{
+ background-color: #FFFFFF;
+ margin: 8px;
+ padding: 0;
+}
+
+#content
+{
+ width: 898px;
+}
+
+#sidebar
+{
+ position: absolute;
+ left: 8px;
+ top: 8px;
+ width: 160px;
+ border-right: 1px solid #990000;
+ border-collapse: collapse;
+ float: left;
+}
+
+#sidebar ul.iface
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #990000;
+ background-color: #990000;
+ color: #FFFFFF;
+}
+
+#sidebar li.iface
+{
+ list-style-type: none;
+ margin: 1px;
+ padding: 0px;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ border-bottom: 1px dashed #990000;
+}
+
+#sidebar a
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+}
+
+#sidebar ul.page
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #990000;
+}
+
+#sidebar li.page
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 4px;
+ border: none;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.75em;
+ font-weight: normal;
+ text-align: right;
+ background-color: #BBBBBB;
+ color: #000000;
+}
+
+
+#header
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 0px 8px 0px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: dashed solid dashed solid;
+ border-color: #990000;
+ border-collapse: collapse;
+ background-color: #990000;
+ color: #FFFFFF;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#footer
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 2px 8px 2px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #82001D;
+ border-collapse: collapse;
+ background-color: #D2D2D2;
+ color: #82001D;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.70em;
+ text-align: center;
+}
+
+#main
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 8px 8px 8px 8px;
+ border-left: 1px solid #82001D;
+ border-right: 1px solid #82001D;
+ border-collapse: collapse;
+}
+
+#main td
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.8em;
+}
+
+#main td.numeric_odd
+{
+ text-align: right;
+ background-color: #C9C9C9;
+ color: #82001D;
+}
+
+#main td.numeric_even
+{
+ text-align: right;
+ background-color: #CFCFCF;
+ color: #82001D;
+}
+
+#main td.label_odd
+{
+ background-color: #A6A6A6;
+ color: #82001D;
+}
+
+#main td.label_even
+{
+ background-color: #C1C1C1;
+ color: #82001D;
+}
+
+#main th.label
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ background-color: #A6A6A6;
+ color: #82001D;
+}
+
+#main caption
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1.25em;
+ font-weight: bold;
+ padding: 4px;
+ color: #82001D;
+}
+
+a
+{
+ text-decoration: none;
+ color: #000000;
+}
diff --git a/config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php b/config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php
new file mode 100644
index 00000000..6489f842
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php
@@ -0,0 +1,17 @@
+<?php
+ // A red colorscheme based on a contribution by Perry Mason
+ // Updated by Bryan Paradis to fit with vnstat2_php_frontend-1.5.1
+ $colorscheme = array(
+ 'image_background' => array( 240, 240, 240, 0 ),
+ 'graph_background' => array( 255, 255, 255, 0 ),
+ 'graph_background_2' => array( 255, 255, 255, 0 ),
+ 'grid_stipple_1' => array( 144, 0, 0, 0 ),
+ 'grid_stipple_2' => array( 144, 0, 0, 0 ),
+ 'border' => array( 0, 0, 0, 0 ),
+ 'text' => array( 0, 0, 0, 0 ),
+ 'rx' => array( 190, 20, 20, 50 ),
+ 'rx_border' => array( 80, 40, 40, 90 ),
+ 'tx' => array( 130, 130, 130, 50 ),
+ 'tx_border' => array( 60, 60, 60, 90 )
+ );
+?> \ No newline at end of file
diff --git a/config/vnstat2/vnstat_php_frontend/themes/red/style.css b/config/vnstat2/vnstat_php_frontend/themes/red/style.css
new file mode 100644
index 00000000..48ab8d55
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/red/style.css
@@ -0,0 +1,170 @@
+body
+{
+ background-color: #D2D2D2;
+ margin: 8px;
+ padding: 0;
+}
+
+#content
+{
+ width: 898px;
+}
+
+#sidebar
+{
+ position: absolute;
+ left: 8px;
+ top: 8px;
+ width: 160px;
+ border-right: 1px solid #82001D;
+ border-collapse: collapse;
+ float: left;
+}
+
+#sidebar ul.iface
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #82001D;
+ background-color: #D2D2D2;
+ color: #82001D;
+}
+
+#sidebar li.iface
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 0px;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ border-bottom: 1px dashed #82001D;
+}
+
+#sidebar a
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+}
+
+#sidebar ul.page
+{
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px dashed #82001D;
+}
+
+#sidebar li.page
+{
+ list-style-type: none;
+ margin: 0px;
+ padding: 4px;
+ border: none;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.75em;
+ font-weight: normal;
+ text-align: right;
+ background-color: #C1C1C1;
+ color: #82001D;
+}
+
+
+#header
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 0px 8px 0px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: dashed solid dashed solid;
+ border-color: #82001D;
+ border-collapse: collapse;
+ background-color: #D2D2D2;
+ color: #82001D;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#footer
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 2px 8px 2px 8px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #82001D;
+ border-collapse: collapse;
+ background-color: #D2D2D2;
+ color: #82001D;
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.70em;
+ text-align: center;
+}
+
+#main
+{
+ width: 720px;
+ margin-left: 160px;
+ padding: 8px 8px 8px 8px;
+ border-left: 1px solid #82001D;
+ border-right: 1px solid #82001D;
+ border-collapse: collapse;
+}
+
+#main td
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 0.8em;
+}
+
+#main td.numeric_odd
+{
+ text-align: right;
+ background-color: #C9C9C9;
+ color: #82001D;
+}
+
+#main td.numeric_even
+{
+ text-align: right;
+ background-color: #CFCFCF;
+ color: #82001D;
+}
+
+#main td.label_odd
+{
+ background-color: #A6A6A6;
+ color: #82001D;
+}
+
+#main td.label_even
+{
+ background-color: #C1C1C1;
+ color: #82001D;
+}
+
+#main th.label
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1em;
+ font-weight: bold;
+ background-color: #A6A6A6;
+ color: #82001D;
+}
+
+#main caption
+{
+ font-family: 'Trebuchet MS', Verdana, sans-serif;
+ font-size: 1.25em;
+ font-weight: bold;
+ padding: 4px;
+ color: #82001D;
+}
+
+a
+{
+ text-decoration: none;
+ color: #A80022;
+}
diff --git a/config/vnstat2/vnstat_php_frontend/themes/red/theme.php b/config/vnstat2/vnstat_php_frontend/themes/red/theme.php
new file mode 100644
index 00000000..2c9ba6f4
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/themes/red/theme.php
@@ -0,0 +1,16 @@
+<?php
+ // A red colorscheme based on a contribution by Enrico Tröger
+ $colorscheme = array(
+ 'image_background' => array( 225, 225, 225, 0 ),
+ 'graph_background' => array( 220, 220, 230, 0 ),
+ 'graph_background_2' => array( 205, 205, 220, 0 ),
+ 'grid_stipple_1' => array( 140, 140, 140, 0 ),
+ 'grid_stipple_2' => array( 200, 200, 200, 0 ),
+ 'border' => array( 0, 0, 0, 0 ),
+ 'text' => array( 0, 0, 0, 0 ),
+ 'rx' => array( 190, 20, 20, 50 ),
+ 'rx_border' => array( 80, 40, 40, 90 ),
+ 'tx' => array( 130, 130, 130, 50 ),
+ 'tx_border' => array( 60, 60, 60, 90 )
+ );
+?>
diff --git a/config/vnstat2/vnstat_php_frontend/vera_copyright.txt b/config/vnstat2/vnstat_php_frontend/vera_copyright.txt
new file mode 100644
index 00000000..e651be1c
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/vera_copyright.txt
@@ -0,0 +1,124 @@
+Bitstream Vera Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as
+long as "Bitstream" or "Vera" are not in the names), and full
+redistribution (so long as they are not *sold* by themselves). They
+can be be bundled, redistributed and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright
+=========
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
+Vera is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute
+the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Bitstream Vera" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
+SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font
+Software without prior written authorization from the Gnome Foundation
+or Bitstream Inc., respectively. For further information, contact:
+fonts at gnome dot org.
+
+Copyright FAQ
+=============
+
+ 1. I don't understand the resale restriction... What gives?
+
+ Bitstream is giving away these fonts, but wishes to ensure its
+ competitors can't just drop the fonts as is into a font sale system
+ and sell them as is. It seems fair that if Bitstream can't make money
+ from the Bitstream Vera fonts, their competitors should not be able to
+ do so either. You can sell the fonts as part of any software package,
+ however.
+
+ 2. I want to package these fonts separately for distribution and
+ sale as part of a larger software package or system. Can I do so?
+
+ Yes. A RPM or Debian package is a "larger software package" to begin
+ with, and you aren't selling them independently by themselves.
+ See 1. above.
+
+ 3. Are derivative works allowed?
+ Yes!
+
+ 4. Can I change or add to the font(s)?
+ Yes, but you must change the name(s) of the font(s).
+
+ 5. Under what terms are derivative works allowed?
+
+ You must change the name(s) of the fonts. This is to ensure the
+ quality of the fonts, both to protect Bitstream and Gnome. We want to
+ ensure that if an application has opened a font specifically of these
+ names, it gets what it expects (though of course, using fontconfig,
+ substitutions could still could have occurred during font
+ opening). You must include the Bitstream copyright. Additional
+ copyrights can be added, as per copyright law. Happy Font Hacking!
+
+ 6. If I have improvements for Bitstream Vera, is it possible they might get
+ adopted in future versions?
+
+ Yes. The contract between the Gnome Foundation and Bitstream has
+ provisions for working with Bitstream to ensure quality additions to
+ the Bitstream Vera font family. Please contact us if you have such
+ additions. Note, that in general, we will want such additions for the
+ entire family, not just a single font, and that you'll have to keep
+ both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add
+ glyphs to the font, they must be stylistically in keeping with Vera's
+ design. Vera cannot become a "ransom note" font. Jim Lyles will be
+ providing a document describing the design elements used in Vera, as a
+ guide and aid for people interested in contributing to Vera.
+
+ 7. I want to sell a software package that uses these fonts: Can I do so?
+
+ Sure. Bundle the fonts with your software and sell your software
+ with the fonts. That is the intent of the copyright.
+
+ 8. If applications have built the names "Bitstream Vera" into them,
+ can I override this somehow to use fonts of my choosing?
+
+ This depends on exact details of the software. Most open source
+ systems and software (e.g., Gnome, KDE, etc.) are now converting to
+ use fontconfig (see www.fontconfig.org) to handle font configuration,
+ selection and substitution; it has provisions for overriding font
+ names and subsituting alternatives. An example is provided by the
+ supplied local.conf file, which chooses the family Bitstream Vera for
+ "sans", "serif" and "monospace". Other software (e.g., the XFree86
+ core server) has other mechanisms for font substitution.
+
diff --git a/config/vnstat2/vnstat_php_frontend/vnstat.php b/config/vnstat2/vnstat_php_frontend/vnstat.php
new file mode 100644
index 00000000..9c7e211c
--- /dev/null
+++ b/config/vnstat2/vnstat_php_frontend/vnstat.php
@@ -0,0 +1,211 @@
+<?php
+ //
+ // vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
+ //
+ // This program is free software; you can redistribute it and/or modify
+ // it under the terms of the GNU General Public License as published by
+ // the Free Software Foundation; either version 2 of the License, or
+ // (at your option) any later version.
+ //
+ // This program is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License
+ // along with this program; if not, write to the Free Software
+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ //
+ //
+ // see file COPYING or at http://www.gnu.org/licenses/gpl.html
+ // for more information.
+ //
+
+ //
+ // Valid values for other parameters you can pass to the script.
+ // Input parameters will always be limited to one of the values listed here.
+ // If a parameter is not provided or invalid it will revert to the default,
+ // the first parameter in the list.
+ //
+ if (isset($_SERVER['PHP_SELF']))
+ {
+ $script = $_SERVER['PHP_SELF'];
+ }
+ elseif (isset($_SERVER['SCRIPT_NAME']))
+ {
+ $script = $_SERVER['SCRIPT_NAME'];
+ }
+ else
+ {
+ die('can\'t determine script name!');
+ }
+
+ $page_list = array('s','h','d','m');
+
+ $graph_list = array('large','small','none');
+
+ $page_title['s'] = T('summary');
+ $page_title['h'] = T('hours');
+ $page_title['d'] = T('days');
+ $page_title['m'] = T('months');
+
+
+ //
+ // functions
+ //
+ function validate_input()
+ {
+ global $page, $page_list;
+ global $iface, $iface_list;
+ global $graph, $graph_list;
+ global $colorscheme, $style;
+ //
+ // get interface data
+ //
+ $page = isset($_GET['page']) ? $_GET['page'] : '';
+ $iface = isset($_GET['if']) ? $_GET['if'] : '';
+ $graph = isset($_GET['graph']) ? $_GET['graph'] : '';
+ $style = isset($_GET['style']) ? $_GET['style'] : '';
+
+ if (!in_array($page, $page_list))
+ {
+ $page = $page_list[0];
+ }
+
+ if (!in_array($iface, $iface_list))
+ {
+ $iface = $iface_list[0];
+ }
+
+ if (!in_array($graph, $graph_list))
+ {
+ $graph = $graph_list[0];
+ }
+
+ $tp = "./themes/$style";
+ if (!is_dir($tp) || !file_exists("$tp/theme.php"))
+ {
+ $style = DEFAULT_COLORSCHEME;
+ }
+ }
+
+
+ function get_vnstat_data()
+ {
+ global $iface, $vnstat_bin, $data_dir;
+ global $hour,$day,$month,$top,$summary;
+
+ if (!isset($vnstat_bin) || $vnstat_bin == '')
+ {
+ if (file_exists("$data_dir/vnstat_dump_$iface"))
+ {
+ $vnstat_data = file("$data_dir/vnstat_dump_$iface");
+ }
+ else
+ {
+ $vnstat_data = array();
+ }
+ }
+ else
+ {
+ $fd = popen("$vnstat_bin --dumpdb -i $iface", "r");
+ $buffer = '';
+ while (!feof($fd)) {
+ $buffer .= fgets($fd);
+ }
+ $vnstat_data = explode("\n", $buffer);
+ pclose($fd);
+ }
+
+
+ $day = array();
+ $hour = array();
+ $month = array();
+ $top = array();
+
+ //
+ // extract data
+ //
+ foreach($vnstat_data as $line)
+ {
+ $d = explode(';', trim($line));
+ if ($d[0] == 'd')
+ {
+ $day[$d[1]]['time'] = $d[2];
+ $day[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
+ $day[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
+ $day[$d[1]]['act'] = $d[7];
+ if ($d[2] != 0)
+ {
+ $day[$d[1]]['label'] = strftime(T('datefmt_days'),$d[2]);
+ $day[$d[1]]['img_label'] = strftime(T('datefmt_days_img'), $d[2]);
+ }
+ else
+ {
+ $day[$d[1]]['label'] = '';
+ $day[$d[1]]['img_label'] = '';
+ }
+ }
+ else if ($d[0] == 'm')
+ {
+ $month[$d[1]]['time'] = $d[2];
+ $month[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
+ $month[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
+ $month[$d[1]]['act'] = $d[7];
+ if ($d[2] != 0)
+ {
+ $month[$d[1]]['label'] = strftime(T('datefmt_months'), $d[2]);
+ $month[$d[1]]['img_label'] = strftime(T('datefmt_months_img'), $d[2]);
+ }
+ else
+ {
+ $month[$d[1]]['label'] = '';
+ $month[$d[1]]['img_label'] = '';
+ }
+ }
+ else if ($d[0] == 'h')
+ {
+ $hour[$d[1]]['time'] = $d[2];
+ $hour[$d[1]]['rx'] = $d[3];
+ $hour[$d[1]]['tx'] = $d[4];
+ $hour[$d[1]]['act'] = 1;
+ if ($d[2] != 0)
+ {
+ $st = $d[2] - ($d[2] % 3600);
+ $et = $st + 3600;
+ $hour[$d[1]]['label'] = strftime(T('datefmt_hours'), $st).' - '.strftime(T('datefmt_hours'), $et);
+ $hour[$d[1]]['img_label'] = strftime(T('datefmt_hours_img'), $d[2]);
+ }
+ else
+ {
+ $hour[$d[1]]['label'] = '';
+ $hour[$d[1]]['img_label'] = '';
+ }
+ }
+ else if ($d[0] == 't')
+ {
+ $top[$d[1]]['time'] = $d[2];
+ $top[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
+ $top[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
+ $top[$d[1]]['act'] = $d[7];
+ $top[$d[1]]['label'] = strftime(T('datefmt_top'), $d[2]);
+ $top[$d[1]]['img_label'] = '';
+ }
+ else
+ {
+ $summary[$d[0]] = isset($d[1]) ? $d[1] : '';
+ }
+ }
+ if (count($day) == 0)
+ $day[0] = 'nodata';
+ rsort($day);
+
+ if (count($month) == 0)
+ $month[0] = 'nodata';
+ rsort($month);
+
+ if (count($hour) == 0)
+ $hour[0] = 'nodata';
+ rsort($hour);
+ }
+?>
diff --git a/config/vnstat2/vnstati.xml b/config/vnstat2/vnstati.xml
index e2246ca0..7cd3f3be 100644
--- a/config/vnstat2/vnstati.xml
+++ b/config/vnstat2/vnstati.xml
@@ -10,7 +10,7 @@
<version>1.0</version>
<title>Vnstat2</title>
<aftersaveredirect>/vnstati.php</aftersaveredirect>
- <include_file>/usr/local/pkg/vnstat2.inc</include_file>
+ <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file>
<menu>
<name>vnstat2</name>
<tooltiptext></tooltiptext>
@@ -54,3 +54,4 @@
<custom_php_install_command>vnstat_install_config();</custom_php_install_command>
<custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command>
</packagegui>
+
diff --git a/config/vnstat2/vnstatoutput.xml b/config/vnstat2/vnstatoutput.xml
index 4b410aaa..9d2e3d05 100644
--- a/config/vnstat2/vnstatoutput.xml
+++ b/config/vnstat2/vnstatoutput.xml
@@ -10,7 +10,7 @@
<version>1.0</version>
<title>Vnstat2</title>
<aftersaveredirect>/diag_vnstat2.php</aftersaveredirect>
- <include_file>/usr/local/pkg/vnstat2.inc</include_file>
+ <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file>
<menu>
<name>vnstat2</name>
<tooltiptext></tooltiptext>
@@ -54,3 +54,4 @@
<custom_php_install_command>vnstat_install_config();</custom_php_install_command>
<custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command>
</packagegui>
+
diff --git a/config/vnstat2/bin/diag_vnstat.abc b/config/vnstat2/www/diag_vnstat.php
index afef3849..afef3849 100644
--- a/config/vnstat2/bin/diag_vnstat.abc
+++ b/config/vnstat2/www/diag_vnstat.php
diff --git a/config/vnstat2/bin/diag_vnstat2.abc b/config/vnstat2/www/diag_vnstat2.php
index ec19a0b2..ec19a0b2 100644
--- a/config/vnstat2/bin/diag_vnstat2.abc
+++ b/config/vnstat2/www/diag_vnstat2.php
diff --git a/config/vnstat2/bin/vnstat2_img.abc b/config/vnstat2/www/vnstat2_img.php
index 85644309..85644309 100644
--- a/config/vnstat2/bin/vnstat2_img.abc
+++ b/config/vnstat2/www/vnstat2_img.php
diff --git a/config/vnstat2/bin/vnstati.abc b/config/vnstat2/www/vnstati.php
index e5ddcd21..e5ddcd21 100644
--- a/config/vnstat2/bin/vnstati.abc
+++ b/config/vnstat2/www/vnstati.php
diff --git a/config/zabbix2/zabbix2-proxy.xml b/config/zabbix2/zabbix2-proxy.xml
index c857bec1..982b321b 100644
--- a/config/zabbix2/zabbix2-proxy.xml
+++ b/config/zabbix2/zabbix2-proxy.xml
@@ -129,6 +129,16 @@
<size>10</size>
<required>true</required>
</field>
+ <field>
+ <fielddescr>Advanced Parameters</fielddescr>
+ <fieldname>advancedparams</fieldname>
+ <encoding>base64</encoding>
+ <type>textarea</type>
+ <rows>5</rows>
+ <cols>50</cols>
+ <description>Advanced parameters. There are some rarely used parameters that sometimes need to be defined. Value has form, example: StartDiscoverers=10</description>
+ </field>
+
</fields>
<custom_php_install_command>sync_package_zabbix2();</custom_php_install_command>
<custom_php_command_before_form></custom_php_command_before_form>
diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc
index 92aad309..c08c5487 100644
--- a/config/zabbix2/zabbix2.inc
+++ b/config/zabbix2/zabbix2.inc
@@ -193,6 +193,7 @@ function sync_package_zabbix2(){
$zbproxy_config = $config['installedpackages']['zabbixproxy']['config'][0];
if ($zbproxy_config['proxyenabled']=="on"){
$Mode=(is_numericint($zbproxy_config['proxymode'])?$zbproxy_config['proxymode'] : 0);
+ $AdvancedParams=base64_decode($zbagent_config['advancedparams']);
$zbproxy_conf_file = <<< EOF
Server={$zbproxy_config['server']}
@@ -206,6 +207,7 @@ FpingLocation=/usr/local/sbin/fping
#there's currently no fping6 (IPv6) dependency in the package, but if there was, the binary would likely also be in /usr/local/sbin
Fping6Location=/usr/local/sbin/fping6
ProxyMode={$Mode}
+{$AdvancedParams}
EOF;
file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => "")));