Project

General

Profile

Download (28 KB) Statistics
| Branch: | Tag: | Revision:
1 13128695 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	system_advanced.php
5 416ed28d Scott Ullrich
        part of pfSense
6
        Copyright (C) 2005 Scott Ullrich
7 13128695 Scott Ullrich
8 416ed28d Scott Ullrich
	originally 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 13128695 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 13128695 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 13128695 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 13128695 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
require("guiconfig.inc");
35
36 35284e50 Scott Ullrich
$pconfig['disablefilter'] = $config['system']['disablefilter'];
37 38560a25 Bill Marquette
$pconfig['rfc959workaround'] = $config['system']['rfc959workaround'];
38 8f498445 Scott Ullrich
$pconfig['scrubnodf'] = $config['system']['scrubnodf'];
39 5b237745 Scott Ullrich
$pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']);
40
$pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr'];
41
$pconfig['cert'] = base64_decode($config['system']['webgui']['certificate']);
42
$pconfig['key'] = base64_decode($config['system']['webgui']['private-key']);
43
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
44 c11e337b Scott Ullrich
$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
45 5b237745 Scott Ullrich
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
46 3962b070 Scott Ullrich
$pconfig['filteringbridge_enable'] = isset($config['bridge']['filteringbridge']);
47 5b237745 Scott Ullrich
$pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
48 351217ed Scott Ullrich
$pconfig['maximumstates'] = $config['system']['maximumstates'];
49 68bf6021 Scott Ullrich
$pconfig['disablerendevouz'] = $config['system']['disablerendevouz'];
50 2f810bc1 Scott Ullrich
$pconfig['enableserial'] = $config['system']['enableserial'];
51 5c50ae40 Scott Ullrich
$pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']);
52 d5967a9a Scott Ullrich
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
53 59d09874 Scott Ullrich
$pconfig['enablesshd'] = $config['system']['enablesshd'];
54 74806cee Seth Mos
$pconfig['sshport'] = $config['system']['ssh']['port'];
55 243aa7b9 Scott Ullrich
$pconfig['sharednet'] = $config['system']['sharednet'];
56 8d36fd1d Scott Ullrich
$pconfig['polling_enable'] = isset($config['system']['polling']);
57 bdac13de Scott Ullrich
$pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
58 a9b19d7f Scott Ullrich
$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
59
60 5b237745 Scott Ullrich
if ($_POST) {
61
62
	unset($input_errors);
63
	$pconfig = $_POST;
64
65
	/* input validation */
66
	if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr'])) {
67
		$input_errors[] = "You must specify an IP address to NAT IPv6 packets.";
68
	}
69 351217ed Scott Ullrich
	if ($_POST['maximumstates'] && !is_numericint($_POST['maximumstates'])) {
70
		$input_errors[] = "The Firewall Maximum States value must be an integer.";
71
	}
72 5b237745 Scott Ullrich
	if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
73
		$input_errors[] = "The TCP idle timeout must be an integer.";
74
	}
75
	if (($_POST['cert'] && !$_POST['key']) || ($_POST['key'] && !$_POST['cert'])) {
76
		$input_errors[] = "Certificate and key must always be specified together.";
77
	} else if ($_POST['cert'] && $_POST['key']) {
78
		if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
79
			$input_errors[] = "This certificate does not appear to be valid.";
80
		if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
81
			$input_errors[] = "This key does not appear to be valid.";
82 a509ff63 Bill Marquette
	if ($_POST['altfirmwareurl'])
83
		if ($_POST['firmwareurl'] == "" || $_POST['firmwarename'] == "")
84
		$input_errors[] = "You must specify a base URL and a filename for the alternate firmware.";
85 66f481cc Colin Smith
	if ($_POST['altpkgconfigurl'])
86
		if ($_POST['pkgconfig_base_url'] == "" || $_POST['pkgconfig_filename'] == "")
87
		$input_errors[] = "You must specifiy and base URL and a filename before using an alternate pkg_config.xml.";
88 5b237745 Scott Ullrich
	}
89 e52f293f Scott Ullrich
	if ($_POST['maximumstates'] <> "") {
90
		if ($_POST['maximumstates'] < 1000)
91
			$input_errors[] = "States must be above 1000 and below 100000000";
92
		if ($_POST['maximumstates'] > 100000000)
93
			$input_errors[] = "States must be above 1000 and below 100000000";
94
	}
95 74806cee Seth Mos
	if ($_POST['sshport'] <> "") {
96
		if( ! is_port($_POST['sshport'])) {
97
			$input_errors[] = "You must specify a valid port number";
98
		}
99
	}
100
101 5b237745 Scott Ullrich
	if (!$input_errors) {
102 35284e50 Scott Ullrich
		if($_POST['disablefilter'] == "yes") {
103
			$config['system']['disablefilter'] = "enabled";
104
		} else {
105
			unset($config['system']['disablefilter']);
106
		}
107 59d09874 Scott Ullrich
		if($_POST['enablesshd'] == "yes") {
108
			$config['system']['enablesshd'] = "enabled";
109 51579483 Scott Ullrich
			touch("{$g['tmp_path']}/start_sshd");
110 36aaefff Scott Ullrich
		} else {
111 59d09874 Scott Ullrich
			unset($config['system']['enablesshd']);
112 d7e10506 Scott Ullrich
			mwexec("/usr/bin/killall sshd");
113 48ce54d0 Scott Ullrich
		}
114 74806cee Seth Mos
		$oldsshport = $config['system']['ssh']['port'];
115
		$config['system']['ssh']['port'] = $_POST['sshport'];
116 243aa7b9 Scott Ullrich
117 48ce54d0 Scott Ullrich
		if($_POST['polling_enable'] == "yes") {
118 018ea877 Scott Ullrich
			$config['system']['polling'] = true;
119 562fca6d Scott Ullrich
			setup_polling();
120
		} else {
121 018ea877 Scott Ullrich
			unset($config['system']['polling']);
122 562fca6d Scott Ullrich
			setup_polling();
123
		}
124 8d36fd1d Scott Ullrich
125 243aa7b9 Scott Ullrich
		if($_POST['sharednet'] == "yes") {
126
			$config['system']['sharednet'] = true;
127
			system_disable_arp_wrong_if();
128
		} else {
129
			unset($config['system']['sharednet']);
130
			system_enable_arp_wrong_if();
131 48ce54d0 Scott Ullrich
		}
132 243aa7b9 Scott Ullrich
133 31f93981 Bill Marquette
		if($_POST['rfc959workaround'] == "yes")
134 38560a25 Bill Marquette
			$config['system']['rfc959workaround'] = "enabled";
135 31f93981 Bill Marquette
		else
136
			unset($config['system']['rfc959workaround']);
137
138 8f498445 Scott Ullrich
		if($_POST['scrubnodf'] == "yes")
139
			$config['system']['scrubnodf'] = "enabled";
140
		else
141
			unset($config['system']['scrubnodf']);
142
143 31f93981 Bill Marquette
		if($_POST['ipv6nat_enable'] == "yes") {
144
			$config['diag']['ipv6nat']['enable'] = true;
145
			$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
146
		} else {
147
			unset($config['diag']['ipv6nat']['enable']);
148
			unset($config['diag']['ipv6nat']['ipaddr']);
149 38560a25 Bill Marquette
		}
150 5b237745 Scott Ullrich
		$oldcert = $config['system']['webgui']['certificate'];
151
		$oldkey = $config['system']['webgui']['private-key'];
152
		$config['system']['webgui']['certificate'] = base64_encode($_POST['cert']);
153
		$config['system']['webgui']['private-key'] = base64_encode($_POST['key']);
154 8affb1da Scott Ullrich
		if($_POST['disableconsolemenu'] == "yes") {
155 31f93981 Bill Marquette
			$config['system']['disableconsolemenu'] = true;
156 b1ce7649 Scott Ullrich
			auto_login(true);
157 8affb1da Scott Ullrich
		} else {
158 31f93981 Bill Marquette
			unset($config['system']['disableconsolemenu']);
159 b1ce7649 Scott Ullrich
			auto_login(false);
160 8affb1da Scott Ullrich
		}
161 aefb60ce Scott Ullrich
		unset($config['system']['webgui']['expanddiags']);
162 416ed28d Scott Ullrich
		$config['system']['optimization'] = $_POST['optimization'];
163 48ce54d0 Scott Ullrich
164 5c50ae40 Scott Ullrich
		if($_POST['disablefirmwarecheck'] == "yes")
165
			$config['system']['disablefirmwarecheck'] = true;
166
		else
167 2629e5d1 Scott Ullrich
			unset($config['system']['disablefirmwarecheck']);
168
169 31f93981 Bill Marquette
		if ($_POST['enableserial'] == "yes")
170 538bb06f Bill Marquette
			$config['system']['enableserial'] = true;
171 31f93981 Bill Marquette
		else
172
			unset($config['system']['enableserial']);
173
174 d1975a6a Scott Ullrich
		if($_POST['harddiskstandby'] <> "") {
175 102239f9 Scott Ullrich
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
176 31f93981 Bill Marquette
			system_set_harddisk_standby();
177
		} else
178
			unset($config['system']['harddiskstandby']);
179
180
		if ($_POST['noantilockout'] == "yes")
181
			$config['system']['webgui']['noantilockout'] = true;
182
		else
183
			unset($config['system']['webgui']['noantilockout']);
184 13128695 Scott Ullrich
185 351217ed Scott Ullrich
		/* Firewall and ALTQ options */
186
		$config['system']['maximumstates'] = $_POST['maximumstates'];
187 12bcdc89 Scott Ullrich
188 59d09874 Scott Ullrich
		if($_POST['enablesshd'] == "yes") {
189
			$config['system']['enablesshd'] = $_POST['enablesshd'];
190 f6efd9a5 Scott Ullrich
		} else {
191 59d09874 Scott Ullrich
			unset($config['system']['enablesshd']);
192 f6efd9a5 Scott Ullrich
		}
193
194 a9b19d7f Scott Ullrich
		if($_POST['disablenatreflection'] == "yes") {
195
			$config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
196
		} else {
197
			unset($config['system']['disablenatreflection']);
198
		}
199 48ce54d0 Scott Ullrich
200 d5967a9a Scott Ullrich
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
201 48ce54d0 Scott Ullrich
202
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;
203 bdac13de Scott Ullrich
		$config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes'] ? true : false;
204 48ce54d0 Scott Ullrich
205 5b237745 Scott Ullrich
		write_config();
206 48ce54d0 Scott Ullrich
207 5b237745 Scott Ullrich
		$retval = 0;
208 48ce54d0 Scott Ullrich
209 3851094f Scott Ullrich
		if(stristr($retval, "error") <> true)
210
		    $savemsg = get_std_save_message($retval);
211
		else
212
		    $savemsg = $retval;
213 7db5e498 Scott Ullrich
214
		$retval = filter_configure();
215 48ce54d0 Scott Ullrich
216 7db5e498 Scott Ullrich
		conf_mount_rw();
217 48ce54d0 Scott Ullrich
218 96af3ad5 Scott Ullrich
		setup_serial_port();
219 48ce54d0 Scott Ullrich
220 3962b070 Scott Ullrich
		setup_filter_bridge();
221 48ce54d0 Scott Ullrich
222 7db5e498 Scott Ullrich
		conf_mount_ro();
223 48ce54d0 Scott Ullrich
224 5b237745 Scott Ullrich
	}
225
}
226 b63695db Scott Ullrich
227
$pgtitle = "System: Advanced functions";
228
include("head.inc");
229
230 5b237745 Scott Ullrich
?>
231 b63695db Scott Ullrich
232 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
233 9ecd6ab7 Erik Kristensen
234 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
235 9ecd6ab7 Erik Kristensen
236 74f446e8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
237 13128695 Scott Ullrich
238 9ecd6ab7 Erik Kristensen
<form action="system_advanced.php" method="post" name="iform" id="iform">
239
<?php if ($input_errors) print_input_errors($input_errors); ?>
240
<?php if ($savemsg) print_info_box($savemsg); ?>
241
<p><span class="vexpl"><span class="red"><strong>Note: </strong></span>the options on this page are intended for use by advanced users only.</span></p>
242
<br />
243 416ed28d Scott Ullrich
244 9ecd6ab7 Erik Kristensen
<table width="100%" border="0" cellpadding="6" cellspacing="0">
245
	<tbody>
246 dbb0b7d6 Holger Bauer
		<?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
247 9ecd6ab7 Erik Kristensen
		<tr>
248
			<td colspan="2" valign="top" class="listtopic">Enable Serial Console</td>
249
		</tr>
250
		<tr>
251
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
252
			<td width="78%" class="vtable">
253
				<input name="enableserial" type="checkbox" id="enableserial" value="yes" <?php if (isset($pconfig['enableserial'])) echo "checked"; ?> onclick="enable_change(false)" />
254
				<strong>This will enable the first serial port with 9600/8/N/1</strong>
255 b8467d8e Scott Ullrich
				<br>
256 3446ca38 Scott Ullrich
				<span class="vexpl">Note:  This will disable the internal video card/keyboard</span>
257 9ecd6ab7 Erik Kristensen
			</td>
258
		</tr>
259
		<tr>
260
			<td width="22%" valign="top">&nbsp;</td>
261
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
262
		</tr>
263
		</tr>
264
		<tr>
265
			<td colspan="2" class="list" height="12"></td>
266 48ce54d0 Scott Ullrich
		</tr>
267 0831bc86 Scott Ullrich
		<?php endif; ?>
268 9ecd6ab7 Erik Kristensen
		<tr>
269
			<td colspan="2" valign="top" class="listtopic">Secure Shell</td>
270
		</tr>
271
		<tr>
272
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
273
			<td width="78%" class="vtable">
274
				<input name="enablesshd" type="checkbox" id="enablesshd" value="yes" <?php if (isset($pconfig['enablesshd'])) echo "checked"; ?> onclick="enable_change(false)" />
275
				<strong>Enable Secure Shell</strong>
276
			</td>
277
		</tr>
278 74806cee Seth Mos
		<tr>
279
			<td width="22%" valign="top" class="vncell">SSH port</td>
280
			<td width="78%" class="vtable">
281
				<input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" onclick="enable_change(false)" />
282
				<br />
283
				<span class="vexpl">Note:  Leave this blank for the default of 22</span>
284
			</td>
285
		</tr>
286 9ecd6ab7 Erik Kristensen
		<tr>
287
			<td width="22%" valign="top">&nbsp;</td>
288
			<td width="78%">
289
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
290
			</td>
291
		</tr>
292
		<tr>
293
			<td colspan="2" class="list" height="12">&nbsp;</td>
294 48ce54d0 Scott Ullrich
		</tr>
295 9ecd6ab7 Erik Kristensen
		<tr>
296
			<td colspan="2" valign="top" class="listtopic">Shared Physical Network</td>
297
		</tr>
298
		<tr>
299
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
300
			<td width="78%" class="vtable">
301
				<input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked"; ?> onclick="enable_change(false)" />
302 3d0d1aa8 Colin Smith
				<strong>This will suppress ARP messages when interfaces share the same physical network</strong>
303 9ecd6ab7 Erik Kristensen
			</td>
304
		</tr>
305
		<tr>
306
			<td width="22%" valign="top">&nbsp;</td>
307
			<td width="78%">
308
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
309
			</td>
310
		</tr>
311
		<tr>
312
			<td colspan="2" class="list" height="12">&nbsp;</td>
313
		</tr>
314
		<tr>
315
			<td colspan="2" valign="top" class="listtopic">IPv6 tunneling</td>
316
		</tr>
317
		<tr>
318
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
319
			<td width="78%" class="vtable">
320
				<input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)" />
321
				<strong>NAT encapsulated IPv6 packets (IP protocol 41/RFC2893) to:</strong>
322
				<br /> <br />
323
				<input name="ipv6nat_ipaddr" type="text" class="formfld" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
324
				&nbsp;(IP address)<span class="vexpl"><br /> Don't forget to add a firewall rule to permit IPv6 packets!</span>
325
			</td>
326
		</tr>
327 b0703b01 Scott Ullrich
		<tr>
328
			<td colspan="2" class="list" height="12">&nbsp;</td>
329 48ce54d0 Scott Ullrich
		</tr>
330 02f0c58f Scott Ullrich
		<tr>
331
			<td colspan="2" valign="top" class="listtopic">Filtering Bridge</td>
332
		</tr>
333 48ce54d0 Scott Ullrich
                <tr>
334 3962b070 Scott Ullrich
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
335 48ce54d0 Scott Ullrich
                  <td width="78%" class="vtable">
336 3962b070 Scott Ullrich
                    <input name="filteringbridge_enable" type="checkbox" id="filteringbridge_enable" value="yes" <?php if ($pconfig['filteringbridge_enable']) echo "checked"; ?>>
337
                    <strong>Enable filtering bridge</strong><span class="vexpl"><br>
338 48ce54d0 Scott Ullrich
                    This will cause bridged packets to pass through the packet
339
                    filter in the same way as routed packets do (by default bridged
340
                    packets are always passed). If you enable this option, you'll
341
                    have to add filter rules to selectively permit traffic from
342 3962b070 Scott Ullrich
                    bridged interfaces.</span></td>
343 48ce54d0 Scott Ullrich
                </tr>
344 9ecd6ab7 Erik Kristensen
		<tr>
345
			<td width="22%" valign="top">&nbsp;</td>
346
			<td width="78%">
347
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
348
			</td>
349
		</tr>
350
		<tr>
351
			<td colspan="2" class="list" height="12">&nbsp;</td>
352
		</tr>
353
		<tr>
354
			<td colspan="2" valign="top" class="listtopic">webGUI SSL certificate/key</td>
355
		</tr>
356
		<tr>
357
			<td width="22%" valign="top" class="vncell">Certificate</td>
358
			<td width="78%" class="vtable">
359
				<textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
360
				<br />
361
				Paste a signed certificate in X.509 PEM format here. <a href="javascript:if(openwindow('system_advanced_create_certs.php') == false) alert('Popup blocker detected.  Action aborted.');" >Create</a> certificates automatically.
362
			</td>
363
		</tr>
364
		<tr>
365
			<td width="22%" valign="top" class="vncell">Key</td>
366
			<td width="78%" class="vtable">
367
				<textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
368
				<br />
369
				Paste an RSA private key in PEM format here.
370
			</td>
371
		</tr>
372
		<tr>
373
			<td width="22%" valign="top">&nbsp;</td>
374
			<td width="78%">
375
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
376
			</td>
377
		</tr>
378
		<tr>
379
			<td colspan="2" class="list" height="12">&nbsp;</td>
380
		</tr>
381
		<tr>
382
			<td colspan="2" valign="top" class="listtopic">Miscellaneous</td>
383
		</tr>
384 8d36fd1d Scott Ullrich
385
                <tr>
386
                  <td width="22%" valign="top" class="vncell">Device polling</td>
387
                  <td width="78%" class="vtable">
388
                    <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
389
                    <strong>Use device polling</strong><br>
390
                                        Device polling is a technique that lets the system periodically poll network devices for new
391
                                        data instead of relying on interrupts. This can reduce CPU load and therefore increase
392
                                        throughput, at the expense of a slightly higher forwarding delay (the devices are polled 1000 times
393 dabf1d2d Scott Ullrich
                                        per second). Not all NICs support polling; see the pfSense homepage for a list of supported cards.
394 8d36fd1d Scott Ullrich
                  </td>
395
                </tr>
396 48ce54d0 Scott Ullrich
397 9ecd6ab7 Erik Kristensen
		<tr>
398
			<td width="22%" valign="top" class="vncell">Console menu </td>
399
			<td width="78%" class="vtable">
400
				<input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?>  />
401
				<strong>Disable console menu</strong>
402
				<br />
403
				<span class="vexpl">Changes to this option will take effect after a reboot.</span>
404
			</td>
405
		</tr>
406 48ce54d0 Scott Ullrich
<?php if($g['platform'] == "pfSenseDISABLED"): ?>
407 a509ff63 Bill Marquette
		<tr>
408 9ecd6ab7 Erik Kristensen
			<td width="22%" valign="top" class="vncell">Hard disk standby time </td>
409
			<td width="78%" class="vtable">
410
				<select name="harddiskstandby" class="formfld">
411
<?php
412
				 	## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
413
					$sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
414
?>
415
					<option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
416
<?php
417 5b237745 Scott Ullrich
					foreach ($sbvals as $sbval):
418
						list($min,$val) = explode(",", $sbval); ?>
419 9ecd6ab7 Erik Kristensen
					<option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
420
<?php 				endforeach; ?>
421
				</select>
422
				<br />
423
				Puts the hard disk into standby mode when the selected amount of time after the last
424
				access has elapsed. <em>Do not set this for CF cards.</em>
425
			</td>
426
		</tr>
427 48ce54d0 Scott Ullrich
<?php endif; ?>
428 9ecd6ab7 Erik Kristensen
		<tr>
429
			<td width="22%" valign="top" class="vncell">webGUI anti-lockout</td>
430
			<td width="78%" class="vtable">
431
				<input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> />
432
				<strong>Disable webGUI anti-lockout rule</strong>
433
				<br />
434 48ce54d0 Scott Ullrich
				By default, access to the webGUI on the LAN interface is always permitted, regardless of the user-defined filter
435
				rule set. Enable this feature to control webGUI access (make sure to have a filter rule in place that allows you
436 9ecd6ab7 Erik Kristensen
				in, or you will lock yourself out!).
437
				<br />
438
				Hint: the &quot;set LAN IP address&quot; option in the console menu  resets this setting as well.
439
			</td>
440
		</tr>
441 bdac13de Scott Ullrich
		<tr>
442
			<td width="22%" valign="top" class="vncell">Static route filtering</td>
443
			<td width="78%" class="vtable">
444
				<input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked"; ?> />
445
				<strong>Bypass firewall rules for traffic on the same interface</strong>
446
				<br />
447 48ce54d0 Scott Ullrich
				This option only applies if you have defined one or more static routes. If it is enabled, traffic that enters and
448
 				leaves through the same interface will not be checked by the firewall. This may be desirable in some situations where
449 bdac13de Scott Ullrich
				multiple subnets are connected to the same interface.
450
				<br />
451
			</td>
452
		</tr>
453 9ecd6ab7 Erik Kristensen
		<tr>
454
			<td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
455
			<td width="78%" class="vtable">
456
				<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
457
				<strong>Prefer old IPsec SAs</strong>
458
				<br />
459
				By default, if several SAs match, the newest one is preferred if it's at least 30 seconds old.Select this option to always prefer old SAs over new ones.
460
			</td>
461 48ce54d0 Scott Ullrich
		</tr>
462 9ecd6ab7 Erik Kristensen
		<tr>
463
			<td width="22%" valign="top">&nbsp;</td>
464
			<td width="78%">
465
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
466
			</td>
467
		</tr>
468
		<tr>
469
			<td colspan="2" class="list" height="12">&nbsp;</td>
470
		</tr>
471
		<tr>
472
			<td colspan="2" valign="top" class="listtopic">Traffic Shaper and Firewall Advanced</td>
473
		</tr>
474
		<tr>
475
			<td width="22%" valign="top" class="vncell">FTP RFC 959 data port violation workaround</td>
476
			<td width="78%" class="vtable">
477
				<input name="rfc959workaround" type="checkbox" id="rfc959workaround" value="yes" <?php if (isset($config['system']['rfc959workaround'])) echo "checked"; ?> onclick="enable_change(false)" />
478
				<strong class="vexpl">Workaround for sites that violate RFC 959 which specifies that the data connection be sourced from the command port - 1 (typically port 20).  This workaround doesn't expose you to any extra risk as the firewall will still only allow connections on a port that the ftp-proxy is listening on.</strong>
479
				<br />
480
			</td>
481
		</tr>
482 8f498445 Scott Ullrich
		<tr>
483
			<td width="22%" valign="top" class="vncell">Clear DF bit instead of dropping</td>
484
			<td width="78%" class="vtable">
485
				<input name="scrubnodf" type="checkbox" id="scrubnodf" value="yes" <?php if (isset($config['system']['scrubnodf'])) echo "checked"; ?> onclick="enable_change(false)" />
486
				<strong class="vexpl">Workaround for operating systems that generate fragmented packets with the don't fragment (DF) bit set.  Linux NFS is known to do this.  This will cause the filter to not drop such packets but instead clear the don't fragment bit.  The filter will also randomize the IP identification field of outgoing packets with this option on, to compensate for operating systems that set the DF bit but set a zero IP identification header field.</strong>
487
				<br />
488
			</td>
489
		</tr>
490 9ecd6ab7 Erik Kristensen
		<tr>
491
			<td width="22%" valign="top" class="vncell">Firewall Optimization Options</td>
492
			<td width="78%" class="vtable">
493
				<select onChange="update_description(this.selectedIndex);" name="optimization" id="optimization">
494
					<option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected"; ?>>normal</option>
495
					<option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected"; ?>>high-latency</option>
496
					<option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected"; ?>>aggressive</option>
497
					<option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected"; ?>>conservative</option>
498
				</select>
499
				<br />
500 d4fddf14 Scott Ullrich
				<textarea cols="60" rows="2" id="info" name="info"style="padding:5px; border:1px dashed #990000; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
501 9ecd6ab7 Erik Kristensen
				<script language="javascript" type="text/javascript">
502
					update_description(document.forms[0].optimization.selectedIndex);
503
				</script>
504
				<br />
505
				<span class="vexpl"><b>Select which type of state table optimization your would like to use</b></span>
506
			</td>
507
		</tr>
508
		<tr>
509
			<td width="22%" valign="top" class="vncell">Disable Firewall</td>
510
			<td width="78%" class="vtable">
511
				<input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> onclick="enable_change(false)" />
512
				<strong>Disable the firewalls filter altogether.</strong>
513
				<br />
514 8d0abf6b Scott Ullrich
				<span class="vexpl">Note:  This basically converts pfSense into a routing only platform!<br>
515
				                    Note:  This will turn off NAT!
516
				</span>
517 9ecd6ab7 Erik Kristensen
			</td>
518
		</tr>
519
		<tr>
520
			<td width="22%" valign="top" class="vncell">Firewall Maximum States</td>
521
			<td width="78%" class="vtable">
522
				<input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" onclick="enable_change(false)" />
523
				<br />
524
				<strong>Maximum number of connections to hold in the firewall state table.</strong>
525
				<br />
526
				<span class="vexpl">Note:  Leave this blank for the default of 10000</span>
527
			</td>
528
		</tr>
529 a9b19d7f Scott Ullrich
		<tr>
530 b5675af6 Scott Ullrich
			<td width="22%" valign="top">&nbsp;</td>
531
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
532 a9b19d7f Scott Ullrich
		</tr>
533 b5675af6 Scott Ullrich
		<tr>
534
			<td colspan="2" class="list" height="12">&nbsp;</td>
535 48ce54d0 Scott Ullrich
		</tr>
536 a9b19d7f Scott Ullrich
		<tr>
537
			<td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
538
		</tr>
539
		<tr>
540 1b45d566 Scott Ullrich
			<td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
541 a9b19d7f Scott Ullrich
			<td width="78%" class="vtable">
542
				<input name="disablenatreflection" type="checkbox" id="disablenatreflection" value="yes" <?php if (isset($config['system']['disablenatreflection'])) echo "checked"; ?> onclick="enable_change(false)" />
543 3a9ba28f Scott Ullrich
				<strong>Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks.  Note: Reflection only works on port forward type items  and does not work for large ranges > 500 ports.</strong>
544 a9b19d7f Scott Ullrich
			</td>
545
		</tr>
546 9ecd6ab7 Erik Kristensen
		<tr>
547
			<td width="22%" valign="top">&nbsp;</td>
548
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
549
		</tr>
550
		<tr>
551
			<td colspan="2" class="list" height="12">&nbsp;</td>
552
		</tr>
553
	</tbody>
554
</table>
555 5b237745 Scott Ullrich
</form>
556 9ecd6ab7 Erik Kristensen
557
<script language="JavaScript" type="text/javascript">
558 5b237745 Scott Ullrich
<!--
559 9ecd6ab7 Erik Kristensen
	enable_change(false);
560 5b237745 Scott Ullrich
//-->
561
</script>
562 9ecd6ab7 Erik Kristensen
563 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
564 9ecd6ab7 Erik Kristensen
565 a6318c60 Scott Ullrich
</body>
566
</html>
567
568 8affb1da Scott Ullrich
<?php
569
570 a6318c60 Scott Ullrich
if ($_POST) {
571 1498fba3 Scott Ullrich
    ob_flush();
572
    flush();
573
    sleep(1)	;
574 a6318c60 Scott Ullrich
	if (!$input_errors) {
575
		if($_POST['disablefilter'] == "yes") {
576
			$config['system']['disablefilter'] = "enabled";
577
		} else {
578
			unset($config['system']['disablefilter']);
579
		}
580
		if($_POST['enablesshd'] == "yes") {
581
			$config['system']['enablesshd'] = "enabled";
582
			touch("{$g['tmp_path']}/start_sshd");
583
		} else {
584
			unset($config['system']['enablesshd']);
585
			mwexec("/usr/bin/killall sshd");
586 48ce54d0 Scott Ullrich
		}
587 a6318c60 Scott Ullrich
		$oldsshport = $config['system']['ssh']['port'];
588
		$config['system']['ssh']['port'] = $_POST['sshport'];
589
590 48ce54d0 Scott Ullrich
		if($_POST['polling_enable'] == "yes") {
591 a6318c60 Scott Ullrich
			$config['system']['polling'] = true;
592
			setup_polling();
593
		} else {
594
			unset($config['system']['polling']);
595
			setup_polling();
596
		}
597
598
		if($_POST['sharednet'] == "yes") {
599
			$config['system']['sharednet'] = true;
600
			system_disable_arp_wrong_if();
601
		} else {
602
			unset($config['system']['sharednet']);
603
			system_enable_arp_wrong_if();
604 48ce54d0 Scott Ullrich
		}
605 a6318c60 Scott Ullrich
606
		if($_POST['rfc959workaround'] == "yes")
607
			$config['system']['rfc959workaround'] = "enabled";
608
		else
609
			unset($config['system']['rfc959workaround']);
610
611
		if($_POST['ipv6nat_enable'] == "yes") {
612
			$config['diag']['ipv6nat']['enable'] = true;
613
			$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
614
		} else {
615
			unset($config['diag']['ipv6nat']['enable']);
616
			unset($config['diag']['ipv6nat']['ipaddr']);
617
		}
618
		$oldcert = $config['system']['webgui']['certificate'];
619
		$oldkey = $config['system']['webgui']['private-key'];
620
		$config['system']['webgui']['certificate'] = base64_encode($_POST['cert']);
621
		$config['system']['webgui']['private-key'] = base64_encode($_POST['key']);
622
		if($_POST['disableconsolemenu'] == "yes") {
623
			$config['system']['disableconsolemenu'] = true;
624
			auto_login(true);
625
		} else {
626
			unset($config['system']['disableconsolemenu']);
627
			auto_login(false);
628
		}
629
		unset($config['system']['webgui']['expanddiags']);
630
		$config['system']['optimization'] = $_POST['optimization'];
631 48ce54d0 Scott Ullrich
632 a6318c60 Scott Ullrich
		if($_POST['disablefirmwarecheck'] == "yes")
633
			$config['system']['disablefirmwarecheck'] = true;
634
		else
635
			unset($config['system']['disablefirmwarecheck']);
636
637
		if ($_POST['enableserial'] == "yes")
638
			$config['system']['enableserial'] = true;
639
		else
640
			unset($config['system']['enableserial']);
641
642
		if($_POST['harddiskstandby'] <> "") {
643
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
644
			system_set_harddisk_standby();
645
		} else
646
			unset($config['system']['harddiskstandby']);
647
648
		if ($_POST['noantilockout'] == "yes")
649
			$config['system']['webgui']['noantilockout'] = true;
650
		else
651
			unset($config['system']['webgui']['noantilockout']);
652
653
		/* Firewall and ALTQ options */
654
		$config['system']['maximumstates'] = $_POST['maximumstates'];
655
656
		if($_POST['enablesshd'] == "yes") {
657
			$config['system']['enablesshd'] = $_POST['enablesshd'];
658
		} else {
659
			unset($config['system']['enablesshd']);
660
		}
661
662
		if($_POST['disablenatreflection'] == "yes") {
663
			$config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
664
		} else {
665
			unset($config['system']['disablenatreflection']);
666
		}
667 48ce54d0 Scott Ullrich
668 a6318c60 Scott Ullrich
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
669 48ce54d0 Scott Ullrich
670
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;
671
672 a6318c60 Scott Ullrich
		write_config();
673 48ce54d0 Scott Ullrich
674 a6318c60 Scott Ullrich
		$retval = 0;
675
		config_lock();
676
		$retval = filter_configure();
677
		if(stristr($retval, "error") <> true)
678
		    $savemsg = get_std_save_message($retval);
679
		else
680
		    $savemsg = $retval;
681
		$retval |= interfaces_optional_configure();
682
		config_unlock();
683 48ce54d0 Scott Ullrich
684 a6318c60 Scott Ullrich
		setup_serial_port();
685 48ce54d0 Scott Ullrich
686 a6318c60 Scott Ullrich
		setup_filter_bridge();
687 48ce54d0 Scott Ullrich
688 a6318c60 Scott Ullrich
	}
689
}
690
691 04257637 Scott Ullrich
if (($config['system']['webgui']['certificate'] != $oldcert)
692
		|| ($config['system']['webgui']['private-key'] != $oldkey)) {
693 72a58eed Scott Ullrich
    ob_flush();
694 a8b10422 Scott Ullrich
    flush();
695
    log_error("webConfigurator certificates have changed.  Restarting webConfigurator.");
696
    sleep(1);
697 04257637 Scott Ullrich
	touch("/tmp/restart_webgui");
698
}
699
700 bdac13de Scott Ullrich
?>