Project

General

Profile

Download (13.3 KB) Statistics
| Branch: | Tag: | Revision:
1 4d875b4f Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	diag_logs_settings.php
5 13d193c2 Scott Ullrich
	Copyright (C) 2004-2009 Scott Ullrich
6 4d875b4f Scott Ullrich
	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 13d193c2 Scott Ullrich
/*	
35
	pfSense_MODULE:	system
36
*/
37
38 6b07c15a Matthew Grooms
##|+PRIV
39
##|*IDENT=page-diagnostics-logs-settings
40
##|*NAME=Diagnostics: Logs: Settings page
41
##|*DESCR=Allow access to the 'Diagnostics: Logs: Settings' page.
42
##|*MATCH=diag_logs_settings.php*
43
##|-PRIV
44
45 5b237745 Scott Ullrich
require("guiconfig.inc");
46 7a927e67 Scott Ullrich
require_once("functions.inc");
47
require_once("filter.inc");
48
require_once("shaper.inc");
49 5b237745 Scott Ullrich
50
$pconfig['reverse'] = isset($config['syslog']['reverse']);
51
$pconfig['nentries'] = $config['syslog']['nentries'];
52
$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
53 98301932 Scott Ullrich
$pconfig['remoteserver2'] = $config['syslog']['remoteserver2'];
54 be5d59d7 Scott Ullrich
$pconfig['remoteserver3'] = $config['syslog']['remoteserver3'];
55 5b237745 Scott Ullrich
$pconfig['filter'] = isset($config['syslog']['filter']);
56
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
57 3f2b92d2 Scott Ullrich
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
58 5b237745 Scott Ullrich
$pconfig['vpn'] = isset($config['syslog']['vpn']);
59 4ef2d703 Chris Buechler
$pconfig['logall'] = isset($config['syslog']['logall']);
60 5b237745 Scott Ullrich
$pconfig['system'] = isset($config['syslog']['system']);
61
$pconfig['enable'] = isset($config['syslog']['enable']);
62
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
63
$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
64 af659dda Scott Ullrich
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
65 5b237745 Scott Ullrich
66
if (!$pconfig['nentries'])
67
	$pconfig['nentries'] = 50;
68
69
if ($_POST) {
70
71
	unset($input_errors);
72
	$pconfig = $_POST;
73
74
	/* input validation */
75
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
76 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("A valid IP address must be specified for remote syslog server #1.");
77 5b237745 Scott Ullrich
	}
78 be5d59d7 Scott Ullrich
	if ($_POST['enable'] && $_POST['remoteserver2'] && !is_ipaddr($_POST['remoteserver2'])) {
79 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("A valid IP address must be specified for remote syslog server #2.");
80 be5d59d7 Scott Ullrich
	}
81
	if ($_POST['enable'] && $_POST['remoteserver3'] && !is_ipaddr($_POST['remoteserver3'])) {
82 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("A valid IP address must be specified for remote syslog server #3.");
83 be5d59d7 Scott Ullrich
	}
84
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
85 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("A valid IP address must be specified.");
86 be5d59d7 Scott Ullrich
	}
87
88 102de157 Scott Ullrich
	if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
89 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
90 5b237745 Scott Ullrich
	}
91
92
	if (!$input_errors) {
93
		$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
94
		$config['syslog']['nentries'] = (int)$_POST['nentries'];
95
		$config['syslog']['remoteserver'] = $_POST['remoteserver'];
96 be5d59d7 Scott Ullrich
		$config['syslog']['remoteserver2'] = $_POST['remoteserver2'];
97
		$config['syslog']['remoteserver3'] = $_POST['remoteserver3'];
98 5b237745 Scott Ullrich
		$config['syslog']['filter'] = $_POST['filter'] ? true : false;
99
		$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
100 3f2b92d2 Scott Ullrich
		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
101 5b237745 Scott Ullrich
		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
102 4ef2d703 Chris Buechler
                $config['syslog']['logall'] = $_POST['logall'] ? true : false;
103 5b237745 Scott Ullrich
		$config['syslog']['system'] = $_POST['system'] ? true : false;
104 e1c0c35a Scott Ullrich
		$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
105 5b237745 Scott Ullrich
		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
106
		$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
107
		$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
108
		$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
109 be5d59d7 Scott Ullrich
		if($config['syslog']['enable'] == false) {
110 f3a5f0c5 Scott Ullrich
			unset($config['syslog']['remoteserver']);
111 be5d59d7 Scott Ullrich
			unset($config['syslog']['remoteserver2']);
112
			unset($config['syslog']['remoteserver3']);
113
		}
114 c195be3f Scott Ullrich
115 5b237745 Scott Ullrich
		write_config();
116 c195be3f Scott Ullrich
117 5b237745 Scott Ullrich
		$retval = 0;
118 fd31e9ee Scott Ullrich
		$retval = system_syslogd_start();
119
		if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
120
			$retval |= filter_configure();
121 c195be3f Scott Ullrich
122 4d875b4f Scott Ullrich
		$savemsg = get_std_save_message($retval);
123 5b237745 Scott Ullrich
	}
124
}
125
126 f8ec8de4 Renato Botelho
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Settings"));
127 b63695db Scott Ullrich
include("head.inc");
128
129 5b237745 Scott Ullrich
?>
130 b63695db Scott Ullrich
131
132 5b237745 Scott Ullrich
<script language="JavaScript">
133
<!--
134
function enable_change(enable_over) {
135
	if (document.iform.enable.checked || enable_over) {
136
		document.iform.remoteserver.disabled = 0;
137 be5d59d7 Scott Ullrich
		document.iform.remoteserver2.disabled = 0;
138
		document.iform.remoteserver3.disabled = 0;
139 5b237745 Scott Ullrich
		document.iform.filter.disabled = 0;
140
		document.iform.dhcp.disabled = 0;
141 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 0;
142 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 0;
143
		document.iform.system.disabled = 0;
144 5e08497c Chris Buechler
		document.iform.logall.disabled = 0;
145 5b237745 Scott Ullrich
	} else {
146
		document.iform.remoteserver.disabled = 1;
147 be5d59d7 Scott Ullrich
		document.iform.remoteserver2.disabled = 1;
148
		document.iform.remoteserver3.disabled = 1;
149 5b237745 Scott Ullrich
		document.iform.filter.disabled = 1;
150
		document.iform.dhcp.disabled = 1;
151 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 1;
152 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 1;
153
		document.iform.system.disabled = 1;
154 5e08497c Chris Buechler
		document.iform.logall.disabled = 1;
155 5b237745 Scott Ullrich
	}
156
}
157
// -->
158
</script>
159
160
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
161
<?php include("fbegin.inc"); ?>
162
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
163
<?php if ($input_errors) print_input_errors($input_errors); ?>
164
<?php if ($savemsg) print_info_box($savemsg); ?>
165
<table width="100%" border="0" cellpadding="0" cellspacing="0">
166
  <tr><td>
167 b63695db Scott Ullrich
<?php
168
	$tab_array = array();
169 f8ec8de4 Renato Botelho
	$tab_array[] = array(gettext("System"), false, "diag_logs.php");
170
	$tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php");
171
	$tab_array[] = array(gettext("DHCP"), false, "diag_logs_dhcp.php");
172
	$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs_auth.php");
173
	$tab_array[] = array(gettext("IPsec"), false, "diag_logs_ipsec.php");
174
	$tab_array[] = array(gettext("PPP"), false, "diag_logs_ppp.php");
175
	$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
176
	$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs_relayd.php");
177
	$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs_openvpn.php");
178
	$tab_array[] = array(gettext("OpenNTPD"), false, "diag_logs_ntpd.php");
179
	$tab_array[] = array(gettext("Settings"), true, "diag_logs_settings.php");
180 b63695db Scott Ullrich
	display_top_tabs($tab_array);
181
?>
182 5b237745 Scott Ullrich
  </td></tr>
183 4d875b4f Scott Ullrich
  <tr>
184 0f10aee4 Bill Marquette
    <td>
185
	<div id="mainarea">
186
	  <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
187 4d875b4f Scott Ullrich
                      <tr>
188 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
189
                        <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
190 f8ec8de4 Renato Botelho
			<strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong></td>
191 5b237745 Scott Ullrich
                      </tr>
192 4d875b4f Scott Ullrich
                      <tr>
193 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
194 45a06eeb Renato Botelho
			<td width="78%" class="vtable"><?=gettext("Number of log entries to show:")?>
195 b5c78501 Seth Mos
                          <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
196 5b237745 Scott Ullrich
                      </tr>
197 4d875b4f Scott Ullrich
                      <tr>
198 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
199
                        <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
200 f8ec8de4 Renato Botelho
			<strong><?=gettext("Log packets blocked by the default rule");?></strong><br>
201
			  <?=gettext("Hint: packets that are blocked by the " .
202
                          "implicit default block rule will not be logged anymore " .
203
			  "if you uncheck this option. Per-rule logging options are not affected.");?></td>
204 5b237745 Scott Ullrich
                      </tr>
205 4d875b4f Scott Ullrich
                      <tr>
206 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
207
                        <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
208 f8ec8de4 Renato Botelho
			<strong><?=gettext("Show raw filter logs");?></strong><br>
209
			  <?=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>
210 5b237745 Scott Ullrich
                      </tr>
211 e1c0c35a Scott Ullrich
                      <tr>
212
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
213 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)">
214 f8ec8de4 Renato Botelho
			  <strong><?=gettext("Disable writing log files to the local RAM disk");?></strong></td>
215 c195be3f Scott Ullrich
                       </tr>
216 4d875b4f Scott Ullrich
                      <tr>
217 be5d59d7 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
218
                        <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
219 f8ec8de4 Renato Botelho
			  <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong></td>
220 be5d59d7 Scott Ullrich
                      </tr>
221
                      <tr>
222 f8ec8de4 Renato Botelho
			<td width="22%" valign="top" class="vncell"><?=gettext("Remote syslog servers");?></td>
223 be5d59d7 Scott Ullrich
                        <td width="78%" class="vtable"> 
224
							<table>
225
								<tr>
226
									<td>
227 f8ec8de4 Renato Botelho
										<?=gettext("Server") . " 1";?>
228 be5d59d7 Scott Ullrich
									</td>
229
									<td>
230
										<input name="remoteserver" id="remoteserver" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
231
									</td>
232
								</tr>
233
								<tr>
234
									<td>
235 f8ec8de4 Renato Botelho
										<?=gettext("Server") . " 2";?>
236 be5d59d7 Scott Ullrich
									</td>
237
									<td>
238
										<input name="remoteserver2" id="remoteserver2" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver2']);?>">
239
									</td>
240
								</tr>
241
								<tr>
242
									<td>
243 f8ec8de4 Renato Botelho
										<?=gettext("Server") . " 3";?>
244 be5d59d7 Scott Ullrich
									</td>
245
									<td>
246
										<input name="remoteserver3" id="remoteserver3" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>">
247
									</td>
248
								</tr>
249
								<tr>
250
									<td>
251
										&nbsp;
252
									</td>
253
									<td>
254 f8ec8de4 Renato Botelho
										<?=gettext("IP addresses of remote syslog servers");?>
255 be5d59d7 Scott Ullrich
									</td>
256
							</table>
257
					 	  <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
258 f8ec8de4 Renato Botelho
						  <?=gettext("system events");?><br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
259
						  <?=gettext("firewall events");?><br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
260
						  <?=gettext("DHCP service events");?><br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
261
						  <?=gettext("Portal Auth");?><br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
262
						  <?=gettext("PPTP VPN events");?>
263 4ef2d703 Chris Buechler
                          <br> <input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked"; ?>>
264 f8ec8de4 Renato Botelho
						  <?=gettext("Everything");?>
265 4ef2d703 Chris Buechler
                        </td>
266 5b237745 Scott Ullrich
                      </tr>
267 4d875b4f Scott Ullrich
                      <tr>
268 5b237745 Scott Ullrich
                        <td width="22%" valign="top">&nbsp;</td>
269 9312cca2 Carlos Eduardo Ramos
                        <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)">
270 5b237745 Scott Ullrich
                        </td>
271
                      </tr>
272 4d875b4f Scott Ullrich
                      <tr>
273 5b237745 Scott Ullrich
                        <td width="22%" height="53" valign="top">&nbsp;</td>
274 45a06eeb Renato Botelho
						<td width="78%"><strong><span class="red"><?=gettext("Note:")?></span></strong><br>
275 f8ec8de4 Renato Botelho
                          <?=gettext("syslog sends UDP datagrams to port 514 on the specified " .
276
                          "remote syslog server. Be sure to set syslogd on the " .
277
						  "remote server to accept syslog messages from");?> <?=$g['product_name']?>.
278 5b237745 Scott Ullrich
                        </td>
279
                      </tr>
280
                    </table>
281 0f10aee4 Bill Marquette
	</div>
282 5b237745 Scott Ullrich
    </td>
283
  </tr>
284
</table>
285
</form>
286
<script language="JavaScript">
287
<!--
288
enable_change(false);
289
//-->
290
</script>
291
<?php include("fend.inc"); ?>
292
</body>
293
</html>