Project

General

Profile

Download (10.9 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 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 6b07c15a Matthew Grooms
##|+PRIV
35
##|*IDENT=page-diagnostics-logs-settings
36
##|*NAME=Diagnostics: Logs: Settings page
37
##|*DESCR=Allow access to the 'Diagnostics: Logs: Settings' page.
38
##|*MATCH=diag_logs_settings.php*
39
##|-PRIV
40
41 5b237745 Scott Ullrich
require("guiconfig.inc");
42
43
$pconfig['reverse'] = isset($config['syslog']['reverse']);
44
$pconfig['nentries'] = $config['syslog']['nentries'];
45
$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
46
$pconfig['filter'] = isset($config['syslog']['filter']);
47
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
48 3f2b92d2 Scott Ullrich
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
49 5b237745 Scott Ullrich
$pconfig['vpn'] = isset($config['syslog']['vpn']);
50
$pconfig['system'] = isset($config['syslog']['system']);
51
$pconfig['enable'] = isset($config['syslog']['enable']);
52
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
53
$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
54 af659dda Scott Ullrich
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
55 5b237745 Scott Ullrich
56
if (!$pconfig['nentries'])
57
	$pconfig['nentries'] = 50;
58
59
if ($_POST) {
60
61
	unset($input_errors);
62
	$pconfig = $_POST;
63
64
	/* input validation */
65
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
66
		$input_errors[] = "A valid IP address must be specified.";
67
	}
68 102de157 Scott Ullrich
	if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
69
		$input_errors[] = "Number of log entries to show must be between 5 and 2000.";
70 5b237745 Scott Ullrich
	}
71
72
	if (!$input_errors) {
73
		$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
74
		$config['syslog']['nentries'] = (int)$_POST['nentries'];
75
		$config['syslog']['remoteserver'] = $_POST['remoteserver'];
76
		$config['syslog']['filter'] = $_POST['filter'] ? true : false;
77
		$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
78 3f2b92d2 Scott Ullrich
		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
79 5b237745 Scott Ullrich
		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
80
		$config['syslog']['system'] = $_POST['system'] ? true : false;
81 e1c0c35a Scott Ullrich
		$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
82 5b237745 Scott Ullrich
		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
83
		$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
84
		$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
85
		$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
86 c195be3f Scott Ullrich
		if($config['syslog']['enable'] == false)
87 f3a5f0c5 Scott Ullrich
			unset($config['syslog']['remoteserver']);
88 c195be3f Scott Ullrich
89 5b237745 Scott Ullrich
		write_config();
90 c195be3f Scott Ullrich
91 5b237745 Scott Ullrich
		$retval = 0;
92 fd31e9ee Scott Ullrich
		$retval = system_syslogd_start();
93
		if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
94
			$retval |= filter_configure();
95 c195be3f Scott Ullrich
96 4d875b4f Scott Ullrich
		$savemsg = get_std_save_message($retval);
97 5b237745 Scott Ullrich
	}
98
}
99
100 d88c6a9f Scott Ullrich
$pgtitle = array("Status","System logs","Settings");
101 b63695db Scott Ullrich
include("head.inc");
102
103 5b237745 Scott Ullrich
?>
104 b63695db Scott Ullrich
105
106 5b237745 Scott Ullrich
<script language="JavaScript">
107
<!--
108
function enable_change(enable_over) {
109
	if (document.iform.enable.checked || enable_over) {
110
		document.iform.remoteserver.disabled = 0;
111
		document.iform.filter.disabled = 0;
112
		document.iform.dhcp.disabled = 0;
113 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 0;
114 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 0;
115
		document.iform.system.disabled = 0;
116
	} else {
117
		document.iform.remoteserver.disabled = 1;
118
		document.iform.filter.disabled = 1;
119
		document.iform.dhcp.disabled = 1;
120 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 1;
121 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 1;
122
		document.iform.system.disabled = 1;
123
	}
124
}
125
// -->
126
</script>
127
128
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
129
<?php include("fbegin.inc"); ?>
130
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
131
<?php if ($input_errors) print_input_errors($input_errors); ?>
132
<?php if ($savemsg) print_info_box($savemsg); ?>
133
<table width="100%" border="0" cellpadding="0" cellspacing="0">
134
  <tr><td>
135 b63695db Scott Ullrich
<?php
136
	$tab_array = array();
137 9972f533 Bill Marquette
	$tab_array[] = array("System", false, "diag_logs.php");
138
	$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
139
	$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
140
	$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
141 0f266b2e Chris Buechler
	$tab_array[] = array("IPsec VPN", false, "diag_logs_ipsec.php");
142 9972f533 Bill Marquette
	$tab_array[] = array("PPTP VPN", false, "diag_logs_vpn.php");
143 1348a09b Seth Mos
	$tab_array[] = array("Load Balancer", false, "diag_logs_relayd.php");
144 03491df0 Scott Ullrich
	$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
145 18330d38 Scott Ullrich
	$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
146 9972f533 Bill Marquette
	$tab_array[] = array("Settings", true, "diag_logs_settings.php");
147 b63695db Scott Ullrich
	display_top_tabs($tab_array);
148
?>
149 5b237745 Scott Ullrich
  </td></tr>
150 4d875b4f Scott Ullrich
  <tr>
151 0f10aee4 Bill Marquette
    <td>
152
	<div id="mainarea">
153
	  <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
154 4d875b4f Scott Ullrich
                      <tr>
155 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
156
                        <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
157 4d875b4f Scott Ullrich
                          <strong>Show log entries in reverse order (newest entries
158 5b237745 Scott Ullrich
                          on top)</strong></td>
159
                      </tr>
160 4d875b4f Scott Ullrich
                      <tr>
161 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
162 4d875b4f Scott Ullrich
                        <td width="78%" class="vtable">Number of log entries to
163
                          show:
164 b5c78501 Seth Mos
                          <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
165 5b237745 Scott Ullrich
                      </tr>
166 4d875b4f Scott Ullrich
                      <tr>
167 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
168
                        <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
169
                          <strong>Log packets blocked by the default rule</strong><br>
170 4d875b4f Scott Ullrich
                          Hint: packets that are blocked by the
171
                          implicit default block rule will not be logged anymore
172 5b237745 Scott Ullrich
                          if you uncheck this option. Per-rule logging options are not affected.</td>
173
                      </tr>
174 4d875b4f Scott Ullrich
                      <tr>
175 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
176
                        <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
177
                          <strong>Show raw filter logs</strong><br>
178
                          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>
179
                      </tr>
180 4d875b4f Scott Ullrich
                      <tr>
181 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
182
                        <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
183
                          <strong>Enable syslog'ing to remote syslog server</strong></td>
184
                      </tr>
185 e1c0c35a Scott Ullrich
                      <tr>
186
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
187 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)">
188 c195be3f Scott Ullrich
                          <strong>Disable writing log files to the local ram disk</strong></td>
189
                       </tr>
190 4d875b4f Scott Ullrich
                      <tr>
191
                        <td width="22%" valign="top" class="vncell">Remote syslog
192 5b237745 Scott Ullrich
                          server</td>
193 b5c78501 Seth Mos
                        <td width="78%" class="vtable"> <input name="remoteserver" id="remoteserver" type="text" class="formfld host" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
194 5b237745 Scott Ullrich
                          <br>
195
                          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"; ?>>
196
                          system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
197
                          firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
198 3f2b92d2 Scott Ullrich
                          DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
199
                          Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
200 5b237745 Scott Ullrich
                          PPTP VPN events</td>
201
                      </tr>
202 4d875b4f Scott Ullrich
                      <tr>
203 5b237745 Scott Ullrich
                        <td width="22%" valign="top">&nbsp;</td>
204 4d875b4f Scott Ullrich
                        <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
205 5b237745 Scott Ullrich
                        </td>
206
                      </tr>
207 4d875b4f Scott Ullrich
                      <tr>
208 5b237745 Scott Ullrich
                        <td width="22%" height="53" valign="top">&nbsp;</td>
209
                        <td width="78%"><strong><span class="red">Note:</span></strong><br>
210 4d875b4f Scott Ullrich
                          syslog sends UDP datagrams to port 514 on the specified
211
                          remote syslog server. Be sure to set syslogd on the
212 25351cb8 Bill Marquette
                          remote server to accept syslog messages from <?=$g['product_name']?>.
213 5b237745 Scott Ullrich
                        </td>
214
                      </tr>
215
                    </table>
216 0f10aee4 Bill Marquette
	</div>
217 5b237745 Scott Ullrich
    </td>
218
  </tr>
219
</table>
220
</form>
221
<script language="JavaScript">
222
<!--
223
enable_change(false);
224
//-->
225
</script>
226
<?php include("fend.inc"); ?>
227
</body>
228
</html>