Project

General

Profile

Download (27.8 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 222b5299 Scott Ullrich
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 36aaefff Scott Ullrich
		}		
114 74806cee Seth Mos
		$oldsshport = $config['system']['ssh']['port'];
115
		$config['system']['ssh']['port'] = $_POST['sshport'];
116 243aa7b9 Scott Ullrich
117 562fca6d 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
		}		
132
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 5c50ae40 Scott Ullrich
		
164
		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
	
200 d5967a9a Scott Ullrich
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
201 15a87e25 Scott Ullrich
	
202 3962b070 Scott Ullrich
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;	
203
	
204 5b237745 Scott Ullrich
		write_config();
205 b3d44462 Scott Ullrich
			
206 5b237745 Scott Ullrich
		$retval = 0;
207 3851094f Scott Ullrich
		config_lock();
208
		$retval = filter_configure();
209
		if(stristr($retval, "error") <> true)
210
		    $savemsg = get_std_save_message($retval);
211
		else
212
		    $savemsg = $retval;
213
		$retval |= interfaces_optional_configure();
214
		config_unlock();
215 82184ab0 Scott Ullrich
			
216 96af3ad5 Scott Ullrich
		setup_serial_port();
217 82184ab0 Scott Ullrich
		
218 3962b070 Scott Ullrich
		setup_filter_bridge();
219
		
220 5b237745 Scott Ullrich
	}
221
}
222 b63695db Scott Ullrich
223
$pgtitle = "System: Advanced functions";
224
include("head.inc");
225
226 5b237745 Scott Ullrich
?>
227 b63695db Scott Ullrich
228 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
229 9ecd6ab7 Erik Kristensen
230 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
231 9ecd6ab7 Erik Kristensen
232 74f446e8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
233 13128695 Scott Ullrich
234 9ecd6ab7 Erik Kristensen
<form action="system_advanced.php" method="post" name="iform" id="iform">
235
<?php if ($input_errors) print_input_errors($input_errors); ?>
236
<?php if ($savemsg) print_info_box($savemsg); ?>
237
<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>
238
<br />
239 416ed28d Scott Ullrich
240 9ecd6ab7 Erik Kristensen
<table width="100%" border="0" cellpadding="6" cellspacing="0">
241
	<tbody>
242 dbb0b7d6 Holger Bauer
		<?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
243 9ecd6ab7 Erik Kristensen
		<tr>
244
			<td colspan="2" valign="top" class="listtopic">Enable Serial Console</td>
245
		</tr>
246
		<tr>
247
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
248
			<td width="78%" class="vtable">
249
				<input name="enableserial" type="checkbox" id="enableserial" value="yes" <?php if (isset($pconfig['enableserial'])) echo "checked"; ?> onclick="enable_change(false)" />
250
				<strong>This will enable the first serial port with 9600/8/N/1</strong>
251 b8467d8e Scott Ullrich
				<br>
252 3446ca38 Scott Ullrich
				<span class="vexpl">Note:  This will disable the internal video card/keyboard</span>
253 9ecd6ab7 Erik Kristensen
			</td>
254
		</tr>
255
		<tr>
256
			<td width="22%" valign="top">&nbsp;</td>
257
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
258
		</tr>
259
		</tr>
260
		<tr>
261
			<td colspan="2" class="list" height="12"></td>
262
		</tr>		
263 0831bc86 Scott Ullrich
		<?php endif; ?>
264 9ecd6ab7 Erik Kristensen
		<tr>
265
			<td colspan="2" valign="top" class="listtopic">Secure Shell</td>
266
		</tr>
267
		<tr>
268
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
269
			<td width="78%" class="vtable">
270
				<input name="enablesshd" type="checkbox" id="enablesshd" value="yes" <?php if (isset($pconfig['enablesshd'])) echo "checked"; ?> onclick="enable_change(false)" />
271
				<strong>Enable Secure Shell</strong>
272
			</td>
273
		</tr>
274 74806cee Seth Mos
		<tr>
275
			<td width="22%" valign="top" class="vncell">SSH port</td>
276
			<td width="78%" class="vtable">
277
				<input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" onclick="enable_change(false)" />
278
				<br />
279
				<span class="vexpl">Note:  Leave this blank for the default of 22</span>
280
			</td>
281
		</tr>
282 9ecd6ab7 Erik Kristensen
		<tr>
283
			<td width="22%" valign="top">&nbsp;</td>
284
			<td width="78%">
285
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
286
			</td>
287
		</tr>
288
		<tr>
289
			<td colspan="2" class="list" height="12">&nbsp;</td>
290
		</tr>		
291
		<tr>
292
			<td colspan="2" valign="top" class="listtopic">Shared Physical Network</td>
293
		</tr>
294
		<tr>
295
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
296
			<td width="78%" class="vtable">
297
				<input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked"; ?> onclick="enable_change(false)" />
298 3d0d1aa8 Colin Smith
				<strong>This will suppress ARP messages when interfaces share the same physical network</strong>
299 9ecd6ab7 Erik Kristensen
			</td>
300
		</tr>
301
		<tr>
302
			<td width="22%" valign="top">&nbsp;</td>
303
			<td width="78%">
304
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
305
			</td>
306
		</tr>
307
		<tr>
308
			<td colspan="2" class="list" height="12">&nbsp;</td>
309
		</tr>
310
		<tr>
311
			<td colspan="2" valign="top" class="listtopic">IPv6 tunneling</td>
312
		</tr>
313
		<tr>
314
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
315
			<td width="78%" class="vtable">
316
				<input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)" />
317
				<strong>NAT encapsulated IPv6 packets (IP protocol 41/RFC2893) to:</strong>
318
				<br /> <br />
319
				<input name="ipv6nat_ipaddr" type="text" class="formfld" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
320
				&nbsp;(IP address)<span class="vexpl"><br /> Don't forget to add a firewall rule to permit IPv6 packets!</span>
321
			</td>
322
		</tr>
323 b0703b01 Scott Ullrich
		<tr>
324
			<td colspan="2" class="list" height="12">&nbsp;</td>
325
		</tr>		
326 02f0c58f Scott Ullrich
		<tr>
327
			<td colspan="2" valign="top" class="listtopic">Filtering Bridge</td>
328
		</tr>
329 3962b070 Scott Ullrich
                <tr> 
330
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
331
                  <td width="78%" class="vtable"> 
332
                    <input name="filteringbridge_enable" type="checkbox" id="filteringbridge_enable" value="yes" <?php if ($pconfig['filteringbridge_enable']) echo "checked"; ?>>
333
                    <strong>Enable filtering bridge</strong><span class="vexpl"><br>
334
                    This will cause bridged packets to pass through the packet 
335
                    filter in the same way as routed packets do (by default bridged 
336
                    packets are always passed). If you enable this option, you'll 
337
                    have to add filter rules to selectively permit traffic from 
338
                    bridged interfaces.</span></td>
339
                </tr>			
340 9ecd6ab7 Erik Kristensen
		<tr>
341
			<td width="22%" valign="top">&nbsp;</td>
342
			<td width="78%">
343
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
344
			</td>
345
		</tr>
346
		<tr>
347
			<td colspan="2" class="list" height="12">&nbsp;</td>
348
		</tr>
349
		<tr>
350
			<td colspan="2" valign="top" class="listtopic">webGUI SSL certificate/key</td>
351
		</tr>
352
		<tr>
353
			<td width="22%" valign="top" class="vncell">Certificate</td>
354
			<td width="78%" class="vtable">
355
				<textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
356
				<br />
357
				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.
358
			</td>
359
		</tr>
360
		<tr>
361
			<td width="22%" valign="top" class="vncell">Key</td>
362
			<td width="78%" class="vtable">
363
				<textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
364
				<br />
365
				Paste an RSA private key in PEM format here.
366
			</td>
367
		</tr>
368
		<tr>
369
			<td width="22%" valign="top">&nbsp;</td>
370
			<td width="78%">
371
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
372
			</td>
373
		</tr>
374
		<tr>
375
			<td colspan="2" class="list" height="12">&nbsp;</td>
376
		</tr>
377
		<tr>
378
			<td colspan="2" valign="top" class="listtopic">Miscellaneous</td>
379
		</tr>
380 8d36fd1d Scott Ullrich
381
                <tr>
382
                  <td width="22%" valign="top" class="vncell">Device polling</td>
383
                  <td width="78%" class="vtable">
384
                    <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
385
                    <strong>Use device polling</strong><br>
386
                                        Device polling is a technique that lets the system periodically poll network devices for new
387
                                        data instead of relying on interrupts. This can reduce CPU load and therefore increase
388
                                        throughput, at the expense of a slightly higher forwarding delay (the devices are polled 1000 times
389 dabf1d2d Scott Ullrich
                                        per second). Not all NICs support polling; see the pfSense homepage for a list of supported cards.
390 8d36fd1d Scott Ullrich
                  </td>
391
                </tr>
392
		
393 9ecd6ab7 Erik Kristensen
		<tr>
394
			<td width="22%" valign="top" class="vncell">Console menu </td>
395
			<td width="78%" class="vtable">
396
				<input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?>  />
397
				<strong>Disable console menu</strong>
398
				<br />
399
				<span class="vexpl">Changes to this option will take effect after a reboot.</span>
400
			</td>
401
		</tr>
402
		<tr>
403
			<td valign="top" class="vncell">Firmware version check</td>
404
			<td class="vtable">
405
				<input name="disablefirmwarecheck" type="checkbox" id="disablefirmwarecheck" value="yes" <?php if ($pconfig['disablefirmwarecheck']) echo "checked"; ?>  />
406
				<strong>Disable firmware version check</strong>
407
				<br />
408
				<span class="vexpl">This will cause pfSense not to check for newer firmware versions when the <a href="system_firmware.php">System: Firmware</a> page is viewed.</span>
409
			</td>
410 abf5a84b Scott Ullrich
		</tr>
411 4c0d4635 Scott Ullrich
<?php if($g['platform'] == "pfSenseDISABLED"): ?>		
412 a509ff63 Bill Marquette
		<tr>
413 9ecd6ab7 Erik Kristensen
			<td width="22%" valign="top" class="vncell">Hard disk standby time </td>
414
			<td width="78%" class="vtable">
415
				<select name="harddiskstandby" class="formfld">
416
<?php
417
				 	## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
418
					$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");
419
?>
420
					<option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
421
<?php
422 5b237745 Scott Ullrich
					foreach ($sbvals as $sbval):
423
						list($min,$val) = explode(",", $sbval); ?>
424 9ecd6ab7 Erik Kristensen
					<option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
425
<?php 				endforeach; ?>
426
				</select>
427
				<br />
428
				Puts the hard disk into standby mode when the selected amount of time after the last
429
				access has elapsed. <em>Do not set this for CF cards.</em>
430
			</td>
431
		</tr>
432 abf5a84b Scott Ullrich
<?php endif; ?>		
433 9ecd6ab7 Erik Kristensen
		<tr>
434
			<td width="22%" valign="top" class="vncell">webGUI anti-lockout</td>
435
			<td width="78%" class="vtable">
436
				<input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> />
437
				<strong>Disable webGUI anti-lockout rule</strong>
438
				<br />
439
				By default, access to the webGUI on the LAN interface is always permitted, regardless of the user-defined filter 
440
				rule set. Enable this feature to control webGUI access (make sure to have a filter rule in place that allows you 
441
				in, or you will lock yourself out!).
442
				<br />
443
				Hint: the &quot;set LAN IP address&quot; option in the console menu  resets this setting as well.
444
			</td>
445
		</tr>
446
		<tr>
447
			<td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
448
			<td width="78%" class="vtable">
449
				<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
450
				<strong>Prefer old IPsec SAs</strong>
451
				<br />
452
				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.
453
			</td>
454
		</tr>		
455
		<tr>
456
			<td width="22%" valign="top">&nbsp;</td>
457
			<td width="78%">
458
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
459
			</td>
460
		</tr>
461
		<tr>
462
			<td colspan="2" class="list" height="12">&nbsp;</td>
463
		</tr>
464
		<tr>
465
			<td colspan="2" valign="top" class="listtopic">Traffic Shaper and Firewall Advanced</td>
466
		</tr>
467
		<tr>
468
			<td width="22%" valign="top" class="vncell">FTP RFC 959 data port violation workaround</td>
469
			<td width="78%" class="vtable">
470
				<input name="rfc959workaround" type="checkbox" id="rfc959workaround" value="yes" <?php if (isset($config['system']['rfc959workaround'])) echo "checked"; ?> onclick="enable_change(false)" />
471
				<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>
472
				<br />
473
			</td>
474
		</tr>
475 8f498445 Scott Ullrich
		<tr>
476
			<td width="22%" valign="top" class="vncell">Clear DF bit instead of dropping</td>
477
			<td width="78%" class="vtable">
478
				<input name="scrubnodf" type="checkbox" id="scrubnodf" value="yes" <?php if (isset($config['system']['scrubnodf'])) echo "checked"; ?> onclick="enable_change(false)" />
479
				<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>
480
				<br />
481
			</td>
482
		</tr>
483 9ecd6ab7 Erik Kristensen
		<tr>
484
			<td width="22%" valign="top" class="vncell">Firewall Optimization Options</td>
485
			<td width="78%" class="vtable">
486
				<select onChange="update_description(this.selectedIndex);" name="optimization" id="optimization">
487
					<option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected"; ?>>normal</option>
488
					<option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected"; ?>>high-latency</option>
489
					<option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected"; ?>>aggressive</option>
490
					<option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected"; ?>>conservative</option>
491
				</select>
492
				<br />
493 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>
494 9ecd6ab7 Erik Kristensen
				<script language="javascript" type="text/javascript">
495
					update_description(document.forms[0].optimization.selectedIndex);
496
				</script>
497
				<br />
498
				<span class="vexpl"><b>Select which type of state table optimization your would like to use</b></span>
499
			</td>
500
		</tr>
501
		<tr>
502
			<td width="22%" valign="top" class="vncell">Disable Firewall</td>
503
			<td width="78%" class="vtable">
504
				<input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> onclick="enable_change(false)" />
505
				<strong>Disable the firewalls filter altogether.</strong>
506
				<br />
507 8d0abf6b Scott Ullrich
				<span class="vexpl">Note:  This basically converts pfSense into a routing only platform!<br>
508
				                    Note:  This will turn off NAT!
509
				</span>
510 9ecd6ab7 Erik Kristensen
			</td>
511
		</tr>
512
		<tr>
513
			<td width="22%" valign="top" class="vncell">Firewall Maximum States</td>
514
			<td width="78%" class="vtable">
515
				<input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" onclick="enable_change(false)" />
516
				<br />
517
				<strong>Maximum number of connections to hold in the firewall state table.</strong>
518
				<br />
519
				<span class="vexpl">Note:  Leave this blank for the default of 10000</span>
520
			</td>
521
		</tr>
522 a9b19d7f Scott Ullrich
		<tr>
523 b5675af6 Scott Ullrich
			<td width="22%" valign="top">&nbsp;</td>
524
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
525 a9b19d7f Scott Ullrich
		</tr>
526 b5675af6 Scott Ullrich
		<tr>
527
			<td colspan="2" class="list" height="12">&nbsp;</td>
528
		</tr>		
529 a9b19d7f Scott Ullrich
		<tr>
530
			<td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
531
		</tr>
532
		<tr>
533 1b45d566 Scott Ullrich
			<td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
534 a9b19d7f Scott Ullrich
			<td width="78%" class="vtable">
535
				<input name="disablenatreflection" type="checkbox" id="disablenatreflection" value="yes" <?php if (isset($config['system']['disablenatreflection'])) echo "checked"; ?> onclick="enable_change(false)" />
536 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>
537 a9b19d7f Scott Ullrich
			</td>
538
		</tr>
539 9ecd6ab7 Erik Kristensen
		<tr>
540
			<td width="22%" valign="top">&nbsp;</td>
541
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
542
		</tr>
543
		<tr>
544
			<td colspan="2" class="list" height="12">&nbsp;</td>
545
		</tr>
546
	</tbody>
547
</table>
548 5b237745 Scott Ullrich
</form>
549 9ecd6ab7 Erik Kristensen
550
<script language="JavaScript" type="text/javascript">
551 5b237745 Scott Ullrich
<!--
552 9ecd6ab7 Erik Kristensen
	enable_change(false);
553 5b237745 Scott Ullrich
//-->
554
</script>
555 9ecd6ab7 Erik Kristensen
556 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
557 9ecd6ab7 Erik Kristensen
558 a6318c60 Scott Ullrich
</body>
559
</html>
560
561 8affb1da Scott Ullrich
<?php
562
563 a6318c60 Scott Ullrich
if ($_POST) {
564 1498fba3 Scott Ullrich
    ob_flush();
565
    flush();
566
    sleep(1)	;
567 a6318c60 Scott Ullrich
	if (!$input_errors) {
568
		if($_POST['disablefilter'] == "yes") {
569
			$config['system']['disablefilter'] = "enabled";
570
		} else {
571
			unset($config['system']['disablefilter']);
572
		}
573
		if($_POST['enablesshd'] == "yes") {
574
			$config['system']['enablesshd'] = "enabled";
575
			touch("{$g['tmp_path']}/start_sshd");
576
		} else {
577
			unset($config['system']['enablesshd']);
578
			mwexec("/usr/bin/killall sshd");
579
		}		
580
		$oldsshport = $config['system']['ssh']['port'];
581
		$config['system']['ssh']['port'] = $_POST['sshport'];
582
583
		if($_POST['polling_enable'] == "yes") { 
584
			$config['system']['polling'] = true;
585
			setup_polling();
586
		} else {
587
			unset($config['system']['polling']);
588
			setup_polling();
589
		}
590
591
		if($_POST['sharednet'] == "yes") {
592
			$config['system']['sharednet'] = true;
593
			system_disable_arp_wrong_if();
594
		} else {
595
			unset($config['system']['sharednet']);
596
			system_enable_arp_wrong_if();
597
		}		
598
599
		if($_POST['rfc959workaround'] == "yes")
600
			$config['system']['rfc959workaround'] = "enabled";
601
		else
602
			unset($config['system']['rfc959workaround']);
603
604
		if($_POST['ipv6nat_enable'] == "yes") {
605
			$config['diag']['ipv6nat']['enable'] = true;
606
			$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
607
		} else {
608
			unset($config['diag']['ipv6nat']['enable']);
609
			unset($config['diag']['ipv6nat']['ipaddr']);
610
		}
611
		$oldcert = $config['system']['webgui']['certificate'];
612
		$oldkey = $config['system']['webgui']['private-key'];
613
		$config['system']['webgui']['certificate'] = base64_encode($_POST['cert']);
614
		$config['system']['webgui']['private-key'] = base64_encode($_POST['key']);
615
		if($_POST['disableconsolemenu'] == "yes") {
616
			$config['system']['disableconsolemenu'] = true;
617
			auto_login(true);
618
		} else {
619
			unset($config['system']['disableconsolemenu']);
620
			auto_login(false);
621
		}
622
		unset($config['system']['webgui']['expanddiags']);
623
		$config['system']['optimization'] = $_POST['optimization'];
624
		
625
		if($_POST['disablefirmwarecheck'] == "yes")
626
			$config['system']['disablefirmwarecheck'] = true;
627
		else
628
			unset($config['system']['disablefirmwarecheck']);
629
630
		if ($_POST['enableserial'] == "yes")
631
			$config['system']['enableserial'] = true;
632
		else
633
			unset($config['system']['enableserial']);
634
635
		if($_POST['harddiskstandby'] <> "") {
636
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
637
			system_set_harddisk_standby();
638
		} else
639
			unset($config['system']['harddiskstandby']);
640
641
		if ($_POST['noantilockout'] == "yes")
642
			$config['system']['webgui']['noantilockout'] = true;
643
		else
644
			unset($config['system']['webgui']['noantilockout']);
645
646
		/* Firewall and ALTQ options */
647
		$config['system']['maximumstates'] = $_POST['maximumstates'];
648
649
		if($_POST['enablesshd'] == "yes") {
650
			$config['system']['enablesshd'] = $_POST['enablesshd'];
651
		} else {
652
			unset($config['system']['enablesshd']);
653
		}
654
655
		if($_POST['disablenatreflection'] == "yes") {
656
			$config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
657
		} else {
658
			unset($config['system']['disablenatreflection']);
659
		}
660
	
661
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
662
	
663
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;	
664
	
665
		write_config();
666
			
667
		$retval = 0;
668
		config_lock();
669
		$retval = filter_configure();
670
		if(stristr($retval, "error") <> true)
671
		    $savemsg = get_std_save_message($retval);
672
		else
673
		    $savemsg = $retval;
674
		$retval |= interfaces_optional_configure();
675
		config_unlock();
676
			
677
		setup_serial_port();
678
		
679
		setup_filter_bridge();
680
		
681
	}
682
}
683
684 04257637 Scott Ullrich
if (($config['system']['webgui']['certificate'] != $oldcert)
685
		|| ($config['system']['webgui']['private-key'] != $oldkey)) {
686 72a58eed Scott Ullrich
    ob_flush();
687 a8b10422 Scott Ullrich
    flush();
688
    log_error("webConfigurator certificates have changed.  Restarting webConfigurator.");
689
    sleep(1);
690 04257637 Scott Ullrich
	touch("/tmp/restart_webgui");
691
}
692
693 a8b10422 Scott Ullrich
?>