Project

General

Profile

Download (27.8 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_advanced.php
5
        part of pfSense
6
        Copyright (C) 2005 Scott Ullrich
7

    
8
	originally 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['disablefilter'] = $config['system']['disablefilter'];
37
$pconfig['rfc959workaround'] = $config['system']['rfc959workaround'];
38
$pconfig['scrubnodf'] = $config['system']['scrubnodf'];
39
$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
$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
45
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
46
$pconfig['filteringbridge_enable'] = isset($config['bridge']['filteringbridge']);
47
$pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
48
$pconfig['maximumstates'] = $config['system']['maximumstates'];
49
$pconfig['disablerendevouz'] = $config['system']['disablerendevouz'];
50
$pconfig['enableserial'] = $config['system']['enableserial'];
51
$pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']);
52
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
53
$pconfig['enablesshd'] = $config['system']['enablesshd'];
54
$pconfig['sshport'] = $config['system']['ssh']['port'];
55
$pconfig['sharednet'] = $config['system']['sharednet'];
56
$pconfig['polling_enable'] = isset($config['system']['polling']);
57

    
58
$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
59

    
60
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
	if ($_POST['maximumstates'] && !is_numericint($_POST['maximumstates'])) {
70
		$input_errors[] = "The Firewall Maximum States value must be an integer.";
71
	}
72
	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
	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
	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
	}
89
	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
	if ($_POST['sshport'] <> "") {
96
		if( ! is_port($_POST['sshport'])) {
97
			$input_errors[] = "You must specify a valid port number";
98
		}
99
	}
100

    
101
	if (!$input_errors) {
102
		if($_POST['disablefilter'] == "yes") {
103
			$config['system']['disablefilter'] = "enabled";
104
		} else {
105
			unset($config['system']['disablefilter']);
106
		}
107
		if($_POST['enablesshd'] == "yes") {
108
			$config['system']['enablesshd'] = "enabled";
109
			touch("{$g['tmp_path']}/start_sshd");
110
		} else {
111
			unset($config['system']['enablesshd']);
112
			mwexec("/usr/bin/killall sshd");
113
		}		
114
		$oldsshport = $config['system']['ssh']['port'];
115
		$config['system']['ssh']['port'] = $_POST['sshport'];
116

    
117
		if($_POST['polling_enable'] == "yes") { 
118
			$config['system']['polling'] = true;
119
			setup_polling();
120
		} else {
121
			unset($config['system']['polling']);
122
			setup_polling();
123
		}
124

    
125
		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
		if($_POST['rfc959workaround'] == "yes")
134
			$config['system']['rfc959workaround'] = "enabled";
135
		else
136
			unset($config['system']['rfc959workaround']);
137

    
138
		if($_POST['scrubnodf'] == "yes")
139
			$config['system']['scrubnodf'] = "enabled";
140
		else
141
			unset($config['system']['scrubnodf']);
142

    
143
		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
		}
150
		$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
		if($_POST['disableconsolemenu'] == "yes") {
155
			$config['system']['disableconsolemenu'] = true;
156
			auto_login(true);
157
		} else {
158
			unset($config['system']['disableconsolemenu']);
159
			auto_login(false);
160
		}
161
		unset($config['system']['webgui']['expanddiags']);
162
		$config['system']['optimization'] = $_POST['optimization'];
163
		
164
		if($_POST['disablefirmwarecheck'] == "yes")
165
			$config['system']['disablefirmwarecheck'] = true;
166
		else
167
			unset($config['system']['disablefirmwarecheck']);
168

    
169
		if ($_POST['enableserial'] == "yes")
170
			$config['system']['enableserial'] = true;
171
		else
172
			unset($config['system']['enableserial']);
173

    
174
		if($_POST['harddiskstandby'] <> "") {
175
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
176
			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

    
185
		/* Firewall and ALTQ options */
186
		$config['system']['maximumstates'] = $_POST['maximumstates'];
187

    
188
		if($_POST['enablesshd'] == "yes") {
189
			$config['system']['enablesshd'] = $_POST['enablesshd'];
190
		} else {
191
			unset($config['system']['enablesshd']);
192
		}
193

    
194
		if($_POST['disablenatreflection'] == "yes") {
195
			$config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
196
		} else {
197
			unset($config['system']['disablenatreflection']);
198
		}
199
	
200
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
201
	
202
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;	
203
	
204
		write_config();
205
			
206
		$retval = 0;
207
		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
			
216
		setup_serial_port();
217
		
218
		setup_filter_bridge();
219
		
220
	}
221
}
222

    
223
$pgtitle = "System: Advanced functions";
224
include("head.inc");
225

    
226
?>
227

    
228
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
229

    
230
<?php include("fbegin.inc"); ?>
231

    
232
<p class="pgtitle"><?=$pgtitle?></p>
233

    
234
<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

    
240
<table width="100%" border="0" cellpadding="6" cellspacing="0">
241
	<tbody>
242
		<?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
243
		<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
				<br>
252
				<span class="vexpl">Note:  This will disable the internal video card/keyboard</span>
253
			</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
		<?php endif; ?>
264
		<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
		<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
		<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
				<strong>This will suppress ARP messages when interfaces share the same physical network</strong>
299
			</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
		<tr>
324
			<td colspan="2" class="list" height="12">&nbsp;</td>
325
		</tr>		
326
		<tr>
327
			<td colspan="2" valign="top" class="listtopic">Filtering Bridge</td>
328
		</tr>
329
                <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
		<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

    
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
                                        per second). Not all NICs support polling; see the pfSense homepage for a list of supported cards.
390
                  </td>
391
                </tr>
392
		
393
		<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
		</tr>
411
<?php if($g['platform'] == "pfSenseDISABLED"): ?>		
412
		<tr>
413
			<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
					foreach ($sbvals as $sbval):
423
						list($min,$val) = explode(",", $sbval); ?>
424
					<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
<?php endif; ?>		
433
		<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
		<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
		<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
				<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
				<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
				<span class="vexpl">Note:  This basically converts pfSense into a routing only platform!<br>
508
				                    Note:  This will turn off NAT!
509
				</span>
510
			</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
		<tr>
523
			<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
		</tr>
526
		<tr>
527
			<td colspan="2" class="list" height="12">&nbsp;</td>
528
		</tr>		
529
		<tr>
530
			<td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
531
		</tr>
532
		<tr>
533
			<td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
534
			<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
				<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
			</td>
538
		</tr>
539
		<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
</form>
549

    
550
<script language="JavaScript" type="text/javascript">
551
<!--
552
	enable_change(false);
553
//-->
554
</script>
555

    
556
<?php include("fend.inc"); ?>
557

    
558
</body>
559
</html>
560

    
561
<?php
562

    
563
if ($_POST) {
564
    ob_flush();
565
    flush();
566
    sleep(1)	;
567
	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
if (($config['system']['webgui']['certificate'] != $oldcert)
685
		|| ($config['system']['webgui']['private-key'] != $oldkey)) {
686
    ob_flush();
687
    flush();
688
    log_error("webConfigurator certificates have changed.  Restarting webConfigurator.");
689
    sleep(1);
690
	touch("/tmp/restart_webgui");
691
}
692

    
693
?>
(127-127/163)