Project

General

Profile

Download (10 KB) Statistics
| Branch: | Tag: | Revision:
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
49
if (!$pconfig['nentries'])
50
	$pconfig['nentries'] = 50;
51
52
if ($_POST) {
53
54
	unset($input_errors);
55
	$pconfig = $_POST;
56
57
	/* input validation */
58
	if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
59
		$input_errors[] = "A valid IP address must be specified.";
60
	}
61
	if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 1000)) {
62
		$input_errors[] = "Number of log entries to show must be between 5 and 1000.";
63
	}
64
65
	if (!$input_errors) {
66
		$config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
67
		$config['syslog']['nentries'] = (int)$_POST['nentries'];
68
		$config['syslog']['remoteserver'] = $_POST['remoteserver'];
69
		$config['syslog']['filter'] = $_POST['filter'] ? true : false;
70
		$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
71 3f2b92d2 Scott Ullrich
		$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
72 5b237745 Scott Ullrich
		$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
73
		$config['syslog']['system'] = $_POST['system'] ? true : false;
74
		$config['syslog']['enable'] = $_POST['enable'] ? true : false;
75
		$oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
76
		$config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
77
		$config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
78 4d875b4f Scott Ullrich
79 5b237745 Scott Ullrich
		write_config();
80 4d875b4f Scott Ullrich
81 5b237745 Scott Ullrich
		$retval = 0;
82
		if (!file_exists($d_sysrebootreqd_path)) {
83
			config_lock();
84
			$retval = system_syslogd_start();
85
			if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
86
				$retval |= filter_configure();
87
			config_unlock();
88
		}
89 4d875b4f Scott Ullrich
		$savemsg = get_std_save_message($retval);
90 5b237745 Scott Ullrich
	}
91
}
92
93 b63695db Scott Ullrich
$pgtitle = "Diagnostics: System logs: Settings";
94
include("head.inc");
95
96 5b237745 Scott Ullrich
?>
97 b63695db Scott Ullrich
98
99 5b237745 Scott Ullrich
<script language="JavaScript">
100
<!--
101
function enable_change(enable_over) {
102
	if (document.iform.enable.checked || enable_over) {
103
		document.iform.remoteserver.disabled = 0;
104
		document.iform.filter.disabled = 0;
105
		document.iform.dhcp.disabled = 0;
106 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 0;
107 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 0;
108
		document.iform.system.disabled = 0;
109
	} else {
110
		document.iform.remoteserver.disabled = 1;
111
		document.iform.filter.disabled = 1;
112
		document.iform.dhcp.disabled = 1;
113 3f2b92d2 Scott Ullrich
		document.iform.portalauth.disabled = 1;
114 5b237745 Scott Ullrich
		document.iform.vpn.disabled = 1;
115
		document.iform.system.disabled = 1;
116
	}
117
}
118
// -->
119
</script>
120
121
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
122
<?php include("fbegin.inc"); ?>
123 963d5343 Bill Marquette
<p class="pgtitle">Diagnostics: System logs: Settings</p>
124 5b237745 Scott Ullrich
<form action="diag_logs_settings.php" method="post" name="iform" id="iform">
125
<?php if ($input_errors) print_input_errors($input_errors); ?>
126
<?php if ($savemsg) print_info_box($savemsg); ?>
127 12af52d9 Scott Ullrich
<div id="mainarea">
128 5b237745 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
129
  <tr><td>
130 b63695db Scott Ullrich
<?php
131
	$tab_array = array();
132 8ed15ffb Scott Ullrich
	$tab_array[0] = array("System", false, "diag_logs.php");
133
	$tab_array[1] = array("Firewall", false, "diag_logs_filter.php");
134
	$tab_array[2] = array("DHCP", false, "diag_logs_dhcp.php");
135
	$tab_array[3] = array("Portal Auth", false, "diag_logs_auth.php");
136
	$tab_array[4] = array("IPSEC VPN", false, "diag_logs_ipsec.php");
137
	$tab_array[5] = array("PPTP VPN", false, "diag_logs_vpn.php");
138
	$tab_array[6] = array("Settings", true, "diag_logs_settings.php");
139 b63695db Scott Ullrich
	display_top_tabs($tab_array);
140
?>
141 5b237745 Scott Ullrich
  </td></tr>
142 4d875b4f Scott Ullrich
  <tr>
143 5b237745 Scott Ullrich
    <td class="tabcont">
144
	  <table width="100%" border="0" cellpadding="6" cellspacing="0">
145 4d875b4f Scott Ullrich
                      <tr>
146 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
147
                        <td width="78%" class="vtable"> <input name="reverse" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?>>
148 4d875b4f Scott Ullrich
                          <strong>Show log entries in reverse order (newest entries
149 5b237745 Scott Ullrich
                          on top)</strong></td>
150
                      </tr>
151 4d875b4f Scott Ullrich
                      <tr>
152 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
153 4d875b4f Scott Ullrich
                        <td width="78%" class="vtable">Number of log entries to
154
                          show:
155 5b237745 Scott Ullrich
                          <input name="nentries" id="nentries" type="text" class="formfld" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>"></td>
156
                      </tr>
157 4d875b4f Scott Ullrich
                      <tr>
158 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
159
                        <td class="vtable"> <input name="logdefaultblock" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?>>
160
                          <strong>Log packets blocked by the default rule</strong><br>
161 4d875b4f Scott Ullrich
                          Hint: packets that are blocked by the
162
                          implicit default block rule will not be logged anymore
163 5b237745 Scott Ullrich
                          if you uncheck this option. Per-rule logging options are not affected.</td>
164
                      </tr>
165 4d875b4f Scott Ullrich
                      <tr>
166 5b237745 Scott Ullrich
                        <td valign="top" class="vtable">&nbsp;</td>
167
                        <td class="vtable"> <input name="rawfilter" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?>>
168
                          <strong>Show raw filter logs</strong><br>
169
                          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>
170
                      </tr>
171 4d875b4f Scott Ullrich
                      <tr>
172 5b237745 Scott Ullrich
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
173
                        <td width="78%" class="vtable"> <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
174
                          <strong>Enable syslog'ing to remote syslog server</strong></td>
175
                      </tr>
176 4d875b4f Scott Ullrich
                      <tr>
177
                        <td width="22%" valign="top" class="vncell">Remote syslog
178 5b237745 Scott Ullrich
                          server</td>
179 4d875b4f Scott Ullrich
                        <td width="78%" class="vtable"> <input name="remoteserver" id="remoteserver" type="text" class="formfld" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>">
180 5b237745 Scott Ullrich
                          <br>
181
                          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"; ?>>
182
                          system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
183
                          firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
184 3f2b92d2 Scott Ullrich
                          DHCP service events<br> <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
185
                          Portal Auth<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
186 5b237745 Scott Ullrich
                          PPTP VPN events</td>
187
                      </tr>
188 4d875b4f Scott Ullrich
                      <tr>
189 5b237745 Scott Ullrich
                        <td width="22%" valign="top">&nbsp;</td>
190 4d875b4f Scott Ullrich
                        <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
191 5b237745 Scott Ullrich
                        </td>
192
                      </tr>
193 4d875b4f Scott Ullrich
                      <tr>
194 5b237745 Scott Ullrich
                        <td width="22%" height="53" valign="top">&nbsp;</td>
195
                        <td width="78%"><strong><span class="red">Note:</span></strong><br>
196 4d875b4f Scott Ullrich
                          syslog sends UDP datagrams to port 514 on the specified
197
                          remote syslog server. Be sure to set syslogd on the
198 6b2e9ec2 Scott Ullrich
                          remote server to accept syslog messages from pfSense.
199 5b237745 Scott Ullrich
                        </td>
200
                      </tr>
201
                    </table>
202
    </td>
203
  </tr>
204
</table>
205 12af52d9 Scott Ullrich
</div>
206 5b237745 Scott Ullrich
</form>
207
<script language="JavaScript">
208
<!--
209
enable_change(false);
210
//-->
211
</script>
212
<?php include("fend.inc"); ?>
213 12af52d9 Scott Ullrich
<script type="text/javascript">
214
NiftyCheck();
215
Rounded("div#mainarea","bl br","#FFF","#eeeeee","smooth");
216
</script>
217
218 5b237745 Scott Ullrich
</body>
219
</html>