Project

General

Profile

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

    
9
	originally part of m0n0wall (http://m0n0.ch/wall)
10
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34

    
35
require("guiconfig.inc");
36

    
37
$pconfig['disablefilter'] = $config['system']['disablefilter'];
38
$pconfig['rfc959workaround'] = $config['system']['rfc959workaround'];
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['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
47
/* billm: alternate schedulers are currently disable */
48
/* 
49
 * $pconfig['schedulertype'] = $config['shaper']['schedulertype'];
50
 */
51
$pconfig['maximumstates'] = $config['system']['maximumstates'];
52
$pconfig['theme'] = $config['system']['theme'];
53
$pconfig['disablerendevouz'] = $config['system']['disablerendevouz'];
54
$pconfig['enableserial'] = $config['system']['enableserial'];
55
$pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']);
56
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
57
$pconfig['enablesshd'] = $config['system']['enablesshd'];
58
$pconfig['sshport'] = $config['system']['ssh']['port'];
59
$pconfig['sharednet'] = $config['system']['sharednet'];
60
$pconfig['polling_enable'] = isset($config['system']['polling']);
61

    
62
$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
63

    
64
if ($_POST) {
65

    
66
	unset($input_errors);
67
	$pconfig = $_POST;
68

    
69
	/* input validation */
70
	if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr'])) {
71
		$input_errors[] = "You must specify an IP address to NAT IPv6 packets.";
72
	}
73
	if ($_POST['maximumstates'] && !is_numericint($_POST['maximumstates'])) {
74
		$input_errors[] = "The Firewall Maximum States value must be an integer.";
75
	}
76
	if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
77
		$input_errors[] = "The TCP idle timeout must be an integer.";
78
	}
79
	if (($_POST['cert'] && !$_POST['key']) || ($_POST['key'] && !$_POST['cert'])) {
80
		$input_errors[] = "Certificate and key must always be specified together.";
81
	} else if ($_POST['cert'] && $_POST['key']) {
82
		if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
83
			$input_errors[] = "This certificate does not appear to be valid.";
84
		if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
85
			$input_errors[] = "This key does not appear to be valid.";
86
	if ($_POST['altfirmwareurl'])
87
		if ($_POST['firmwareurl'] == "" || $_POST['firmwarename'] == "")
88
		$input_errors[] = "You must specify a base URL and a filename for the alternate firmware.";
89
	if ($_POST['altpkgconfigurl'])
90
		if ($_POST['pkgconfig_base_url'] == "" || $_POST['pkgconfig_filename'] == "")
91
		$input_errors[] = "You must specifiy and base URL and a filename before using an alternate pkg_config.xml.";
92
	}
93
	if ($_POST['maximumstates'] <> "") {
94
		if ($_POST['maximumstates'] < 1000)
95
			$input_errors[] = "States must be above 1000 and below 100000000";
96
		if ($_POST['maximumstates'] > 100000000)
97
			$input_errors[] = "States must be above 1000 and below 100000000";
98
	}
99
	if ($_POST['sshport'] <> "") {
100
		if( ! is_port($_POST['sshport'])) {
101
			$input_errors[] = "You must specify a valid port number";
102
		}
103
	}
104

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

    
121
		if($_POST['polling_enable'] == "yes") { 
122
			$config['system']['polling'] = true;
123
			setup_polling();
124
		} else {
125
			unset($config['system']['polling']);
126
			setup_polling();
127
		}
128

    
129
		if($_POST['sharednet'] == "yes") {
130
			$config['system']['sharednet'] = true;
131
			system_disable_arp_wrong_if();
132
		} else {
133
			unset($config['system']['sharednet']);
134
			system_enable_arp_wrong_if();
135
		}		
136

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

    
142
		if($_POST['ipv6nat_enable'] == "yes") {
143
			$config['diag']['ipv6nat']['enable'] = true;
144
			$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
145
		} else {
146
			unset($config['diag']['ipv6nat']['enable']);
147
			unset($config['diag']['ipv6nat']['ipaddr']);
148
		}
149
		$oldcert = $config['system']['webgui']['certificate'];
150
		$oldkey = $config['system']['webgui']['private-key'];
151
		$config['system']['webgui']['certificate'] = base64_encode($_POST['cert']);
152
		$config['system']['webgui']['private-key'] = base64_encode($_POST['key']);
153
		if($_POST['disableconsolemenu'] == "yes") {
154
			$config['system']['disableconsolemenu'] = true;
155
		} else {
156
			unset($config['system']['disableconsolemenu']);
157
		}
158
		unset($config['system']['webgui']['expanddiags']);
159
		$config['system']['optimization'] = $_POST['optimization'];
160
		
161
		if($_POST['disablefirmwarecheck'] == "yes")
162
			$config['system']['disablefirmwarecheck'] = true;
163
		else
164
			unset($config['system']['disablefirmwarecheck']);
165

    
166
		if ($_POST['enableserial'] == "yes")
167
			$config['system']['enableserial'] = true;
168
		else
169
			unset($config['system']['enableserial']);
170

    
171
		if($_POST['harddiskstandby'] <> "") {
172
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
173
			system_set_harddisk_standby();
174
		} else
175
			unset($config['system']['harddiskstandby']);
176

    
177
		if ($_POST['noantilockout'] == "yes")
178
			$config['system']['webgui']['noantilockout'] = true;
179
		else
180
			unset($config['system']['webgui']['noantilockout']);
181

    
182
		/* Firewall and ALTQ options */
183
		$config['shaper']['schedulertype'] = $_POST['schedulertype'];
184
		$config['system']['maximumstates'] = $_POST['maximumstates'];
185

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

    
192
		if($_POST['disablenatreflection'] == "yes") {
193
			$config['system']['disablenatreflection'] = $_POST['disablenatreflection'];
194
		} else {
195
			unset($config['system']['disablenatreflection']);
196
		}
197
	
198
                $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
199
	
200
		/* pfSense themes */
201
		$config['theme'] = $_POST['theme'];
202

    
203
		write_config();
204

    
205
		if (($config['system']['webgui']['certificate'] != $oldcert)
206
				|| ($config['system']['webgui']['private-key'] != $oldkey)) {
207
			system_webgui_start();
208
		}
209

    
210
			
211
		$retval = 0;
212
		config_lock();
213
		$retval = filter_configure();
214
		if(stristr($retval, "error") <> true)
215
		    $savemsg = get_std_save_message($retval);
216
		else
217
		    $savemsg = $retval;
218
		$retval |= interfaces_optional_configure();
219
		config_unlock();
220

    
221
		conf_mount_rw();
222

    
223
		/* serial console - write out /boot.config */
224
		if(file_exists("/boot.config"))
225
			$boot_config = file_get_contents("/boot.config");
226
		else
227
			$boot_config = "";
228
			
229
		$boot_config_split = split("\n", $boot_config);
230
		$fd = fopen("/boot.config","w");
231
		if($fd) {
232
			foreach($boot_config_split as $bcs) {
233
				if(stristr($bcs, "-D")) {
234
					/* DONT WRITE OUT, WE'LL DO IT LATER */	
235
				} else {
236
					if($bcs <> "")
237
						fwrite($fd, "{$bcs}\n");
238
				}
239
			}
240
			if(isset($config['system']['enableserial'])) {
241
				fwrite($fd, "-D");
242
			}			
243
			fclose($fd);
244
		}
245
		/* serial console - write out /boot/loader.conf */
246
		$boot_config = file_get_contents("/boot/loader.conf");	
247
		$boot_config_split = split("\n", $boot_config);
248
		$fd = fopen("/boot/loader.conf","w");
249
		if($fd) {
250
			foreach($boot_config_split as $bcs) {
251
				if(stristr($bcs, "console")) {
252
					/* DONT WRITE OUT, WE'LL DO IT LATER */	
253
				} else {
254
					if($bcs <> "")
255
						fwrite($fd, "{$bcs}\n");
256
				}
257
			}
258
			if(isset($config['system']['enableserial'])) {
259
				fwrite($fd, "console=\"comconsole\"\n");
260
			}
261
			fclose($fd);
262
		}
263
		
264
		conf_mount_ro();
265
		
266
	}
267
}
268

    
269
$pgtitle = "System: Advanced functions";
270
include("head.inc");
271

    
272
?>
273

    
274
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
275

    
276
<?php include("fbegin.inc"); ?>
277

    
278
<p class="pgtitle"><?=$pgtitle?></p>
279

    
280
<form action="system_advanced.php" method="post" name="iform" id="iform">
281
<?php if ($input_errors) print_input_errors($input_errors); ?>
282
<?php if ($savemsg) print_info_box($savemsg); ?>
283
<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>
284
<br />
285

    
286
<table width="100%" border="0" cellpadding="6" cellspacing="0">
287
	<tbody>
288
		<?php if($g['platform'] == "pfSense" || $g['platform'] == "cdrom"): ?>
289
		<tr>
290
			<td colspan="2" valign="top" class="listtopic">Enable Serial Console</td>
291
		</tr>
292
		<tr>
293
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
294
			<td width="78%" class="vtable">
295
				<input name="enableserial" type="checkbox" id="enableserial" value="yes" <?php if (isset($pconfig['enableserial'])) echo "checked"; ?> onclick="enable_change(false)" />
296
				<strong>This will enable the first serial port with 9600/8/N/1</strong>
297
				<br>
298
				<span class="vexpl">Note:  This will disable the internal video card/keyboard</span>
299
			</td>
300
		</tr>
301
		<tr>
302
			<td width="22%" valign="top">&nbsp;</td>
303
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
304
		</tr>
305
		</tr>
306
		<tr>
307
			<td colspan="2" class="list" height="12"></td>
308
		</tr>		
309
		<?php endif ?>
310
		<tr>
311
			<td colspan="2" valign="top" class="listtopic">Secure Shell</td>
312
		</tr>
313
		<tr>
314
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
315
			<td width="78%" class="vtable">
316
				<input name="enablesshd" type="checkbox" id="enablesshd" value="yes" <?php if (isset($pconfig['enablesshd'])) echo "checked"; ?> onclick="enable_change(false)" />
317
				<strong>Enable Secure Shell</strong>
318
			</td>
319
		</tr>
320
		<tr>
321
			<td width="22%" valign="top" class="vncell">SSH port</td>
322
			<td width="78%" class="vtable">
323
				<input name="sshport" type="text" id="sshport" value="<?php echo $pconfig['sshport']; ?>" onclick="enable_change(false)" />
324
				<br />
325
				<span class="vexpl">Note:  Leave this blank for the default of 22</span>
326
			</td>
327
		</tr>
328
		<tr>
329
			<td width="22%" valign="top">&nbsp;</td>
330
			<td width="78%">
331
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
332
			</td>
333
		</tr>
334
		<tr>
335
			<td colspan="2" class="list" height="12">&nbsp;</td>
336
		</tr>		
337
		<tr>
338
			<td colspan="2" valign="top" class="listtopic">Shared Physical Network</td>
339
		</tr>
340
		<tr>
341
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
342
			<td width="78%" class="vtable">
343
				<input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked"; ?> onclick="enable_change(false)" />
344
				<strong>This will suppress ARP messages when interfaces share the same physical network</strong>
345
			</td>
346
		</tr>
347
		<tr>
348
			<td width="22%" valign="top">&nbsp;</td>
349
			<td width="78%">
350
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
351
			</td>
352
		</tr>
353
		<tr>
354
			<td colspan="2" class="list" height="12">&nbsp;</td>
355
		</tr>	
356
		<tr>
357
			<td colspan="2" valign="top" class="listtopic">Theme</td>
358
		</tr>
359
		<tr>
360
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
361
			<td width="78%" class="vtable">
362
			    <select name="theme">
363
<?php
364
				$files = return_dir_as_array("/usr/local/www/themes/");
365
				foreach($files as $f) {
366
					if ( (substr($f, 0, 1) == "_") && !isset($config['system']['developer']) ) continue;
367
					if($f == "CVS") continue;
368
					$selected = "";
369
					if($f == $config['theme'])
370
						$selected = " SELECTED";
371
					if($config['theme'] == "" and $f == "pfsense")
372
						$selceted = " SELECTED";
373
					echo "\t\t\t\t\t"."<option{$selected}>{$f}</option>\n";
374
				}
375
?>
376
				</select>
377
				<strong>This will change the look and feel of pfSense</strong>
378
			</td>
379
		</tr>
380
		<tr>
381
			<td width="22%" valign="top">&nbsp;</td>
382
			<td width="78%">
383
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
384
			</td>
385
		</tr>
386
		<tr>
387
			<td colspan="2" class="list" height="12">&nbsp;</td>
388
		</tr>
389
		<tr>
390
			<td colspan="2" valign="top" class="listtopic">IPv6 tunneling</td>
391
		</tr>
392
		<tr>
393
			<td width="22%" valign="top" class="vncell">&nbsp;</td>
394
			<td width="78%" class="vtable">
395
				<input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)" />
396
				<strong>NAT encapsulated IPv6 packets (IP protocol 41/RFC2893) to:</strong>
397
				<br /> <br />
398
				<input name="ipv6nat_ipaddr" type="text" class="formfld" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
399
				&nbsp;(IP address)<span class="vexpl"><br /> Don't forget to add a firewall rule to permit IPv6 packets!</span>
400
			</td>
401
		</tr>
402
		<tr>
403
			<td width="22%" valign="top">&nbsp;</td>
404
			<td width="78%">
405
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
406
			</td>
407
		</tr>
408
		<tr>
409
			<td colspan="2" class="list" height="12">&nbsp;</td>
410
		</tr>
411
		<tr>
412
			<td colspan="2" valign="top" class="listtopic">webGUI SSL certificate/key</td>
413
		</tr>
414
		<tr>
415
			<td width="22%" valign="top" class="vncell">Certificate</td>
416
			<td width="78%" class="vtable">
417
				<textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
418
				<br />
419
				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.
420
			</td>
421
		</tr>
422
		<tr>
423
			<td width="22%" valign="top" class="vncell">Key</td>
424
			<td width="78%" class="vtable">
425
				<textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
426
				<br />
427
				Paste an RSA private key in PEM format here.
428
			</td>
429
		</tr>
430
		<tr>
431
			<td width="22%" valign="top">&nbsp;</td>
432
			<td width="78%">
433
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
434
			</td>
435
		</tr>
436
		<tr>
437
			<td colspan="2" class="list" height="12">&nbsp;</td>
438
		</tr>
439
		<tr>
440
			<td colspan="2" valign="top" class="listtopic">Miscellaneous</td>
441
		</tr>
442

    
443
                <tr>
444
                  <td width="22%" valign="top" class="vncell">Device polling</td>
445
                  <td width="78%" class="vtable">
446
                    <input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked"; ?>>
447
                    <strong>Use device polling</strong><br>
448
                                        Device polling is a technique that lets the system periodically poll network devices for new
449
                                        data instead of relying on interrupts. This can reduce CPU load and therefore increase
450
                                        throughput, at the expense of a slightly higher forwarding delay (the devices are polled 1000 times
451
                                        per second). Not all NICs support polling; see the pfSense homepage for a list of supported cards.
452
                  </td>
453
                </tr>
454
		
455
		<tr>
456
			<td width="22%" valign="top" class="vncell">Console menu </td>
457
			<td width="78%" class="vtable">
458
				<input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?>  />
459
				<strong>Disable console menu</strong>
460
				<br />
461
				<span class="vexpl">Changes to this option will take effect after a reboot.</span>
462
			</td>
463
		</tr>
464
		<tr>
465
			<td valign="top" class="vncell">Firmware version check</td>
466
			<td class="vtable">
467
				<input name="disablefirmwarecheck" type="checkbox" id="disablefirmwarecheck" value="yes" <?php if ($pconfig['disablefirmwarecheck']) echo "checked"; ?>  />
468
				<strong>Disable firmware version check</strong>
469
				<br />
470
				<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>
471
			</td>
472
		</tr>
473
<?php if($g['platform'] == "pfSense"): ?>		
474
		<tr>
475
			<td width="22%" valign="top" class="vncell">Hard disk standby time </td>
476
			<td width="78%" class="vtable">
477
				<select name="harddiskstandby" class="formfld">
478
<?php
479
				 	## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
480
					$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");
481
?>
482
					<option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
483
<?php
484
					foreach ($sbvals as $sbval):
485
						list($min,$val) = explode(",", $sbval); ?>
486
					<option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
487
<?php 				endforeach; ?>
488
				</select>
489
				<br />
490
				Puts the hard disk into standby mode when the selected amount of time after the last
491
				access has elapsed. <em>Do not set this for CF cards.</em>
492
			</td>
493
		</tr>
494
<?php endif; ?>		
495
		<tr>
496
			<td width="22%" valign="top" class="vncell">webGUI anti-lockout</td>
497
			<td width="78%" class="vtable">
498
				<input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?> />
499
				<strong>Disable webGUI anti-lockout rule</strong>
500
				<br />
501
				By default, access to the webGUI on the LAN interface is always permitted, regardless of the user-defined filter 
502
				rule set. Enable this feature to control webGUI access (make sure to have a filter rule in place that allows you 
503
				in, or you will lock yourself out!).
504
				<br />
505
				Hint: the &quot;set LAN IP address&quot; option in the console menu  resets this setting as well.
506
			</td>
507
		</tr>
508
		<tr>
509
			<td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
510
			<td width="78%" class="vtable">
511
				<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
512
				<strong>Prefer old IPsec SAs</strong>
513
				<br />
514
				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.
515
			</td>
516
		</tr>		
517
		<tr>
518
			<td width="22%" valign="top">&nbsp;</td>
519
			<td width="78%">
520
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
521
			</td>
522
		</tr>
523
		<tr>
524
			<td colspan="2" class="list" height="12">&nbsp;</td>
525
		</tr>
526
		<tr>
527
			<td colspan="2" valign="top" class="listtopic">Traffic Shaper and Firewall Advanced</td>
528
		</tr>
529
		<tr>
530
			<td width="22%" valign="top" class="vncell">FTP RFC 959 data port violation workaround</td>
531
			<td width="78%" class="vtable">
532
				<input name="rfc959workaround" type="checkbox" id="rfc959workaround" value="yes" <?php if (isset($config['system']['rfc959workaround'])) echo "checked"; ?> onclick="enable_change(false)" />
533
				<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>
534
				<br />
535
			</td>
536
		</tr>
537
<!---
538
		<tr>
539
			<td width="22%" valign="top" class="vncell">Traffic Shaper Scheduler</td>
540
			<td width="78%" class="vtable">
541
				<select id="schedulertype" name="schedulertype" <?= $style ?>>
542
					<option value="priq"<?php if($pconfig['schedulertype'] == 'priq') echo " selected"; ?>>Priority based queueing</option>
543
					<option value="cbq"<?php if($pconfig['schedulertype'] == 'cbq') echo " selected"; ?>>Class based queueing</option>
544
					<option value="hfsc"<?php if($pconfig['schedulertype'] == 'hfsc') echo " selected"; ?>>Hierarchical Fair Service Curve queueing</option>
545
				</select>
546
				<br />
547
				<span class="vexpl"><b>Select which type of queueing you would like to use</b></span>
548
				<?php if (is_array($config['shaper']['queue']) > 0): ?>
549
				<script language="javascript" type="text/javascript">
550
					document.iform.schedulertype.disabled = 1;
551
				</script>
552
				<br />
553
				NOTE: This option is disabled since there are queues defined.
554
				<?php endif; ?>
555
			</td>
556
		</tr>
557
-->
558
		<tr>
559
			<td width="22%" valign="top" class="vncell">Firewall Optimization Options</td>
560
			<td width="78%" class="vtable">
561
				<select onChange="update_description(this.selectedIndex);" name="optimization" id="optimization">
562
					<option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected"; ?>>normal</option>
563
					<option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected"; ?>>high-latency</option>
564
					<option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected"; ?>>aggressive</option>
565
					<option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected"; ?>>conservative</option>
566
				</select>
567
				<br />
568
				<textarea cols="60" rows="2" id="info" name="info"style="border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
569
				<script language="javascript" type="text/javascript">
570
					update_description(document.forms[0].optimization.selectedIndex);
571
				</script>
572
				<br />
573
				<span class="vexpl"><b>Select which type of state table optimization your would like to use</b></span>
574
			</td>
575
		</tr>
576
		<tr>
577
			<td width="22%" valign="top" class="vncell">Disable Firewall</td>
578
			<td width="78%" class="vtable">
579
				<input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> onclick="enable_change(false)" />
580
				<strong>Disable the firewalls filter altogether.</strong>
581
				<br />
582
				<span class="vexpl">Note:  This basically converts pfSense into a routing only platform!<br>
583
				                    Note:  This will turn off NAT!
584
				</span>
585
			</td>
586
		</tr>
587
		<tr>
588
			<td width="22%" valign="top" class="vncell">Firewall Maximum States</td>
589
			<td width="78%" class="vtable">
590
				<input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" onclick="enable_change(false)" />
591
				<br />
592
				<strong>Maximum number of connections to hold in the firewall state table.</strong>
593
				<br />
594
				<span class="vexpl">Note:  Leave this blank for the default of 10000</span>
595
			</td>
596
		</tr>
597

    
598
		<tr>
599
			<td colspan="2" class="list" height="12">&nbsp;</td>
600
		</tr>
601
		<tr>
602
			<td colspan="2" valign="top" class="listtopic">Network Address Translation</td>
603
		</tr>
604
		<tr>
605
			<td width="22%" valign="top" class="vncell">Disable NAT Reflection</td>
606
			<td width="78%" class="vtable">
607
				<input name="disablenatreflection" type="checkbox" id="disablenatreflection" value="yes" <?php if (isset($config['system']['disablenatreflection'])) echo "checked"; ?> onclick="enable_change(false)" />
608
				<strong>Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks</strong>
609
			</td>
610
		</tr>
611
		
612
		<tr>
613
			<td width="22%" valign="top">&nbsp;</td>
614
			<td width="78%"><input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /></td>
615
		</tr>
616
		<tr>
617
			<td colspan="2" class="list" height="12">&nbsp;</td>
618
		</tr>
619
	</tbody>
620
</table>
621
</form>
622

    
623
<script language="JavaScript" type="text/javascript">
624
<!--
625
	enable_change(false);
626
	//enable_altfirmwareurl(false);
627
	//enable_altpkgconfigurl(false);
628
//-->
629
</script>
630

    
631
<?php include("fend.inc"); ?>
632

    
633
<?php
634

    
635
function auto_login($status) {
636
	$gettytab = file_get_contents("/etc/gettytab");
637
	$getty_split = split("\n", $gettytab);
638
	conf_mount_rw();
639
	$fd = fopen("/etc/gettytab", "w");
640
	foreach($getty_split as $gs) {
641
		if(stristr($gs, "cb:ce:ck:lc") == true) {
642
			if($status == true) {
643
				fwrite($fd, ":cb:ce:ck:lc:fd#1000:im=\\r\\n%s/%m (%h) (%t)\\r\\n\\r\\n:sp#1200:\\\n");
644
			} else {
645
				fwrite($fd, ":al=root:cb:ce:ck:lc:fd#1000:im=\\r\\n%s/%m (%h) (%t)\\r\\n\\r\\n:sp#1200:\\\n");
646
			}
647
		} else {
648
			fwrite($fd, "{$gs}\n");
649
		}
650
	}
651
	fclose($fd);
652
	conf_mount_ro();	
653
}
654

    
655
?>
656
</body>
657
</html>
(118-118/153)