Commit cf3977b7 authored by Franco Fichtner's avatar Franco Fichtner

src: varlog_path softcoding removal

parent 71ff705e
...@@ -40,7 +40,6 @@ $g = array( ...@@ -40,7 +40,6 @@ $g = array(
"varrun_path" => "/var/run", "varrun_path" => "/var/run",
"varetc_path" => "/var/etc", "varetc_path" => "/var/etc",
"vardb_path" => "/var/db", "vardb_path" => "/var/db",
"varlog_path" => "/var/log",
"admin_group" => "admins", "admin_group" => "admins",
"product_name" => "OPNsense", "product_name" => "OPNsense",
"product_website" => "https://opnsense.org", "product_website" => "https://opnsense.org",
......
...@@ -637,84 +637,84 @@ function system_syslogd_start() ...@@ -637,84 +637,84 @@ function system_syslogd_start()
$facilitylist = implode(',', array_unique($separatelogfacilities)); $facilitylist = implode(',', array_unique($separatelogfacilities));
$syslogconf .= "!radvd,routed,olsrd,zebra,ospfd,bgpd,miniupnpd\n"; $syslogconf .= "!radvd,routed,olsrd,zebra,ospfd,bgpd,miniupnpd\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/routing.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/routing.log\n";
$syslogconf .= "!ntp,ntpd,ntpdate\n"; $syslogconf .= "!ntp,ntpd,ntpdate\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/ntpd.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/ntpd.log\n";
$syslogconf .= "!ppp\n"; $syslogconf .= "!ppp\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/ppp.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/ppp.log\n";
$syslogconf .= "!pptps\n"; $syslogconf .= "!pptps\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/pptps.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/pptps.log\n";
$syslogconf .= "!poes\n"; $syslogconf .= "!poes\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/poes.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/poes.log\n";
$syslogconf .= "!l2tps\n"; $syslogconf .= "!l2tps\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/l2tps.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/l2tps.log\n";
$syslogconf .= "!charon\n"; $syslogconf .= "!charon\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/ipsec.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/ipsec.log\n";
if (isset($syslogcfg['vpn'])) if (isset($syslogcfg['vpn']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!openvpn\n"; $syslogconf .= "!openvpn\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/openvpn.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/openvpn.log\n";
if (isset($syslogcfg['vpn'])) if (isset($syslogcfg['vpn']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!apinger\n"; $syslogconf .= "!apinger\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/gateways.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/gateways.log\n";
if (isset($syslogcfg['apinger'])) if (isset($syslogcfg['apinger']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!dnsmasq,filterdns,unbound\n"; $syslogconf .= "!dnsmasq,filterdns,unbound\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/resolver.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/resolver.log\n";
$syslogconf .= "!dhcpd,dhcrelay,dhclient,dhcp6c\n"; $syslogconf .= "!dhcpd,dhcrelay,dhclient,dhcp6c\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/dhcpd.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/dhcpd.log\n";
if (isset($syslogcfg['dhcp'])) if (isset($syslogcfg['dhcp']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!relayd\n"; $syslogconf .= "!relayd\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/relayd.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/relayd.log\n";
if (isset($syslogcfg['relayd'])) if (isset($syslogcfg['relayd']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!hostapd\n"; $syslogconf .= "!hostapd\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/wireless.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/wireless.log\n";
if (isset($syslogcfg['hostapd'])) if (isset($syslogcfg['hostapd']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!filterlog\n"; $syslogconf .= "!filterlog\n";
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/filter.log\n"; $syslogconf .= "*.* {$log_directive}/var/log/filter.log\n";
if (isset($syslogcfg['filter'])) if (isset($syslogcfg['filter']))
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*"); $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
$syslogconf .= "!-{$facilitylist}\n"; $syslogconf .= "!-{$facilitylist}\n";
if (!isset($syslogcfg['disablelocallogging'])) if (!isset($syslogcfg['disablelocallogging']))
$syslogconf .= <<<EOD $syslogconf .= <<<EOD
local3.* {$log_directive}{$g['varlog_path']}/vpn.log local3.* {$log_directive}/var/log/vpn.log
local4.* {$log_directive}{$g['varlog_path']}/portalauth.log local4.* {$log_directive}/var/log/portalauth.log
local7.* {$log_directive}{$g['varlog_path']}/dhcpd.log local7.* {$log_directive}/var/log/dhcpd.log
*.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}{$g['varlog_path']}/system.log *.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}/var/log/system.log
news.err;local0.none;local3.none;local4.none; {$log_directive}{$g['varlog_path']}/system.log news.err;local0.none;local3.none;local4.none; {$log_directive}/var/log/system.log
local7.none {$log_directive}{$g['varlog_path']}/system.log local7.none {$log_directive}/var/log/system.log
security.* {$log_directive}{$g['varlog_path']}/system.log security.* {$log_directive}/var/log/system.log
auth.info;authpriv.info;daemon.info {$log_directive}{$g['varlog_path']}/system.log auth.info;authpriv.info;daemon.info {$log_directive}/var/log/system.log
auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15 auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15
*.emerg * *.emerg *
...@@ -1173,7 +1173,7 @@ EOD; ...@@ -1173,7 +1173,7 @@ EOD;
$lighty_config .= "ssl.use-sslv2 = \"disable\"\n"; $lighty_config .= "ssl.use-sslv2 = \"disable\"\n";
/* Hifn accelerators do NOT work with the BEAST mitigation code. Do not allow it to be enabled if a Hifn card has been detected. */ /* Hifn accelerators do NOT work with the BEAST mitigation code. Do not allow it to be enabled if a Hifn card has been detected. */
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); $fd = fopen('/var/log/dmesg.boot', 'r');
if ($fd) { if ($fd) {
while (!feof($fd)) { while (!feof($fd)) {
$dmesgl = fgets($fd); $dmesgl = fgets($fd);
...@@ -1329,14 +1329,15 @@ function system_ntp_configure($start_ntpd = true) ...@@ -1329,14 +1329,15 @@ function system_ntp_configure($start_ntpd = true)
{ {
global $config, $g; global $config, $g;
$driftfile = "/var/db/ntpd.drift"; $driftfile = '/var/db/ntpd.drift';
$statsdir = "/var/log/ntp"; $statsdir = '/var/log/ntp';
$gps_device = '/dev/gps0'; $gps_device = '/dev/gps0';
safe_mkdir($statsdir); safe_mkdir($statsdir);
if (!is_array($config['ntpd'])) if (!is_array($config['ntpd'])) {
$config['ntpd'] = array(); $config['ntpd'] = array();
}
$ntpcfg = "# \n"; $ntpcfg = "# \n";
$ntpcfg .= "# OPNsense ntp configuration file \n"; $ntpcfg .= "# OPNsense ntp configuration file \n";
...@@ -1636,7 +1637,7 @@ function system_dmesg_save() ...@@ -1636,7 +1637,7 @@ function system_dmesg_save()
$lastcpline = $i; $lastcpline = $i;
} }
$fd = fopen("{$g['varlog_path']}/dmesg.boot", "w"); $fd = fopen('/var/log/dmesg.boot', 'w');
if (!$fd) { if (!$fd) {
printf(gettext("Error: cannot open dmesg.boot in system_dmesg_save().%s"), "\n"); printf(gettext("Error: cannot open dmesg.boot in system_dmesg_save().%s"), "\n");
return 1; return 1;
...@@ -1702,20 +1703,21 @@ function system_disable_arp_wrong_if() ...@@ -1702,20 +1703,21 @@ function system_disable_arp_wrong_if()
function system_enable_arp_wrong_if() function system_enable_arp_wrong_if()
{ {
global $config;
set_sysctl(array( set_sysctl(array(
"net.link.ether.inet.log_arp_wrong_iface" => "1", "net.link.ether.inet.log_arp_wrong_iface" => "1",
"net.link.ether.inet.log_arp_movements" => "1" "net.link.ether.inet.log_arp_movements" => "1"
)); ));
} }
function enable_watchdog() { function enable_watchdog()
{
global $config; global $config;
return;
return; /* XXX delete or repair please */
$install_watchdog = false; $install_watchdog = false;
$supported_watchdogs = array("Geode"); $supported_watchdogs = array("Geode");
$file = file_get_contents("/var/log/dmesg.boot"); $file = file_get_contents('/var/log/dmesg.boot');
foreach($supported_watchdogs as $sd) { foreach($supported_watchdogs as $sd) {
if(stristr($file, "Geode")) { if(stristr($file, "Geode")) {
$install_watchdog = true; $install_watchdog = true;
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -29,11 +30,12 @@ ...@@ -29,11 +30,12 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$dhcpd_logfile = "{$g['varlog_path']}/dhcpd.log"; $dhcpd_logfile = '/var/log/dhcpd.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) { if ($_POST['clear']) {
clear_log_file($dhcpd_logfile); clear_log_file($dhcpd_logfile);
......
...@@ -88,19 +88,22 @@ if ($filtersubmit) { ...@@ -88,19 +88,22 @@ if ($filtersubmit) {
$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null); $filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
} }
$filter_logfile = "{$g['varlog_path']}/filter.log"; $filter_logfile = '/var/log/filter.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
# Override Display Quantity # Override Display Quantity
if ($filterlogentries_qty) if ($filterlogentries_qty) {
$nentries = $filterlogentries_qty; $nentries = $filterlogentries_qty;
}
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($filter_logfile); clear_log_file($filter_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall"));
$shortcut_section = "firewall"; $shortcut_section = "firewall";
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -30,7 +31,7 @@ ...@@ -30,7 +31,7 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("filter_log.inc"); require_once("filter_log.inc");
$filter_logfile = "{$g['varlog_path']}/filter.log"; $filter_logfile = '/var/log/filter.log';
/* Hardcode this. AJAX doesn't do so well with large numbers */ /* Hardcode this. AJAX doesn't do so well with large numbers */
$nentries = 50; $nentries = 50;
...@@ -38,8 +39,9 @@ $nentries = 50; ...@@ -38,8 +39,9 @@ $nentries = 50;
/* AJAX related routines */ /* AJAX related routines */
handle_ajax($nentries, $nentries + 20); handle_ajax($nentries, $nentries + 20);
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($filter_logfile); clear_log_file($filter_logfile);
}
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100); $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100);
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2009 Jim Pingle (jpingle@gmail.com) Copyright (C) 2009 Jim Pingle (jpingle@gmail.com)
...@@ -31,7 +32,7 @@ $shortcut_section = "firewall"; ...@@ -31,7 +32,7 @@ $shortcut_section = "firewall";
require_once("guiconfig.inc"); require_once("guiconfig.inc");
include_once("filter_log.inc"); include_once("filter_log.inc");
$filter_logfile = "{$g['varlog_path']}/filter.log"; $filter_logfile = '/var/log/filter.log';
$lines = 5000; $lines = 5000;
$entriesperblock = 5; $entriesperblock = 5;
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -30,23 +31,28 @@ ...@@ -30,23 +31,28 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$system_logfile = "{$g['varlog_path']}/gateways.log"; $system_logfile = '/var/log/gateways.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($system_logfile); clear_log_file($system_logfile);
}
if ($_GET['filtertext']) if ($_GET['filtertext']) {
$filtertext = htmlspecialchars($_GET['filtertext']); $filtertext = htmlspecialchars($_GET['filtertext']);
}
if ($_POST['filtertext']) if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']); $filtertext = htmlspecialchars($_POST['filtertext']);
}
if ($filtertext) if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext"; $filtertextmeta = "?filtertext={$filtertext}";
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Gateways")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Gateways"));
$shortcut_section = "gateways"; $shortcut_section = "gateways";
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -30,14 +31,16 @@ ...@@ -30,14 +31,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("ipsec.inc"); require_once("ipsec.inc");
$ipsec_logfile = "{$g['varlog_path']}/ipsec.log"; $ipsec_logfile = '/var/log/ipsec.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($ipsec_logfile); clear_log_file($ipsec_logfile);
}
$ipsec_logarr = return_clog($ipsec_logfile, $nentries); $ipsec_logarr = return_clog($ipsec_logfile, $nentries);
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>. Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>.
...@@ -29,14 +30,16 @@ ...@@ -29,14 +30,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$ntpd_logfile = "{$g['varlog_path']}/ntpd.log"; $ntpd_logfile = '/var/log/ntpd.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($ntpd_logfile); clear_log_file($ntpd_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("NTP")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("NTP"));
$shortcut_section = "ntp"; $shortcut_section = "ntp";
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -33,14 +34,16 @@ $shortcut_section = "openvpn"; ...@@ -33,14 +34,16 @@ $shortcut_section = "openvpn";
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("vpn.inc"); require_once("vpn.inc");
$openvpn_logfile = "{$g['varlog_path']}/openvpn.log"; $openvpn_logfile = '/var/log/openvpn.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($openvpn_logfile); clear_log_file($openvpn_logfile);
}
include("head.inc"); include("head.inc");
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -29,14 +30,16 @@ ...@@ -29,14 +30,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$ppp_logfile = "{$g['varlog_path']}/ppp.log"; $ppp_logfile = '/var/log/ppp.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($ppp_logfile); clear_log_file($ppp_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("PPP")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("PPP"));
include("head.inc"); include("head.inc");
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>. Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
...@@ -29,14 +30,16 @@ ...@@ -29,14 +30,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$relayd_logfile = "{$g['varlog_path']}/relayd.log"; $relayd_logfile = '/var/log/relayd.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($relayd_logfile); clear_log_file($relayd_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Load Balancer")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Load Balancer"));
$shortcut_section = "relayd"; $shortcut_section = "relayd";
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -30,23 +31,28 @@ ...@@ -30,23 +31,28 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$system_logfile = "{$g['varlog_path']}/resolver.log"; $system_logfile = '/var/log/resolver.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($system_logfile); clear_log_file($system_logfile);
}
if ($_GET['filtertext']) if ($_GET['filtertext']) {
$filtertext = htmlspecialchars($_GET['filtertext']); $filtertext = htmlspecialchars($_GET['filtertext']);
}
if ($_POST['filtertext']) if ($_POST['filtertext']) {
$filtertext = htmlspecialchars($_POST['filtertext']); $filtertext = htmlspecialchars($_POST['filtertext']);
}
if ($filtertext) if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext"; $filtertextmeta = "?filtertext={$filtertext}";
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Resolver")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Resolver"));
$shortcut_section = "resolver"; $shortcut_section = "resolver";
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2012 Jim Pingle <jimp@pfsense.org>. Copyright (C) 2012 Jim Pingle <jimp@pfsense.org>.
...@@ -28,14 +29,16 @@ ...@@ -28,14 +29,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$routing_logfile = "{$g['varlog_path']}/routing.log"; $routing_logfile = '/var/log/routing.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($routing_logfile); clear_log_file($routing_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Routing")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Routing"));
$shortcut_section = "routing"; $shortcut_section = "routing";
......
<?php <?php
/* /*
Copyright (C) Deciso B.V. Copyright (C) Deciso B.V.
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>. Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
...@@ -30,14 +31,16 @@ ...@@ -30,14 +31,16 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
$wireless_logfile = "{$g['varlog_path']}/wireless.log"; $wireless_logfile = '/var/log/wireless.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
if ($_POST['clear']) if ($_POST['clear']) {
clear_log_file($wireless_logfile); clear_log_file($wireless_logfile);
}
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Wireless")); $pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Wireless"));
$shortcut_section = "wireless"; $shortcut_section = "wireless";
......
...@@ -523,19 +523,22 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru ...@@ -523,19 +523,22 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru
system_syslogd_start(); system_syslogd_start();
} }
function clear_all_log_files() { function clear_all_log_files()
global $g; {
exec("/usr/bin/killall syslogd"); killbyname('syslogd');
$log_files = array(
"system", "filter", "dhcpd", "vpn", "pptps", "poes", "l2tps", "openvpn", "portalauth",
"ipsec", "ppp", "relayd", "wireless", "lighttpd", "ntpd", "gateways", "resolver", "routing"
);
$log_files = array("system", "filter", "dhcpd", "vpn", "pptps", "poes", "l2tps", "openvpn", "portalauth", "ipsec", "ppp", "relayd", "wireless", "lighttpd", "ntpd", "gateways", "resolver", "routing");
foreach ($log_files as $lfile) { foreach ($log_files as $lfile) {
clear_log_file("{$g['varlog_path']}/{$lfile}.log", false); clear_log_file("/var/log/{$lfile}.log", false);
} }
system_syslogd_start(); system_syslogd_start();
killbyname("dhcpd"); killbyname("dhcpd");
services_dhcpd_configure(); services_dhcpd_configure();
return;
} }
function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") { function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
......
...@@ -101,30 +101,32 @@ require_once('includes/functions.inc.php'); ...@@ -101,30 +101,32 @@ require_once('includes/functions.inc.php');
## Check to see if we have a swap space, ## Check to see if we have a swap space,
## if true, display, if false, hide it ... ## if true, display, if false, hide it ...
if(file_exists("/usr/sbin/swapinfo")) { if (file_exists('/usr/sbin/swapinfo')) {
$swapinfo = `/usr/sbin/swapinfo`; $swapinfo = `/usr/sbin/swapinfo`;
if(stristr($swapinfo,'%') == true) $showswap=true; if (stristr($swapinfo,'%')) {
$showswap = true;
}
} }
## Find out whether there's hardware encryption or not ## Find out whether there's hardware encryption or not
unset($hwcrypto); unset($hwcrypto);
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); $fd = fopen('/var/log/dmesg.boot', 'r');
if ($fd) { if ($fd) {
while (!feof($fd)) { while (!feof($fd)) {
$dmesgl = fgets($fd); $dmesgl = fgets($fd);
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)
or preg_match("/.*(VIA Padlock)/", $dmesgl, $matches) or preg_match("/.*(VIA Padlock)/", $dmesgl, $matches)
or preg_match("/^safe.: (\w.*)/", $dmesgl, $matches) or preg_match("/^safe.: (\w.*)/", $dmesgl, $matches)
or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches)
or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches)
or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)
or preg_match("/^aesni.: (.*?),/", $dmesgl, $matches)) { or preg_match("/^aesni.: (.*?),/", $dmesgl, $matches)) {
$hwcrypto = $matches[1]; $hwcrypto = $matches[1];
break; break;
}
} }
fclose($fd);
} }
fclose($fd);
}
##build widget saved list information ##build widget saved list information
if ($config['widgets'] && $config['widgets']['sequence'] != "") { if ($config['widgets'] && $config['widgets']['sequence'] != "") {
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
...@@ -32,16 +33,22 @@ require_once("filter.inc"); ...@@ -32,16 +33,22 @@ require_once("filter.inc");
require_once("shaper.inc"); require_once("shaper.inc");
require_once("vslb.inc"); require_once("vslb.inc");
if (!is_array($config['load_balancer'])) {
$config['load_balancer'] = array();
}
if (!is_array($config['load_balancer']['lbpool'])) { if (!is_array($config['load_balancer']['lbpool'])) {
$config['load_balancer']['lbpool'] = array(); $config['load_balancer']['lbpool'] = array();
} }
$a_pool = &$config['load_balancer']['lbpool']; $a_pool = &$config['load_balancer']['lbpool'];
$lb_logfile = "{$g['varlog_path']}/relayd.log"; $lb_logfile = '/var/log/relayd.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
$now = time(); $now = time();
$year = date("Y"); $year = date("Y");
......
...@@ -249,7 +249,7 @@ if ($_POST) { ...@@ -249,7 +249,7 @@ if ($_POST) {
} }
unset($hwcrypto); unset($hwcrypto);
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); $fd = fopen('/var/log/dmesg.boot', 'r');
if ($fd) { if ($fd) {
while (!feof($fd)) { while (!feof($fd)) {
$dmesgl = fgets($fd); $dmesgl = fgets($fd);
......
...@@ -41,6 +41,9 @@ require_once("vslb.inc"); ...@@ -41,6 +41,9 @@ require_once("vslb.inc");
$now = time(); $now = time();
$year = date("Y"); $year = date("Y");
if (!is_array($config['load_balancer'])) {
$config['load_balancer'] = array();
}
if (!is_array($config['load_balancer']['lbpool'])) { if (!is_array($config['load_balancer']['lbpool'])) {
$config['load_balancer']['lbpool'] = array(); $config['load_balancer']['lbpool'] = array();
} }
...@@ -52,10 +55,11 @@ $a_pool = &$config['load_balancer']['lbpool']; ...@@ -52,10 +55,11 @@ $a_pool = &$config['load_balancer']['lbpool'];
$rdr_a = get_lb_redirects(); $rdr_a = get_lb_redirects();
$relay_hosts = get_lb_summary(); $relay_hosts = get_lb_summary();
$lb_logfile = "{$g['varlog_path']}/relayd.log"; $lb_logfile = '/var/log/relayd.log';
$nentries = $config['syslog']['nentries']; $nentries = $config['syslog']['nentries'];
if (!$nentries) if (!$nentries) {
$nentries = 50; $nentries = 50;
}
?> ?>
......
...@@ -72,8 +72,8 @@ $filterfieldsarray = array( ...@@ -72,8 +72,8 @@ $filterfieldsarray = array(
"interface" => $nentriesinterfaces "interface" => $nentriesinterfaces
); );
$filter_logfile = "{$g['varlog_path']}/filter.log"; $filter_logfile = '/var/log/filter.log';
$filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray); //Get log entries $filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray);
/* AJAX related routines */ /* AJAX related routines */
handle_ajax($nentries, $nentries + 20); handle_ajax($nentries, $nentries + 20);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment