Project

General

Profile

Download (11 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_logs_settings.php
5
	Copyright (C) 2004 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
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
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
42
$pconfig['vpn'] = isset($config['syslog']['vpn']);
43
$pconfig['system'] = isset($config['syslog']['system']);
44
$pconfig['logall'] = isset($config['syslog']['logall']);
45
$pconfig['enable'] = isset($config['syslog']['enable']);
46
$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
47
$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
48
$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
49

    
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'] > 2000)) {
63
		$input_errors[] = "Number of log entries to show must be between 5 and 2000.";
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
		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
73
		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
74
		$config['syslog']['logall'] = $_POST['logall'] ? true : false;
75
		$config['syslog']['system'] = $_POST['system'] ? true : false;
76
		$config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
77
		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
78
		$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
79
		$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
80
		$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
81
		if($config['syslog']['enable'] == false)
82
			unset($config['syslog']['remoteserver']);
83

    
84
		write_config();
85

    
86
		$retval = 0;
87
		config_lock();
88
		$retval = system_syslogd_start();
89
		if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
90
			$retval |= filter_configure();
91
		config_unlock();
92

    
93
		$savemsg = get_std_save_message($retval);
94
	}
95
}
96

    
97
$pgtitle = "Diagnostics: System logs: Settings";
98
include("head.inc");
99

    
100
?>
101

    
102

    
103
<script language="JavaScript">
104
<!--
105
function enable_change(enable_over) {
106
	if (document.iform.enable.checked || enable_over) {
107
		document.iform.remoteserver.disabled = 0;
108
		document.iform.filter.disabled = 0;
109
		document.iform.dhcp.disabled = 0;
110
		document.iform.portalauth.disabled = 0;
111
		document.iform.vpn.disabled = 0;
112
		document.iform.system.disabled = 0;
113
	} else {
114
		document.iform.remoteserver.disabled = 1;
115
		document.iform.filter.disabled = 1;
116
		document.iform.dhcp.disabled = 1;
117
		document.iform.portalauth.disabled = 1;
118
		document.iform.vpn.disabled = 1;
119
		document.iform.system.disabled = 1;
120
	}
121
}
122
// -->
123
</script>
124

    
125
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
126
<?php include("fbegin.inc"); ?>
127
<p class="pgtitle"><?=$pgtitle?></p>
128
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
129
<?php if ($input_errors) print_input_errors($input_errors); ?>
130
<?php if ($savemsg) print_info_box($savemsg); ?>
131
<table width="100%" border="0" cellpadding="0" cellspacing="0">
132
  <tr><td>
133
<?php
134
	$tab_array = array();
135
	$tab_array[] = array("System", false, "diag_logs.php");
136
	$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
137
	$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
138
	$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
139
	$tab_array[] = array("IPsec VPN", false, "diag_logs_ipsec.php");
140
	$tab_array[] = array("PPTP VPN", false, "diag_logs_vpn.php");
141
	$tab_array[] = array("Load Balancer", false, "diag_logs_slbd.php");
142
	$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
143
	$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
144
	$tab_array[] = array("Settings", true, "diag_logs_settings.php");
145
	display_top_tabs($tab_array);
146
?>
147
  </td></tr>
148
  <tr>
149
    <td>
150
	<div id="mainarea">
151
	  <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
152
                      <tr>
153
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
154
                        <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
155
                          <strong>Show log entries in reverse order (newest entries
156
                          on top)</strong></td>
157
                      </tr>
158
                      <tr>
159
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
160
                        <td width="78%" class="vtable">Number of log entries to
161
                          show:
162
                          <input name="nentries" id="nentries" type="text" class="formfld" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
163
                      </tr>
164
                      <tr>
165
                        <td valign="top" class="vtable">&nbsp;</td>
166
                        <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
167
                          <strong>Log packets blocked by the default rule</strong><br>
168
                          Hint: packets that are blocked by the
169
                          implicit default block rule will not be logged anymore
170
                          if you uncheck this option. Per-rule logging options are not affected.</td>
171
                      </tr>
172
                      <tr>
173
                        <td valign="top" class="vtable">&nbsp;</td>
174
                        <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
175
                          <strong>Show raw filter logs</strong><br>
176
                          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>
177
                      </tr>
178
                      <tr>
179
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
180
                        <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
181
                          <strong>Enable syslog'ing to remote syslog server</strong></td>
182
                      </tr>
183
                      <tr>
184
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
185
                        <td width="78%" class="vtable"> <input name="disablelocallogging" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onClick="enable_change(false)">
186
                          <strong>Disable writing log files to the local ram disk</strong></td>
187
                       </tr>
188
                      <tr>
189
                        <td width="22%" valign="top" class="vncell">Remote syslog
190
                          server</td>
191
                        <td width="78%" class="vtable"> <input name="remoteserver" id="remoteserver" type="text" class="formfld" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
192
                          <br>
193
                          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"; ?>>
194
                          system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
195
                          firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
196
                          DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
197
                          Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
198
                          VPN events
199
			<br> <input name="logall" id="logall" type="checkbox" value="yes" <?php if ($pconfig['logall']) echo "checked"; ?>>
200
                          Everything</td>
201
                      </tr>
202
                      <tr>
203
                        <td width="22%" valign="top">&nbsp;</td>
204
                        <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
205
                        </td>
206
                      </tr>
207
                      <tr>
208
                        <td width="22%" height="53" valign="top">&nbsp;</td>
209
                        <td width="78%"><strong><span class="red">Note:</span></strong><br>
210
                          syslog sends UDP datagrams to port 514 on the specified
211
                          remote syslog server. Be sure to set syslogd on the
212
                          remote server to accept syslog messages from <?=$g['product_name']?>.
213
                        </td>
214
                      </tr>
215
                    </table>
216
	</div>
217
    </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>
(22-22/176)