summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_logs_settings.php
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www/diag_logs_settings.php')
-rwxr-xr-xusr/local/www/diag_logs_settings.php244
1 files changed, 125 insertions, 119 deletions
diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php
index 44a682c..be34612 100755
--- a/usr/local/www/diag_logs_settings.php
+++ b/usr/local/www/diag_logs_settings.php
@@ -31,7 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-/*
+/*
pfSense_MODULE: system
*/
@@ -69,23 +69,27 @@ $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']
if (!$pconfig['nentries'])
$pconfig['nentries'] = 50;
+function is_valid_syslog_server($target) {
+ return (is_ipaddr($target)
+ || is_ipaddrwithport($target)
+ || is_hostname($target)
+ || is_hostnamewithport($target));
+}
+
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
/* input validation */
- if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
- $input_errors[] = gettext("A valid IP address must be specified for remote syslog server #1.");
- }
- if ($_POST['enable'] && $_POST['remoteserver2'] && !is_ipaddr($_POST['remoteserver2'])) {
- $input_errors[] = gettext("A valid IP address must be specified for remote syslog server #2.");
+ if ($_POST['enable'] && !is_valid_syslog_server($_POST['remoteserver'])) {
+ $input_errors[] = gettext("A valid IP address/hosname or IP/hostname:port must be specified for remote syslog server #1.");
}
- if ($_POST['enable'] && $_POST['remoteserver3'] && !is_ipaddr($_POST['remoteserver3'])) {
- $input_errors[] = gettext("A valid IP address must be specified for remote syslog server #3.");
+ if ($_POST['enable'] && $_POST['remoteserver2'] && !is_valid_syslog_server($_POST['remoteserver2'])) {
+ $input_errors[] = gettext("A valid IP address/hosname or IP/hostname:port must be specified for remote syslog server #2.");
}
- if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
- $input_errors[] = gettext("A valid IP address must be specified.");
+ if ($_POST['enable'] && $_POST['remoteserver3'] && !is_valid_syslog_server($_POST['remoteserver3'])) {
+ $input_errors[] = gettext("A valid IP address/hosname or IP/hostname:port must be specified for remote syslog server #3.");
}
if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
@@ -105,7 +109,7 @@ if ($_POST) {
$config['syslog']['apinger'] = $_POST['apinger'] ? true : false;
$config['syslog']['relayd'] = $_POST['relayd'] ? true : false;
$config['syslog']['hostapd'] = $_POST['hostapd'] ? true : false;
- $config['syslog']['logall'] = $_POST['logall'] ? true : false;
+ $config['syslog']['logall'] = $_POST['logall'] ? true : false;
$config['syslog']['system'] = $_POST['system'] ? true : false;
$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
$config['syslog']['enable'] = $_POST['enable'] ? true : false;
@@ -204,7 +208,7 @@ function check_everything() {
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr><td>
+<tr><td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("System"), false, "diag_logs.php");
@@ -221,118 +225,120 @@ function check_everything() {
$tab_array[] = array(gettext("Settings"), true, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr>
- <td>
+</td></tr>
+<tr>
+ <td>
<div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("General Logging Options");?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">Forward/Reverse Display</td>
+ <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
<strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"><?=gettext("Number of log entries to show:")?>
- <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
- </tr>
- <tr>
- <td valign="top" class="vtable">&nbsp;</td>
- <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">GUI Log Entries to Display</td>
+ <td width="78%" class="vtable">
+ <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($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>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">Log Firewall Default Blocks</td>
+ <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
<strong><?=gettext("Log packets blocked by the default rule");?></strong><br>
- <?=gettext("Hint: packets that are blocked by the " .
- "implicit default block rule will not be logged anymore " .
- "if you uncheck this option. Per-rule logging options are not affected.");?></td>
- </tr>
- <tr>
- <td valign="top" class="vtable">&nbsp;</td>
- <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
+ <?=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.");?></td>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">Raw Logs</td>
+ <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
<strong><?=gettext("Show raw filter logs");?></strong><br>
- <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information.");?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onClick="enable_change(false)">
- <strong><?=gettext("Disable writing log files to the local RAM disk");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
- <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Remote syslog servers");?></td>
- <td width="78%" class="vtable">
- <table>
- <tr>
- <td>
- <?=gettext("Server") . " 1";?>
- </td>
- <td>
- <input name="remoteserver" id="remoteserver" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
- </td>
- </tr>
- <tr>
- <td>
- <?=gettext("Server") . " 2";?>
- </td>
- <td>
- <input name="remoteserver2" id="remoteserver2" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver2']);?>">
- </td>
- </tr>
- <tr>
- <td>
- <?=gettext("Server") . " 3";?>
- </td>
- <td>
- <input name="remoteserver3" id="remoteserver3" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>">
- </td>
- </tr>
- <tr>
- <td>
- &nbsp;
- </td>
- <td>
- <?=gettext("IP addresses of remote syslog servers");?>
- </td>
- </table>
- <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
- <?=gettext("System events");?><br>
- <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
- <?=gettext("Firewall events");?><br>
- <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
- <?=gettext("DHCP service events");?><br>
- <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
- <?=gettext("Portal Auth events");?><br>
- <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
- <?=gettext("VPN (PPTP, IPsec, OpenVPN) events");?><br>
- <input name="apinger" id="apinger" type="checkbox" value="yes" <?php if ($pconfig['apinger']) echo "checked"; ?>>
- <?=gettext("Gateway Monitor events");?><br>
- <input name="relayd" id="relayd" type="checkbox" value="yes" <?php if ($pconfig['relayd']) echo "checked"; ?>>
- <?=gettext("Server Load Balancer events");?><br>
- <input name="hostapd" id="hostapd" type="checkbox" value="yes" <?php if ($pconfig['hostapd']) echo "checked"; ?>>
- <?=gettext("Wireless events");?><br>
- <br> <input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked"; ?> onclick="check_everything();">
- <?=gettext("Everything");?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)">
- </td>
- </tr>
- <tr>
- <td width="22%" height="53" valign="top">&nbsp;</td>
- <td width="78%"><strong><span class="red"><?=gettext("Note:")?></span></strong><br>
- <?=gettext("syslog sends UDP datagrams to port 514 on the specified " .
- "remote syslog server. Be sure to set syslogd on the " .
- "remote server to accept syslog messages from");?> <?=$g['product_name']?>.
- </td>
- </tr>
- </table>
+ <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information, but it is more difficult to read.");?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">Local Logging</td>
+ <td width="78%" class="vtable"> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onClick="enable_change(false)">
+ <?php if ($g['platform'] == "pfSense"): ?>
+ <strong><?=gettext("Disable writing log files to the local disk");?></strong></td>
+ <?php else: ?>
+ <strong><?=gettext("Disable writing log files to the local RAM disk");?></strong></td>
+ <?php endif; ?>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top">&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Remote Logging Options");?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=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"; ?> onClick="enable_change(false)">
+ <strong><?=gettext("Send log messages to remote syslog server");?></strong></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Remote Syslog Servers");?></td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td><?=gettext("Server") . " 1";?></td>
+ <td><input name="remoteserver" id="remoteserver" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>"></td>
+ </tr>
+ <tr>
+ <td><?=gettext("Server") . " 2";?></td>
+ <td><input name="remoteserver2" id="remoteserver2" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver2']);?>"></td>
+ </tr>
+ <tr>
+ <td><?=gettext("Server") . " 3";?></td>
+ <td><input name="remoteserver3" id="remoteserver3" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>"></td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td><?=gettext("IP addresses of remote syslog servers, or an IP:port.");?></td>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Remote Syslog Contents");?></td>
+ <td width="78%" class="vtable">
+ <input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked"; ?> onclick="check_everything();">
+ <?=gettext("Everything");?><br/><br/>
+ <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
+ <?=gettext("System events");?><br/>
+ <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
+ <?=gettext("Firewall events");?><br/>
+ <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
+ <?=gettext("DHCP service events");?><br/>
+ <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
+ <?=gettext("Portal Auth events");?><br/>
+ <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
+ <?=gettext("VPN (PPTP, IPsec, OpenVPN) events");?><br/>
+ <input name="apinger" id="apinger" type="checkbox" value="yes" <?php if ($pconfig['apinger']) echo "checked"; ?>>
+ <?=gettext("Gateway Monitor events");?><br/>
+ <input name="relayd" id="relayd" type="checkbox" value="yes" <?php if ($pconfig['relayd']) echo "checked"; ?>>
+ <?=gettext("Server Load Balancer events");?><br/>
+ <input name="hostapd" id="hostapd" type="checkbox" value="yes" <?php if ($pconfig['hostapd']) echo "checked"; ?>>
+ <?=gettext("Wireless events");?><br/>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)">
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" height="53" valign="top">&nbsp;</td>
+ <td width="78%"><strong><span class="red"><?=gettext("Note:")?></span></strong><br>
+ <?=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 server to accept syslog messages from");?> <?=$g['product_name']?>.
+ </td>
+ </tr>
+ </table>
</div>
- </td>
- </tr>
+</td></tr>
</table>
</form>
<script language="JavaScript">
OpenPOWER on IntegriCloud