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