Project

General

Profile

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

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

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

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

    
184
		/* Firewall and ALTQ options */
185
		$config['shaper']['schedulertype'] = $_POST['schedulertype'];
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
		/* pfSense themes */
203
		$config['theme'] = $_POST['theme'];
204

    
205
		write_config();
206

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

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

    
223
		conf_mount_rw();
224

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

    
273
$pgtitle = "System: Advanced functions";
274
include("head.inc");
275

    
276
?>
277

    
278
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
279

    
280
<?php include("fbegin.inc"); ?>
281

    
282
<p class="pgtitle"><?=$pgtitle?></p>
283

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

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

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

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

    
627
<script language="JavaScript" type="text/javascript">
628
<!--
629
	enable_change(false);
630
	//enable_altfirmwareurl(false);
631
	//enable_altpkgconfigurl(false);
632
//-->
633
</script>
634

    
635
<?php include("fend.inc"); ?>
636

    
637
<?php
638

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

    
659
?>
660
</body>
661
</html>
(118-118/153)