1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
4d875b4f
|
Scott Ullrich
|
<?php
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
diag_logs_settings.php
|
5 |
4d875b4f
|
Scott Ullrich
|
Copyright (C) 2004 Scott Ullrich
|
6 |
|
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
originially part of m0n0wall (http://m0n0.ch/wall)
|
9 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
|
|
All rights reserved.
|
11 |
4d875b4f
|
Scott Ullrich
|
|
12 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
|
modification, are permitted provided that the following conditions are met:
|
14 |
4d875b4f
|
Scott Ullrich
|
|
15 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
this list of conditions and the following disclaimer.
|
17 |
4d875b4f
|
Scott Ullrich
|
|
18 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
19 |
|
|
notice, this list of conditions and the following disclaimer in the
|
20 |
|
|
documentation and/or other materials provided with the distribution.
|
21 |
4d875b4f
|
Scott Ullrich
|
|
22 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
require("guiconfig.inc");
|
35 |
|
|
|
36 |
|
|
$pconfig['reverse'] = isset($config['syslog']['reverse']);
|
37 |
|
|
$pconfig['nentries'] = $config['syslog']['nentries'];
|
38 |
|
|
$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
|
39 |
|
|
$pconfig['filter'] = isset($config['syslog']['filter']);
|
40 |
|
|
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
|
41 |
3f2b92d2
|
Scott Ullrich
|
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
|
42 |
5b237745
|
Scott Ullrich
|
$pconfig['vpn'] = isset($config['syslog']['vpn']);
|
43 |
|
|
$pconfig['system'] = isset($config['syslog']['system']);
|
44 |
|
|
$pconfig['enable'] = isset($config['syslog']['enable']);
|
45 |
|
|
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
|
46 |
|
|
$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
|
47 |
|
|
|
48 |
|
|
if (!$pconfig['nentries'])
|
49 |
|
|
$pconfig['nentries'] = 50;
|
50 |
|
|
|
51 |
|
|
if ($_POST) {
|
52 |
|
|
|
53 |
|
|
unset($input_errors);
|
54 |
|
|
$pconfig = $_POST;
|
55 |
|
|
|
56 |
|
|
/* input validation */
|
57 |
|
|
if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
|
58 |
|
|
$input_errors[] = "A valid IP address must be specified.";
|
59 |
|
|
}
|
60 |
|
|
if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 1000)) {
|
61 |
|
|
$input_errors[] = "Number of log entries to show must be between 5 and 1000.";
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
if (!$input_errors) {
|
65 |
|
|
$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
|
66 |
|
|
$config['syslog']['nentries'] = (int)$_POST['nentries'];
|
67 |
|
|
$config['syslog']['remoteserver'] = $_POST['remoteserver'];
|
68 |
|
|
$config['syslog']['filter'] = $_POST['filter'] ? true : false;
|
69 |
|
|
$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
|
70 |
3f2b92d2
|
Scott Ullrich
|
$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
|
71 |
5b237745
|
Scott Ullrich
|
$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
|
72 |
|
|
$config['syslog']['system'] = $_POST['system'] ? true : false;
|
73 |
|
|
$config['syslog']['enable'] = $_POST['enable'] ? true : false;
|
74 |
|
|
$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
|
75 |
|
|
$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
|
76 |
|
|
$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
|
77 |
4d875b4f
|
Scott Ullrich
|
|
78 |
5b237745
|
Scott Ullrich
|
write_config();
|
79 |
4d875b4f
|
Scott Ullrich
|
|
80 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
81 |
|
|
if (!file_exists($d_sysrebootreqd_path)) {
|
82 |
|
|
config_lock();
|
83 |
|
|
$retval = system_syslogd_start();
|
84 |
|
|
if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
|
85 |
|
|
$retval |= filter_configure();
|
86 |
|
|
config_unlock();
|
87 |
|
|
}
|
88 |
4d875b4f
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
89 |
5b237745
|
Scott Ullrich
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
?>
|
93 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
94 |
|
|
<html>
|
95 |
|
|
<head>
|
96 |
|
|
<title><?=gentitle("Diagnostics: System logs");?></title>
|
97 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
98 |
|
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
99 |
|
|
<script language="JavaScript">
|
100 |
|
|
<!--
|
101 |
|
|
function enable_change(enable_over) {
|
102 |
|
|
if (document.iform.enable.checked || enable_over) {
|
103 |
|
|
document.iform.remoteserver.disabled = 0;
|
104 |
|
|
document.iform.filter.disabled = 0;
|
105 |
|
|
document.iform.dhcp.disabled = 0;
|
106 |
3f2b92d2
|
Scott Ullrich
|
document.iform.portalauth.disabled = 0;
|
107 |
5b237745
|
Scott Ullrich
|
document.iform.vpn.disabled = 0;
|
108 |
|
|
document.iform.system.disabled = 0;
|
109 |
|
|
} else {
|
110 |
|
|
document.iform.remoteserver.disabled = 1;
|
111 |
|
|
document.iform.filter.disabled = 1;
|
112 |
|
|
document.iform.dhcp.disabled = 1;
|
113 |
3f2b92d2
|
Scott Ullrich
|
document.iform.portalauth.disabled = 1;
|
114 |
5b237745
|
Scott Ullrich
|
document.iform.vpn.disabled = 1;
|
115 |
|
|
document.iform.system.disabled = 1;
|
116 |
|
|
}
|
117 |
|
|
}
|
118 |
|
|
// -->
|
119 |
|
|
</script>
|
120 |
|
|
</head>
|
121 |
|
|
|
122 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
123 |
|
|
<?php include("fbegin.inc"); ?>
|
124 |
|
|
<p class="pgtitle">Diagnostics: System logs</p>
|
125 |
|
|
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
|
126 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
127 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
128 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
129 |
|
|
<tr><td>
|
130 |
|
|
<ul id="tabnav">
|
131 |
|
|
<li class="tabinact"><a href="diag_logs.php">System</a></li>
|
132 |
9a4bda51
|
Scott Ullrich
|
<li class="tabinact"><a href="diag_logs_ipsec.php">IPSEC Vpn</a></li>
|
133 |
5b237745
|
Scott Ullrich
|
<li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
|
134 |
|
|
<li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
|
135 |
3f2b92d2
|
Scott Ullrich
|
<li class="tabinact"><a href="diag_logs_auth.php">Portal Auth</a></li>
|
136 |
5b237745
|
Scott Ullrich
|
<li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
|
137 |
|
|
<li class="tabact">Settings</li>
|
138 |
|
|
</ul>
|
139 |
|
|
</td></tr>
|
140 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
141 |
5b237745
|
Scott Ullrich
|
<td class="tabcont">
|
142 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
143 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
144 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
145 |
|
|
<td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
|
146 |
4d875b4f
|
Scott Ullrich
|
<strong>Show log entries in reverse order (newest entries
|
147 |
5b237745
|
Scott Ullrich
|
on top)</strong></td>
|
148 |
|
|
</tr>
|
149 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
150 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
151 |
4d875b4f
|
Scott Ullrich
|
<td width="78%" class="vtable">Number of log entries to
|
152 |
|
|
show:
|
153 |
5b237745
|
Scott Ullrich
|
<input name="nentries" id="nentries" type="text" class="formfld" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
|
154 |
|
|
</tr>
|
155 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
156 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vtable"> </td>
|
157 |
|
|
<td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
|
158 |
|
|
<strong>Log packets blocked by the default rule</strong><br>
|
159 |
4d875b4f
|
Scott Ullrich
|
Hint: packets that are blocked by the
|
160 |
|
|
implicit default block rule will not be logged anymore
|
161 |
5b237745
|
Scott Ullrich
|
if you uncheck this option. Per-rule logging options are not affected.</td>
|
162 |
|
|
</tr>
|
163 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
164 |
5b237745
|
Scott Ullrich
|
<td valign="top" class="vtable"> </td>
|
165 |
|
|
<td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
|
166 |
|
|
<strong>Show raw filter logs</strong><br>
|
167 |
|
|
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>
|
168 |
|
|
</tr>
|
169 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
170 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
171 |
|
|
<td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
172 |
|
|
<strong>Enable syslog'ing to remote syslog server</strong></td>
|
173 |
|
|
</tr>
|
174 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
175 |
|
|
<td width="22%" valign="top" class="vncell">Remote syslog
|
176 |
5b237745
|
Scott Ullrich
|
server</td>
|
177 |
4d875b4f
|
Scott Ullrich
|
<td width="78%" class="vtable"> <input name="remoteserver" id="remoteserver" type="text" class="formfld" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
|
178 |
5b237745
|
Scott Ullrich
|
<br>
|
179 |
|
|
IP address of remote syslog server<br> <br> <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
|
180 |
|
|
system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
|
181 |
|
|
firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
|
182 |
3f2b92d2
|
Scott Ullrich
|
DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
|
183 |
|
|
Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
|
184 |
5b237745
|
Scott Ullrich
|
PPTP VPN events</td>
|
185 |
|
|
</tr>
|
186 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
187 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
188 |
4d875b4f
|
Scott Ullrich
|
<td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
|
189 |
5b237745
|
Scott Ullrich
|
</td>
|
190 |
|
|
</tr>
|
191 |
4d875b4f
|
Scott Ullrich
|
<tr>
|
192 |
5b237745
|
Scott Ullrich
|
<td width="22%" height="53" valign="top"> </td>
|
193 |
|
|
<td width="78%"><strong><span class="red">Note:</span></strong><br>
|
194 |
4d875b4f
|
Scott Ullrich
|
syslog sends UDP datagrams to port 514 on the specified
|
195 |
|
|
remote syslog server. Be sure to set syslogd on the
|
196 |
6b2e9ec2
|
Scott Ullrich
|
remote server to accept syslog messages from pfSense.
|
197 |
5b237745
|
Scott Ullrich
|
</td>
|
198 |
|
|
</tr>
|
199 |
|
|
</table>
|
200 |
|
|
</td>
|
201 |
|
|
</tr>
|
202 |
|
|
</table>
|
203 |
|
|
</form>
|
204 |
|
|
<script language="JavaScript">
|
205 |
|
|
<!--
|
206 |
|
|
enable_change(false);
|
207 |
|
|
//-->
|
208 |
|
|
</script>
|
209 |
|
|
<?php include("fend.inc"); ?>
|
210 |
|
|
</body>
|
211 |
|
|
</html>
|