Commit adfeac41 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor diag_logs_settings.php

parent 28215751
...@@ -37,42 +37,19 @@ require_once("system.inc"); ...@@ -37,42 +37,19 @@ require_once("system.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("services.inc"); require_once("services.inc");
$pconfig['rrdenable'] = isset($config['rrd']['enable']);
function clear_all_log_files() function clear_all_log_files()
{ {
killbyname('syslogd'); killbyname('syslogd');
$clog_files = array( $clog_files = array('dhcpd', 'filter', 'gateways', 'ipsec', 'l2tps', 'lighttpd', 'ntpd', 'openvpn', 'poes',
'dhcpd', 'portalauth', 'ppps', 'pptps', 'relayd', 'resolver', 'routing', 'system','vpn','wireless');
'filter', $log_files = array('squid/access', 'squid/cache', 'squid/store');
'gateways',
'ipsec',
'l2tps',
'lighttpd',
'ntpd',
'openvpn',
'poes',
'portalauth',
'ppps',
'pptps',
'relayd',
'resolver',
'routing',
'system',
'vpn',
'wireless',
);
foreach ($clog_files as $lfile) { foreach ($clog_files as $lfile) {
clear_clog("/var/log/{$lfile}.log", false); clear_clog("/var/log/{$lfile}.log", false);
} }
$log_files = array(
'squid/access',
'squid/cache',
'squid/store',
);
foreach ($log_files as $lfile) { foreach ($log_files as $lfile) {
clear_log("/var/log/{$lfile}.log", false); clear_log("/var/log/{$lfile}.log", false);
...@@ -83,35 +60,6 @@ function clear_all_log_files() ...@@ -83,35 +60,6 @@ function clear_all_log_files()
services_dhcpd_configure(); services_dhcpd_configure();
} }
$pconfig['reverse'] = isset($config['syslog']['reverse']);
$pconfig['nentries'] = $config['syslog']['nentries'];
$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
$pconfig['remoteserver2'] = $config['syslog']['remoteserver2'];
$pconfig['remoteserver3'] = $config['syslog']['remoteserver3'];
$pconfig['sourceip'] = $config['syslog']['sourceip'];
$pconfig['ipproto'] = $config['syslog']['ipproto'];
$pconfig['filter'] = isset($config['syslog']['filter']);
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
$pconfig['vpn'] = isset($config['syslog']['vpn']);
$pconfig['apinger'] = isset($config['syslog']['apinger']);
$pconfig['relayd'] = isset($config['syslog']['relayd']);
$pconfig['hostapd'] = isset($config['syslog']['hostapd']);
$pconfig['logall'] = isset($config['syslog']['logall']);
$pconfig['system'] = isset($config['syslog']['system']);
$pconfig['enable'] = isset($config['syslog']['enable']);
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
$pconfig['logdefaultpass'] = isset($config['syslog']['nologdefaultpass']);
$pconfig['logbogons'] = !isset($config['syslog']['nologbogons']);
$pconfig['logprivatenets'] = !isset($config['syslog']['nologprivatenets']);
$pconfig['loglighttpd'] = !isset($config['syslog']['nologlighttpd']);
$pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
$pconfig['logfilesize'] = $config['syslog']['logfilesize'];
if (!$pconfig['nentries'])
$pconfig['nentries'] = 50;
function is_valid_syslog_server($target) { function is_valid_syslog_server($target) {
return (is_ipaddr($target) return (is_ipaddr($target)
|| is_ipaddrwithport($target) || is_ipaddrwithport($target)
...@@ -119,86 +67,110 @@ function is_valid_syslog_server($target) { ...@@ -119,86 +67,110 @@ function is_valid_syslog_server($target) {
|| is_hostnamewithport($target)); || is_hostnamewithport($target));
} }
if ($_POST['resetlogs'] == 'Reset Log Files') {
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
$pconfig['rrdenable'] = isset($config['rrd']['enable']);
$pconfig['reverse'] = isset($config['syslog']['reverse']);
$pconfig['nentries'] = !empty($config['syslog']['nentries']) ? $config['syslog']['nentries'] : 50;
$pconfig['remoteserver'] = !empty($config['syslog']['remoteserver']) ? $config['syslog']['remoteserver'] : null;
$pconfig['remoteserver2'] = !empty($config['syslog']['remoteserver2']) ? $config['syslog']['remoteserver2'] : null;
$pconfig['remoteserver3'] = !empty($config['syslog']['remoteserver3']) ? $config['syslog']['remoteserver3'] : null;
$pconfig['sourceip'] = !empty($config['syslog']['sourceip']) ? $config['syslog']['sourceip'] : null;
$pconfig['ipproto'] = !empty($config['syslog']['ipproto']) ? $config['syslog']['ipproto'] : null;
$pconfig['filter'] = isset($config['syslog']['filter']);
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
$pconfig['vpn'] = isset($config['syslog']['vpn']);
$pconfig['apinger'] = isset($config['syslog']['apinger']);
$pconfig['relayd'] = isset($config['syslog']['relayd']);
$pconfig['hostapd'] = isset($config['syslog']['hostapd']);
$pconfig['logall'] = isset($config['syslog']['logall']);
$pconfig['system'] = isset($config['syslog']['system']);
$pconfig['enable'] = isset($config['syslog']['enable']);
$pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']);
$pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']);
$pconfig['logbogons'] = empty($config['syslog']['nologbogons']);
$pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']);
$pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']);
$pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
$pconfig['logfilesize'] = !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") {
clear_all_log_files(); clear_all_log_files();
$savemsg = gettext("The log files have been reset."); $savemsg = gettext("The log files have been reset.");
} elseif ($_POST['ResetRRD']) { } elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") {
$savemsg = gettext('RRD data has been cleared.'); $savemsg = gettext('RRD data has been cleared.');
mwexec('/bin/rm /var/db/rrd/*'); mwexec('/bin/rm /var/db/rrd/*');
enable_rrd_graphing(); enable_rrd_graphing();
setup_gateways_monitor(); setup_gateways_monitor();
} elseif ($_POST) { } else {
$input_errors = array();
unset($input_errors);
$pconfig = $_POST; $pconfig = $_POST;
/* input validation */ /* input validation */
if ($_POST['enable'] && !is_valid_syslog_server($_POST['remoteserver'])) { if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1."); $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
} }
if ($_POST['enable'] && $_POST['remoteserver2'] && !is_valid_syslog_server($_POST['remoteserver2'])) { if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2."); $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
} }
if ($_POST['enable'] && $_POST['remoteserver3'] && !is_valid_syslog_server($_POST['remoteserver3'])) { if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver3']) && !is_valid_syslog_server($_POST['remoteserver3'])) {
$input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3."); $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
} }
if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) { if (($pconfig['nentries'] < 5) || ($pconfig['nentries'] > 2000)) {
$input_errors[] = gettext("Number of log entries to show must be between 5 and 2000."); $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
} }
if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) { if (!empty($pconfig['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) {
if (!is_numeric($_POST['logfilesize']) || ($_POST['logfilesize'] < 5120)) { if (!is_numeric($pconfig['logfilesize']) || ($pconfig['logfilesize'] < 5120)) {
$input_errors[] = gettext("Log file size must be a positive integer greater than 5120."); $input_errors[] = gettext("Log file size must be a positive integer greater than 5120.");
} }
} }
if (!$input_errors) { if (count($input_errors) == 0) {
$config['syslog']['reverse'] = $_POST['reverse'] ? true : false; $config['syslog']['reverse'] = !empty($pconfig['reverse']) ? true : false;
$config['syslog']['nentries'] = (int)$_POST['nentries']; $config['syslog']['nentries'] = (int)$pconfig['nentries'];
$pconfig['nentries'] = $config['syslog']['nentries']; if (isset($_POST['logfilesize']) && (strlen($pconfig['logfilesize']) > 0)) {
if (isset($_POST['logfilesize']) && (strlen($_POST['logfilesize']) > 0)) { $config['syslog']['logfilesize'] = (int)$pconfig['logfilesize'];
$config['syslog']['logfilesize'] = (int)$_POST['logfilesize']; } elseif (isset($config['syslog']['logfilesize'])) {
$pconfig['logfilesize'] = $config['syslog']['logfilesize'];
} else {
unset($config['syslog']['logfilesize']); unset($config['syslog']['logfilesize']);
} }
$config['syslog']['remoteserver'] = $_POST['remoteserver']; $config['syslog']['remoteserver'] = $pconfig['remoteserver'];
$config['syslog']['remoteserver2'] = $_POST['remoteserver2']; $config['syslog']['remoteserver2'] = $pconfig['remoteserver2'];
$config['syslog']['remoteserver3'] = $_POST['remoteserver3']; $config['syslog']['remoteserver3'] = $pconfig['remoteserver3'];
$config['syslog']['sourceip'] = $_POST['sourceip']; $config['syslog']['sourceip'] = $pconfig['sourceip'];
$config['syslog']['ipproto'] = $_POST['ipproto']; $config['syslog']['ipproto'] = $pconfig['ipproto'];
$config['syslog']['filter'] = $_POST['filter'] ? true : false; $config['syslog']['filter'] = !empty($pconfig['filter']);
$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false; $config['syslog']['dhcp'] = !empty($pconfig['dhcp']);
$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false; $config['syslog']['portalauth'] = !empty($pconfig['portalauth']);
$config['syslog']['vpn'] = $_POST['vpn'] ? true : false; $config['syslog']['vpn'] = !empty($pconfig['vpn']);
$config['syslog']['apinger'] = $_POST['apinger'] ? true : false; $config['syslog']['apinger'] = !empty($pconfig['apinger']);
$config['syslog']['relayd'] = $_POST['relayd'] ? true : false; $config['syslog']['relayd'] = !empty($pconfig['relayd']);
$config['syslog']['hostapd'] = $_POST['hostapd'] ? true : false; $config['syslog']['hostapd'] = !empty($pconfig['hostapd']);
$config['syslog']['logall'] = $_POST['logall'] ? true : false; $config['syslog']['logall'] = !empty($pconfig['logall']);
$config['syslog']['system'] = $_POST['system'] ? true : false; $config['syslog']['system'] = !empty($pconfig['system']);
$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false; $config['syslog']['disablelocallogging'] = !empty($pconfig['disablelocallogging']);
$config['syslog']['enable'] = $_POST['enable'] ? true : false; $config['syslog']['enable'] = !empty($pconfig['enable']);
$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']); $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
$oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']); $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']);
$oldnologbogons = isset($config['syslog']['nologbogons']); $oldnologbogons = isset($config['syslog']['nologbogons']);
$oldnologprivatenets = isset($config['syslog']['nologprivatenets']); $oldnologprivatenets = isset($config['syslog']['nologprivatenets']);
$oldnologlighttpd = isset($config['syslog']['nologlighttpd']); $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true; $config['syslog']['nologdefaultblock'] = empty($pconfig['logdefaultblock']);
$config['syslog']['nologdefaultpass'] = $_POST['logdefaultpass'] ? true : false; $config['syslog']['nologdefaultpass'] = empty($pconfig['logdefaultpass']);
$config['syslog']['nologbogons'] = $_POST['logbogons'] ? false : true; $config['syslog']['nologbogons'] = empty($pconfig['logbogons']);
$config['syslog']['nologprivatenets'] = $_POST['logprivatenets'] ? false : true; $config['syslog']['nologprivatenets'] = empty($pconfig['logprivatenets']);
$config['syslog']['nologlighttpd'] = $_POST['loglighttpd'] ? false : true; $config['syslog']['nologlighttpd'] = empty($pconfig['loglighttpd']);
if (is_numeric($_POST['filterdescriptions']) && $_POST['filterdescriptions'] > 0) if (is_numeric($pconfig['filterdescriptions']) && $pconfig['filterdescriptions'] > 0)
$config['syslog']['filterdescriptions'] = $_POST['filterdescriptions']; $config['syslog']['filterdescriptions'] = $pconfig['filterdescriptions'];
else elseif (isset($config['syslog']['filterdescriptions'])) {
unset($config['syslog']['filterdescriptions']); unset($config['syslog']['filterdescriptions']);
if($config['syslog']['enable'] == false) {
unset($config['syslog']['remoteserver']);
unset($config['syslog']['remoteserver2']);
unset($config['syslog']['remoteserver3']);
} }
$config['rrd']['enable'] = $_POST['rrdenable'] ? true : false; $config['rrd']['enable'] = !empty($pconfig['rrdenable']);
write_config(); write_config();
...@@ -213,8 +185,6 @@ if ($_POST['resetlogs'] == 'Reset Log Files') { ...@@ -213,8 +185,6 @@ if ($_POST['resetlogs'] == 'Reset Log Files') {
$savemsg = get_std_save_message(); $savemsg = get_std_save_message();
if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) { if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
ob_flush();
flush();
log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator.")); log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
mwexec_bg('/usr/local/etc/rc.restart_webgui 2'); mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
$savemsg .= "<br />" . gettext("WebGUI process is restarting."); $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
...@@ -224,8 +194,10 @@ if ($_POST['resetlogs'] == 'Reset Log Files') { ...@@ -224,8 +194,10 @@ if ($_POST['resetlogs'] == 'Reset Log Files') {
enable_rrd_graphing(); enable_rrd_graphing();
setup_gateways_monitor(); setup_gateways_monitor();
} }
}
} }
legacy_html_escape_form_data($pconfig);
$pgtitle = array(gettext('System'), gettext('Settings'), gettext('Log Files')); $pgtitle = array(gettext('System'), gettext('Settings'), gettext('Log Files'));
$closehead = false; $closehead = false;
include("head.inc"); include("head.inc");
...@@ -233,6 +205,7 @@ include("head.inc"); ...@@ -233,6 +205,7 @@ include("head.inc");
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
function enable_change(enable_over) { function enable_change(enable_over) {
...@@ -294,129 +267,202 @@ function check_everything() { ...@@ -294,129 +267,202 @@ function check_everything() {
document.iform.system.disabled = 0; document.iform.system.disabled = 0;
} }
} }
$(document).ready(function() {
enable_change(false);
// messagebox, flush all rrd graphs
$("#ResetRRD").click(function(event){
event.preventDefault();
BootstrapDialog.show({
type:BootstrapDialog.TYPE_INFO,
title: "<?= gettext("Syslog");?>",
message: "<?=gettext('Do you really want to reset the RRD graphs? This will erase all graph data.');?>",
buttons: [{
label: "<?= gettext("No");?>",
action: function(dialogRef) {
dialogRef.close();
}}, {
label: "<?= gettext("Yes");?>",
action: function(dialogRef) {
$("#action").val("ResetRRD");
$("#iform").submit()
}
}]
});
});
// messagebox, flush all log files
$("#resetlogs").click(function(event){
event.preventDefault();
BootstrapDialog.show({
type:BootstrapDialog.TYPE_INFO,
title: "<?= gettext("Syslog");?>",
message: "<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>",
buttons: [{
label: "<?= gettext("No");?>",
action: function(dialogRef) {
dialogRef.close();
}}, {
label: "<?= gettext("Yes");?>",
action: function(dialogRef) {
$("#action").val("resetlogs");
$("#iform").submit()
}
}]
});
});
});
//]]> //]]>
</script> </script>
</head> </head>
<body> <body>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> if (isset($input_errors) && count($input_errors) > 0) {
<?php if (isset($savemsg)) print_info_box($savemsg); ?> print_input_errors($input_errors);
}
if (isset($savemsg)) {
print_info_box($savemsg);
}
?>
<section class="col-xs-12"> <section class="col-xs-12">
<form action="diag_logs_settings.php" method="post" name="iform" id="iform"> <form action="diag_logs_settings.php" method="post" name="iform" id="iform">
<input type="hidden" id="action" name="action" value="" />
<div class="tab-content content-box col-xs-12 __mb"> <div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext('Reporting Database Options');?></strong></td> <td colspan="2"><strong><?=gettext('Reporting Database Options');?></strong></td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vtable"><?=gettext("Round-Robin-Database");?></td> <td width="22%"><i class="fa fa-info-circle text-muted"></i> <?=gettext("Round-Robin-Database");?></td>
<td width="78%" class="vtable"> <td>
<label> <input name="rrdenable" type="checkbox" id="rrdenable" value="yes" <?=!empty($pconfig['rrdenable']) ? "checked=\"checked\"" : ""?> onclick="enable_change(false)" />
<input name="rrdenable" type="checkbox" id="rrdenable" value="yes" <?php if ($pconfig['rrdenable']) echo "checked=\"checked\"" ?> onclick="enable_change(false)" /> &nbsp;<strong><?=gettext("Enables the RRD graphing backend.");?></strong>
&nbsp;<?=gettext("Enables the RRD graphing backend.");?>
</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top">&nbsp;</td> <td>&nbsp;</td>
<td width="78%"> <td>
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" /> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
<input name="ResetRRD" type="submit" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" onclick="return confirm('<?=gettext('Do you really want to reset the RRD graphs? This will erase all graph data.');?>')" /> <input type="button" name="ResetRRD" id="ResetRRD" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" />
</td> </td>
</tr> </tr>
</table> <tr>
</div> <td colspan="2">
<div class="container-fluid"> <p>
<p><strong><span class="text-danger"><?=gettext("Note:");?></span></strong><br /> <strong><span class="text-danger"><?=gettext("Note:");?></span></strong><br />
<?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please " . <?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please " .
"take this into account after changing the style.");?> "take this into account after changing the style.");?>
</p> </p>
</td>
</tr>
</table>
</div> </div>
</div> </div>
<div class="tab-content content-box col-xs-12 __mb"> <div class="tab-content content-box col-xs-12 __mb">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext("Local Logging Options");?></strong></td> <td width="22%"><strong><?=gettext("Local Logging Options");?></strong></td>
<td width="78%" align="right">
<small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
</td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vtable"><?=gettext('Forward/Reverse Display') ?></td> <td><a id="help_for_reverse" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Reverse Display') ?></td>
<td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked=\"checked\""; ?> /> <td>
<strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong></td> <input name="reverse" type="checkbox" id="reverse" value="yes" <?=!empty($pconfig['reverse']) ? "checked=\"checked\"" : ""; ?> />
<div class="hidden" for="help_for_reverse">
<?=gettext("Show log entries in reverse order (newest entries on top)");?>
</div>
</td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vtable"><?=gettext('GUI Log Entries to Display') ?></td> <td><a id="help_for_nentries" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('GUI Log Entries to Display') ?></td>
<td width="78%" class="vtable"> <td>
<input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>" /><br /> <input name="nentries" type="text" value="<?=$pconfig['nentries'];?>" /><br />
<?=gettext("Hint: This is only the number of log entries displayed in the GUI. It does not affect how many entries are contained in the actual log files.") ?></td> <div class="hidden" for="help_for_nentries">
<?=gettext("Hint: This is only the number of log entries displayed in the GUI. It does not affect how many entries are contained in the actual log files.") ?>
</div>
</td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vtable"><?=gettext('Log File Size (Bytes)') ?></td> <td><a id="help_for_logfilesize" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Log File Size (Bytes)') ?></td>
<td width="78%" class="vtable"> <td>
<input name="logfilesize" id="logfilesize" type="text" class="formfld unknown" size="8" value="<?=htmlspecialchars($pconfig['logfilesize']);?>" /><br /> <input name="logfilesize" type="text" value="<?=$pconfig['logfilesize'];?>" />
<div class="hidden" for="help_for_logfilesize">
<?=gettext("Logs are held in constant-size circular log files. This field controls how large each log file is, and thus how many entries may exist inside the log. By default this is approximately 500KB per log file, and there are nearly 20 such log files.") ?> <?=gettext("Logs are held in constant-size circular log files. This field controls how large each log file is, and thus how many entries may exist inside the log. By default this is approximately 500KB per log file, and there are nearly 20 such log files.") ?>
<br /><br /> <br /><br />
<?=gettext("NOTE: Log sizes are changed the next time a log file is cleared or deleted. To immediately increase the size of the log files, you must first save the options to set the size, then clear all logs using the \"Reset Log Files\" option farther down this page. "); ?> <?=gettext("NOTE: Log sizes are changed the next time a log file is cleared or deleted. To immediately increase the size of the log files, you must first save the options to set the size, then clear all logs using the \"Reset Log Files\" option farther down this page. "); ?>
<?=gettext("Be aware that increasing this value increases every log file size, so disk usage will increase significantly."); ?> <?=gettext("Be aware that increasing this value increases every log file size, so disk usage will increase significantly."); ?>
<?=gettext("Disk space currently used by log files: ") ?><?= exec("/usr/bin/du -sh /var/log | /usr/bin/awk '{print $1;}'"); ?>. <?=gettext("Disk space currently used by log files: ") ?><?= exec("/usr/bin/du -sh /var/log | /usr/bin/awk '{print $1;}'"); ?>.
<?=gettext("Remaining disk space for log files: ") ?><?= exec("/bin/df -h /var/log | /usr/bin/awk '{print $4;}'"); ?>. <?=gettext("Remaining disk space for log files: ") ?><?= exec("/bin/df -h /var/log | /usr/bin/awk '{print $4;}'"); ?>.
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td valign="top" class="vtable"><?=gettext('Log Firewall Default Blocks') ?></td> <td><a id="help_for_logdefaultblock" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Log Firewall Default Blocks') ?></td>
<td class="vtable"> <td>
<input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked=\"checked\""; ?> /> <input name="logdefaultblock" type="checkbox" value="yes" <?=!empty($pconfig['logdefaultblock']) ? "checked=\"checked\"" : ""; ?> />
<strong><?=gettext("Log packets matched from the default block rules put in the ruleset");?></strong><br /> <strong><?=gettext("Log packets matched from the default block rules put in the ruleset");?></strong><br />
<div class="hidden" for="help_for_logdefaultblock">
<?=gettext("Hint: packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.");?> <?=gettext("Hint: packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.");?>
<br /> </div>
<input name="logdefaultpass" type="checkbox" id="logdefaultpass" value="yes" <?php if ($pconfig['logdefaultpass']) echo "checked=\"checked\""; ?> /> <input name="logdefaultpass" type="checkbox" id="logdefaultpass" value="yes" <?=!empty($pconfig['logdefaultpass']) ? "checked=\"checked\"" :""; ?> />
<strong><?=gettext("Log packets matched from the default pass rules put in the ruleset");?></strong><br /> <strong><?=gettext("Log packets matched from the default pass rules put in the ruleset");?></strong><br />
<div class="hidden" for="help_for_logdefaultblock">
<?=gettext("Hint: packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected.");?> <?=gettext("Hint: packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected.");?>
<br /> </div>
<input name="logbogons" type="checkbox" id="logbogons" value="yes" <?php if ($pconfig['logbogons']) echo "checked=\"checked\""; ?> /> <input name="logbogons" type="checkbox" id="logbogons" value="yes" <?=!empty($pconfig['logbogons']) ? "checked=\"checked\"" : ""; ?> />
<strong><?=gettext("Log packets blocked by 'Block Bogon Networks' rules");?></strong><br /> <strong><?=gettext("Log packets blocked by 'Block Bogon Networks' rules");?></strong><br />
<br />
<input name="logprivatenets" type="checkbox" id="logprivatenets" value="yes" <?php if ($pconfig['logprivatenets']) echo "checked=\"checked\""; ?> /> <input name="logprivatenets" type="checkbox" id="logprivatenets" value="yes" <?php if ($pconfig['logprivatenets']) echo "checked=\"checked\""; ?> />
<strong><?=gettext("Log packets blocked by 'Block Private Networks' rules");?></strong><br /> <strong><?=gettext("Log packets blocked by 'Block Private Networks' rules");?></strong><br />
</td> </td>
</tr> </tr>
<tr> <tr>
<td valign="top" class="vtable"><?=gettext('Web Server Log') ?></td> <td><a id="help_for_loglighttpd" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Web Server Log') ?></td>
<td class="vtable"> <input name="loglighttpd" type="checkbox" id="loglighttpd" value="yes" <?php if ($pconfig['loglighttpd']) echo "checked=\"checked\""; ?> /> <td>
<input name="loglighttpd" type="checkbox" id="loglighttpd" value="yes" <?=!empty($pconfig['loglighttpd']) ? "checked=\"checked\"" :""; ?> />
<strong><?=gettext("Log errors from the web server process.");?></strong><br /> <strong><?=gettext("Log errors from the web server process.");?></strong><br />
<div class="hidden" for="help_for_loglighttpd">
<?=gettext("Hint: If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the main system log.");?></td> <?=gettext("Hint: If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the main system log.");?></td>
</div>
</tr> </tr>
<tr> <tr>
<td valign="top" class="vtable"><?=gettext('Filter descriptions') ?></td> <td><a id="help_for_filterdescriptions" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Filter descriptions') ?></td>
<td class="vtable"> <td>
<select name="filterdescriptions" id="filterdescriptions" class="form-control"> <select name="filterdescriptions" id="filterdescriptions" class="form-control">
<option value="0"<?=!isset($pconfig['filterdescriptions'])?" selected=\"selected\"":""?>><?=gettext('Omit descriptions') ?></option> <option value="0"<?=!isset($pconfig['filterdescriptions'])?" selected=\"selected\"":""?>><?=gettext('Omit descriptions') ?></option>
<option value="1"<?=($pconfig['filterdescriptions'])==="1"?" selected=\"selected\"":""?>><?=gettext('Display as column') ?></option> <option value="1"<?=($pconfig['filterdescriptions'])==="1"?" selected=\"selected\"":""?>><?=gettext('Display as column') ?></option>
<option value="2"<?=($pconfig['filterdescriptions'])==="2"?" selected=\"selected\"":""?>><?=gettext('Display as second row') ?></option> <option value="2"<?=($pconfig['filterdescriptions'])==="2"?" selected=\"selected\"":""?>><?=gettext('Display as second row') ?></option>
</select> </select>
<div class="hidden" for="help_for_filterdescriptions">
<strong><?=gettext("Show the applied rule description below or in the firewall log rows.");?></strong> <strong><?=gettext("Show the applied rule description below or in the firewall log rows.");?></strong>
<br /> <br />
<?=gettext("Displaying rule descriptions for all lines in the log might affect performance with large rule sets.");?> <?=gettext("Displaying rule descriptions for all lines in the log might affect performance with large rule sets.");?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vtable"><?=gettext('Local Logging') ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext('Local Logging') ?></td>
<td width="78%" class="vtable"> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" /> <td> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?=!empty($pconfig['disablelocallogging']) ? "checked=\"checked\"" :""; ?> onclick="enable_change(false)" />
<strong><?=gettext("Disable writing log files to the local disk");?></strong></td> <strong><?=gettext("Disable writing log files to the local disk");?></strong></td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top"><?=gettext('Reset Logs') ?></td> <td><a id="help_for_resetlogs" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Reset Logs') ?></td>
<td width="78%"> <td>
<input name="resetlogs" type="submit" class="btn btn-default" value="<?=gettext("Reset Log Files"); ?>" onclick="return confirm('<?=gettext('Do you really want to reset the log files? This will erase all local log data.');?>')" /> <input name="resetlogs" id="resetlogs" type="submit" class="btn btn-default" value="<?=gettext("Reset Log Files"); ?>"/>
<br/><br/> <div class="hidden" for="help_for_resetlogs">
<?= gettext("Note: Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes."); ?> <?= gettext("Note: Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes."); ?>
</div>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -427,51 +473,56 @@ function check_everything() { ...@@ -427,51 +473,56 @@ function check_everything() {
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<td colspan="2" valign="top" class="listtopic"><strong><?=gettext("Remote Logging Options");?></strong></td> <td width="22%"><strong><?=gettext("Remote Logging Options");?></strong></td>
<td width="78%" align="right">
<small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
</td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Source Address"); ?></td> <td><a id="help_for_sourceip" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Source Address"); ?></td>
<td width="78%" class="vtable"> <td>
<select name="sourceip" class="form-control"> <select name="sourceip" class="form-control">
<option value=""><?=gettext('Default (any)') ?></option> <option value=""><?=gettext('Default (any)') ?></option>
<?php $sourceips = get_possible_traffic_source_addresses(false); <?php
foreach ($sourceips as $sip): foreach (get_possible_traffic_source_addresses(false) as $sip):?>
$selected = ""; <option value="<?=$sip['value'];?>" <?=!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']) ? "selected=\"selected\"" : "";?>>
if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']))
$selected = 'selected="selected"';
?>
<option value="<?=$sip['value'];?>" <?=$selected;?>>
<?=htmlspecialchars($sip['name']);?> <?=htmlspecialchars($sip['name']);?>
</option> </option>
<?php endforeach; ?> <?php
endforeach; ?>
</select> </select>
<br /> <div class="hidden" for="help_for_sourceip">
<?= gettext("This option will allow the logging daemon to bind to a single IP address, rather than all IP addresses."); ?> <?= gettext("This option will allow the logging daemon to bind to a single IP address, rather than all IP addresses."); ?>
<?= gettext("If you pick a single IP, remote syslog severs must all be of that IP type. If you wish to mix IPv4 and IPv6 remote syslog servers, you must bind to all interfaces."); ?> <?= gettext("If you pick a single IP, remote syslog severs must all be of that IP type. If you wish to mix IPv4 and IPv6 remote syslog servers, you must bind to all interfaces."); ?>
<br /><br /> <br /><br />
<?= gettext("NOTE: If an IP address cannot be located on the chosen interface, the daemon will bind to all addresses."); ?> <?= gettext("NOTE: If an IP address cannot be located on the chosen interface, the daemon will bind to all addresses."); ?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IP Protocol"); ?></td> <td><a id="help_for_ipproto" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IP Protocol"); ?></td>
<td width="78%" class="vtable"> <td>
<select name="ipproto" class="form-control"> <select name="ipproto" class="form-control">
<option value="ipv4" <?php if ($ipproto == "ipv4") echo 'selected="selected"' ?>>IPv4</option> <option value="ipv4" <?=$ipproto == "ipv4" ? 'selected="selected"' : "";?>><?=gettext("IPv4");?></option>
<option value="ipv6" <?php if ($ipproto == "ipv6") echo 'selected="selected"' ?>>IPv6</option> <option value="ipv6" <?=$ipproto == "ipv6" ? 'selected="selected"' : "";?>><?=gettext("IPv6");?></option>
</select> </select>
<br /> <div class="hidden" for="help_for_ipproto">
<?= gettext("This option is only used when a non-default address is chosen as the source above. This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried."); ?> <?= gettext("This option is only used when a non-default address is chosen as the source above. This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried."); ?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Enable Remote Logging");?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Enable Remote Logging");?></td>
<td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" /> <td>
<strong><?=gettext("Send log messages to remote syslog server");?></strong></td> <input name="enable" type="checkbox" id="enable" value="yes" <?= !empty($pconfig['enable']) ? "checked=\"checked\"" :""; ?> onclick="enable_change(false)" />
<strong><?=gettext("Send log messages to remote syslog server");?></strong>
</td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Remote Syslog Servers");?></td> <td><a id="help_for_remoteserver" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Remote Syslog Servers");?></td>
<td width="78%" class="vtable"> <td>
<table summary="remtote syslog servers"> <table class="table table-condensed">
<tr> <tr>
<td><?=gettext("Server") . " 1";?></td> <td><?=gettext("Server") . " 1";?></td>
<td><input name="remoteserver" id="remoteserver" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" /></td> <td><input name="remoteserver" id="remoteserver" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" /></td>
...@@ -484,44 +535,42 @@ function check_everything() { ...@@ -484,44 +535,42 @@ function check_everything() {
<td><?=gettext("Server") . " 3";?></td> <td><?=gettext("Server") . " 3";?></td>
<td><input name="remoteserver3" id="remoteserver3" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>" /></td> <td><input name="remoteserver3" id="remoteserver3" type="text" class="form-control host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>" /></td>
</tr> </tr>
<tr>
<td>&nbsp;</td>
<td><?=gettext("IP addresses of remote syslog servers, or an IP:port.");?></td>
</tr>
</table> </table>
<div class="hidden" for="help_for_remoteserver">
<?=gettext("IP addresses of remote syslog servers, or an IP:port.");?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Remote Syslog Contents");?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Remote Syslog Contents");?></td>
<td width="78%" class="vtable"> <td>
<input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked=\"checked\""; ?> onclick="check_everything();" /> <input name="logall" id="logall" type="checkbox" value="yes" <?=!empty($pconfig['logall']) ? "checked=\"checked\"" : ""; ?> onclick="check_everything();" />
<?=gettext("Everything");?><br /><br /> <?=gettext("Everything");?><br /><br />
<input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked=\"checked\""; ?> /> <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?=!empty($pconfig['system']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("System events");?><br /> <?=gettext("System events");?><br />
<input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked=\"checked\""; ?> /> <input name="filter" id="filter" type="checkbox" value="yes" <?=!empty($pconfig['filter']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("Firewall events");?><br /> <?=gettext("Firewall events");?><br />
<input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked=\"checked\""; ?> /> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?=!empty($pconfig['dhcp']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("DHCP service events");?><br /> <?=gettext("DHCP service events");?><br />
<input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked=\"checked\""; ?> /> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?=!empty($pconfig['portalauth']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("Portal Auth events");?><br /> <?=gettext("Portal Auth events");?><br />
<input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked=\"checked\""; ?> /> <input name="vpn" id="vpn" type="checkbox" value="yes" <?=!empty($pconfig['vpn']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("VPN (PPTP, IPsec, OpenVPN) events");?><br /> <?=gettext("VPN (PPTP, IPsec, OpenVPN) events");?><br />
<input name="apinger" id="apinger" type="checkbox" value="yes" <?php if ($pconfig['apinger']) echo "checked=\"checked\""; ?> /> <input name="apinger" id="apinger" type="checkbox" value="yes" <?=!empty($pconfig['apinger']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("Gateway Monitor events");?><br /> <?=gettext("Gateway Monitor events");?><br />
<input name="relayd" id="relayd" type="checkbox" value="yes" <?php if ($pconfig['relayd']) echo "checked=\"checked\""; ?> /> <input name="relayd" id="relayd" type="checkbox" value="yes" <?=!empty($pconfig['relayd']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("Server Load Balancer events");?><br /> <?=gettext("Server Load Balancer events");?><br />
<input name="hostapd" id="hostapd" type="checkbox" value="yes" <?php if ($pconfig['hostapd']) echo "checked=\"checked\""; ?> /> <input name="hostapd" id="hostapd" type="checkbox" value="yes" <?=!empty($pconfig['hostapd']) ? "checked=\"checked\"" : ""; ?> />
<?=gettext("Wireless events");?><br /> <?=gettext("Wireless events");?><br />
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top">&nbsp;</td> <td></td>
<td width="78%"> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" /> <td> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" height="53" valign="top">&nbsp;</td> <td colspan="2"><strong><span class="text-danger"><?=gettext("Note:")?></span></strong><br />
<td width="78%"><strong><span class="red"><?=gettext("Note:")?></span></strong><br />
<?=gettext("syslog sends UDP datagrams to port 514 on the specified " . <?=gettext("syslog sends UDP datagrams to port 514 on the specified " .
"remote syslog server, unless another port is specified. Be sure to set syslogd on the " . "remote syslog server, unless another port is specified. Be sure to set syslogd on the " .
"remote server to accept syslog messages from");?> <?=$g['product_name']?>. "remote server to accept syslog messages from");?> <?=$g['product_name']?>.
...@@ -535,9 +584,4 @@ function check_everything() { ...@@ -535,9 +584,4 @@ function check_everything() {
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript">
//<![CDATA[
enable_change(false);
//]]>
</script>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
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