Project

General

Profile

Download (13 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_logs_settings.php
5
	Copyright (C) 2004-2009 Scott Ullrich
6
	All rights reserved.
7

    
8
	originially part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

    
12
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14

    
15
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17

    
18
	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

    
22
	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
/*	
35
	pfSense_MODULE:	system
36
*/
37

    
38
##|+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
require("guiconfig.inc");
46

    
47
$pconfig['reverse'] = isset($config['syslog']['reverse']);
48
$pconfig['nentries'] = $config['syslog']['nentries'];
49
$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
50
$pconfig['remoteserver2'] = $config['syslog']['remoteserver2'];
51
$pconfig['remoteserver3'] = $config['syslog']['remoteserver3'];
52
$pconfig['filter'] = isset($config['syslog']['filter']);
53
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
54
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
55
$pconfig['vpn'] = isset($config['syslog']['vpn']);
56
$pconfig['logall'] = isset($config['syslog']['logall']);
57
$pconfig['system'] = isset($config['syslog']['system']);
58
$pconfig['enable'] = isset($config['syslog']['enable']);
59
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
60
$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
61
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
62

    
63
if (!$pconfig['nentries'])
64
	$pconfig['nentries'] = 50;
65

    
66
if ($_POST) {
67

    
68
	unset($input_errors);
69
	$pconfig = $_POST;
70

    
71
	/* input validation */
72
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
73
		$input_errors[] = "A valid IP address must be specified for remote syslog server #1.";
74
	}
75
	if ($_POST['enable'] && $_POST['remoteserver2'] && !is_ipaddr($_POST['remoteserver2'])) {
76
		$input_errors[] = "A valid IP address must be specified for remote syslog server #2.";
77
	}
78
	if ($_POST['enable'] && $_POST['remoteserver3'] && !is_ipaddr($_POST['remoteserver3'])) {
79
		$input_errors[] = "A valid IP address must be specified for remote syslog server #3.";
80
	}
81
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
82
		$input_errors[] = "A valid IP address must be specified.";
83
	}
84

    
85
	if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
86
		$input_errors[] = "Number of log entries to show must be between 5 and 2000.";
87
	}
88

    
89
	if (!$input_errors) {
90
		$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
91
		$config['syslog']['nentries'] = (int)$_POST['nentries'];
92
		$config['syslog']['remoteserver'] = $_POST['remoteserver'];
93
		$config['syslog']['remoteserver2'] = $_POST['remoteserver2'];
94
		$config['syslog']['remoteserver3'] = $_POST['remoteserver3'];
95
		$config['syslog']['filter'] = $_POST['filter'] ? true : false;
96
		$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
97
		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
98
		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
99
                $config['syslog']['logall'] = $_POST['logall'] ? true : false;
100
		$config['syslog']['system'] = $_POST['system'] ? true : false;
101
		$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
102
		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
103
		$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
104
		$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
105
		$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
106
		if($config['syslog']['enable'] == false) {
107
			unset($config['syslog']['remoteserver']);
108
			unset($config['syslog']['remoteserver2']);
109
			unset($config['syslog']['remoteserver3']);
110
		}
111

    
112
		write_config();
113

    
114
		$retval = 0;
115
		$retval = system_syslogd_start();
116
		if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
117
			$retval |= filter_configure();
118

    
119
		$savemsg = get_std_save_message($retval);
120
	}
121
}
122

    
123
$pgtitle = array("Status","System logs","Settings");
124
include("head.inc");
125

    
126
?>
127

    
128

    
129
<script language="JavaScript">
130
<!--
131
function enable_change(enable_over) {
132
	if (document.iform.enable.checked || enable_over) {
133
		document.iform.remoteserver.disabled = 0;
134
		document.iform.remoteserver2.disabled = 0;
135
		document.iform.remoteserver3.disabled = 0;
136
		document.iform.filter.disabled = 0;
137
		document.iform.dhcp.disabled = 0;
138
		document.iform.portalauth.disabled = 0;
139
		document.iform.vpn.disabled = 0;
140
		document.iform.system.disabled = 0;
141
	} else {
142
		document.iform.remoteserver.disabled = 1;
143
		document.iform.remoteserver2.disabled = 1;
144
		document.iform.remoteserver3.disabled = 1;
145
		document.iform.filter.disabled = 1;
146
		document.iform.dhcp.disabled = 1;
147
		document.iform.portalauth.disabled = 1;
148
		document.iform.vpn.disabled = 1;
149
		document.iform.system.disabled = 1;
150
	}
151
}
152
// -->
153
</script>
154

    
155
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
156
<?php include("fbegin.inc"); ?>
157
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
158
<?php if ($input_errors) print_input_errors($input_errors); ?>
159
<?php if ($savemsg) print_info_box($savemsg); ?>
160
<table width="100%" border="0" cellpadding="0" cellspacing="0">
161
  <tr><td>
162
<?php
163
	$tab_array = array();
164
	$tab_array[] = array("System", false, "diag_logs.php");
165
	$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
166
	$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
167
	$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
168
	$tab_array[] = array("IPsec", false, "diag_logs_ipsec.php");
169
	$tab_array[] = array("PPP", false, "diag_logs_ppp.php");
170
	$tab_array[] = array("PPTP VPN", false, "diag_logs_vpn.php");
171
	$tab_array[] = array("Load Balancer", false, "diag_logs_relayd.php");
172
	$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
173
	$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
174
	$tab_array[] = array("Settings", true, "diag_logs_settings.php");
175
	display_top_tabs($tab_array);
176
?>
177
  </td></tr>
178
  <tr>
179
    <td>
180
	<div id="mainarea">
181
	  <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
182
                      <tr>
183
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
184
                        <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
185
                          <strong>Show log entries in reverse order (newest entries
186
                          on top)</strong></td>
187
                      </tr>
188
                      <tr>
189
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
190
                        <td width="78%" class="vtable">Number of log entries to
191
                          show:
192
                          <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
193
                      </tr>
194
                      <tr>
195
                        <td valign="top" class="vtable">&nbsp;</td>
196
                        <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
197
                          <strong>Log packets blocked by the default rule</strong><br>
198
                          Hint: packets that are blocked by the
199
                          implicit default block rule will not be logged anymore
200
                          if you uncheck this option. Per-rule logging options are not affected.</td>
201
                      </tr>
202
                      <tr>
203
                        <td valign="top" class="vtable">&nbsp;</td>
204
                        <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
205
                          <strong>Show raw filter logs</strong><br>
206
                          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>
207
                      </tr>
208
                      <tr>
209
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
210
                        <td width="78%" class="vtable"> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onClick="enable_change(false)">
211
                          <strong>Disable writing log files to the local ram disk</strong></td>
212
                       </tr>
213
                      <tr>
214
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
215
                        <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
216
                          <strong>Enable syslog'ing to remote syslog server</strong></td>
217
                      </tr>
218
                      <tr>
219
                        <td width="22%" valign="top" class="vncell">Remote syslog servers</td>
220
                        <td width="78%" class="vtable"> 
221
							<table>
222
								<tr>
223
									<td>
224
										Server 1
225
									</td>
226
									<td>
227
										<input name="remoteserver" id="remoteserver" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
228
									</td>
229
								</tr>
230
								<tr>
231
									<td>
232
										Server 2
233
									</td>
234
									<td>
235
										<input name="remoteserver2" id="remoteserver2" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver2']);?>">
236
									</td>
237
								</tr>
238
								<tr>
239
									<td>
240
										Server 3
241
									</td>
242
									<td>
243
										<input name="remoteserver3" id="remoteserver3" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver3']);?>">
244
									</td>
245
								</tr>
246
								<tr>
247
									<td>
248
										&nbsp;
249
									</td>
250
									<td>
251
										IP addresses of remote syslog servers
252
									</td>
253
							</table>
254
					 	  <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
255
                          system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
256
                          firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
257
                          DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
258
                          Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
259
                          PPTP VPN events
260
                          <br> <input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked"; ?>>
261
                          Everything
262
                        </td>
263
                      </tr>
264
                      <tr>
265
                        <td width="22%" valign="top">&nbsp;</td>
266
                        <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
267
                        </td>
268
                      </tr>
269
                      <tr>
270
                        <td width="22%" height="53" valign="top">&nbsp;</td>
271
                        <td width="78%"><strong><span class="red">Note:</span></strong><br>
272
                          syslog sends UDP datagrams to port 514 on the specified
273
                          remote syslog server. Be sure to set syslogd on the
274
                          remote server to accept syslog messages from <?=$g['product_name']?>.
275
                        </td>
276
                      </tr>
277
                    </table>
278
	</div>
279
    </td>
280
  </tr>
281
</table>
282
</form>
283
<script language="JavaScript">
284
<!--
285
enable_change(false);
286
//-->
287
</script>
288
<?php include("fend.inc"); ?>
289
</body>
290
</html>
(25-25/218)