Project

General

Profile

Download (41.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_advanced_firewall.php
5
	part of pfSense
6
	Copyright (C) 2005-2007 Scott Ullrich
7
	Copyright (C) 2008 Shrew Soft Inc
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9

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

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

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

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

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

    
39
##|+PRIV
40
##|*IDENT=page-system-advanced-firewall
41
##|*NAME=System: Advanced: Firewall and NAT page
42
##|*DESCR=Allow access to the 'System: Advanced: Firewall and NAT' page.
43
##|*MATCH=system_advanced_firewall.php*
44
##|-PRIV
45

    
46
require("guiconfig.inc");
47
require_once("functions.inc");
48
require_once("filter.inc");
49
require_once("shaper.inc");
50

    
51
$pconfig['disablefilter'] = $config['system']['disablefilter'];
52
$pconfig['rfc959workaround'] = $config['system']['rfc959workaround'];
53
$pconfig['scrubnodf'] = $config['system']['scrubnodf'];
54
$pconfig['scrubrnid'] = $config['system']['scrubrnid'];
55
$pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
56
$pconfig['optimization'] = $config['filter']['optimization'];
57
$pconfig['adaptivestart'] = $config['system']['adaptivestart'];
58
$pconfig['adaptiveend'] = $config['system']['adaptiveend'];
59
$pconfig['maximumstates'] = $config['system']['maximumstates'];
60
$pconfig['aliasesresolveinterval'] = $config['system']['aliasesresolveinterval'];
61
$old_aliasesresolveinterval = $config['system']['aliasesresolveinterval'];
62
$pconfig['checkaliasesurlcert'] = isset($config['system']['checkaliasesurlcert']);
63
$pconfig['maximumtableentries'] = $config['system']['maximumtableentries'];
64
$pconfig['disablereplyto'] = isset($config['system']['disablereplyto']);
65
$pconfig['disablenegate'] = isset($config['system']['disablenegate']);
66
$pconfig['bogonsinterval'] = $config['system']['bogons']['interval'];
67
$pconfig['disablenatreflection'] = $config['system']['disablenatreflection'];
68
$pconfig['enablebinatreflection'] = $config['system']['enablebinatreflection'];
69
$pconfig['reflectiontimeout'] = $config['system']['reflectiontimeout'];
70
$pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
71
$pconfig['disablescrub'] = isset($config['system']['disablescrub']);
72
$pconfig['tftpinterface'] = explode(",", $config['system']['tftpinterface']);
73
$pconfig['disablevpnrules'] = isset($config['system']['disablevpnrules']);
74
$pconfig['tcpfirsttimeout'] = $config['system']['tcpfirsttimeout']; 
75
$pconfig['tcpopeningtimeout'] = $config['system']['tcpopeningtimeout']; 
76
$pconfig['tcpestablishedtimeout'] = $config['system']['tcpestablishedtimeout']; 
77
$pconfig['tcpclosingtimeout'] = $config['system']['tcpclosingtimeout']; 
78
$pconfig['tcpfinwaittimeout'] = $config['system']['tcpfinwaittimeout']; 
79
$pconfig['tcpclosedtimeout'] = $config['system']['tcpclosedtimeout']; 
80
$pconfig['udpfirsttimeout'] = $config['system']['udpfirsttimeout']; 
81
$pconfig['udpsingletimeout'] = $config['system']['udpsingletimeout']; 
82
$pconfig['udpmultipletimeout'] = $config['system']['udpmultipletimeout']; 
83
$pconfig['icmpfirsttimeout'] = $config['system']['icmpfirsttimeout']; 
84
$pconfig['icmperrortimeout'] = $config['system']['icmperrortimeout']; 
85
$pconfig['otherfirsttimeout'] = $config['system']['otherfirsttimeout']; 
86
$pconfig['othersingletimeout'] = $config['system']['othersingletimeout']; 
87
$pconfig['othermultipletimeout'] = $config['system']['othermultipletimeout']; 
88

    
89
if ($_POST) {
90

    
91
	unset($input_errors);
92
	$pconfig = $_POST;
93

    
94
	/* input validation */
95
	if ((empty($_POST['adaptivestart']) && !empty($_POST['adaptiveend'])) || (!empty($_POST['adaptivestart']) && empty($_POST['adaptiveend'])))
96
		$input_errors[] = gettext("The Firewall Adaptive values must be set together.");
97
	if (!empty($_POST['adaptivestart']) && !is_numericint($_POST['adaptivestart'])) {
98
		$input_errors[] = gettext("The Firewall Adaptive Start value must be an integer.");
99
	}
100
	if (!empty($_POST['adaptiveend']) && !is_numericint($_POST['adaptiveend'])) {
101
		$input_errors[] = gettext("The Firewall Adaptive End value must be an integer.");
102
	}
103
	if ($_POST['maximumstates'] && !is_numericint($_POST['maximumstates'])) {
104
		$input_errors[] = gettext("The Firewall Maximum States value must be an integer.");
105
	}
106
	if ($_POST['aliasesresolveinterval'] && !is_numericint($_POST['aliasesresolveinterval'])) {
107
		$input_errors[] = gettext("The Aliases Hostname Resolve Interval value must be an integer.");
108
	}
109
	if ($_POST['maximumtableentries'] && !is_numericint($_POST['maximumtableentries'])) {
110
		$input_errors[] = gettext("The Firewall Maximum Table Entries value must be an integer.");
111
	}
112
	if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
113
		$input_errors[] = gettext("The TCP idle timeout must be an integer.");
114
	}
115
	if ($_POST['reflectiontimeout'] && !is_numericint($_POST['reflectiontimeout'])) {
116
		$input_errors[] = gettext("The Reflection timeout must be an integer.");
117
	}
118
	if ($_POST['tcpfirsttimeout'] && !is_numericint($_POST['tcpfirsttimeout'])) { 
119
		$input_errors[] = gettext("The TCP first timeout value must be an integer.");
120
	}
121
	if ($_POST['tcpopeningtimeout'] && !is_numericint($_POST['tcpopeningtimeout'])) { 
122
		$input_errors[] = gettext("The TCP opening timeout value must be an integer."); 
123
	}
124
	if ($_POST['tcpestablishedtimeout'] && !is_numericint($_POST['tcpestablishedtimeout'])) { 
125
		$input_errors[] = gettext("The TCP established timeout value must be an integer."); 
126
	}
127
	if ($_POST['tcpclosingtimeout'] && !is_numericint($_POST['tcpclosingtimeout'])) { 
128
		$input_errors[] = gettext("The TCP closing timeout value must be an integer."); 
129
	}
130
	if ($_POST['tcpfinwaittimeout'] && !is_numericint($_POST['tcpfinwaittimeout'])) { 
131
		$input_errors[] = gettext("The TCP FIN wait timeout value must be an integer."); 
132
	}
133
	if ($_POST['tcpclosedtimeout'] && !is_numericint($_POST['tcpclosedtimeout'])) { 
134
		$input_errors[] = gettext("The TCP closed timeout value must be an integer."); 
135
	}
136
	if ($_POST['udpfirsttimeout'] && !is_numericint($_POST['udpfirsttimeout'])) { 
137
		$input_errors[] = gettext("The UDP first timeout value must be an integer."); 
138
	}
139
	if ($_POST['udpsingletimeout'] && !is_numericint($_POST['udpsingletimeout'])) { 
140
		$input_errors[] = gettext("The UDP single timeout value must be an integer."); 
141
	}
142
	if ($_POST['udpmultipletimeout'] && !is_numericint($_POST['udpmultipletimeout'])) { 
143
		$input_errors[] = gettext("The UDP multiple timeout value must be an integer."); 
144
	}
145
	if ($_POST['icmpfirsttimeout'] && !is_numericint($_POST['icmpfirsttimeout'])) { 
146
		$input_errors[] = gettext("The ICMP first timeout value must be an integer."); 
147
	}
148
	if ($_POST['icmperrortimeout'] && !is_numericint($_POST['icmperrortimeout'])) { 
149
		$input_errors[] = gettext("The ICMP error timeout value must be an integer."); 
150
	}
151
	if ($_POST['otherfirsttimeout'] && !is_numericint($_POST['otherfirsttimeout'])) { 
152
		$input_errors[] = gettext("The Other first timeout value must be an integer."); 
153
	}
154
	if ($_POST['othersingletimeout'] && !is_numericint($_POST['othersingletimeout'])) { 
155
		$input_errors[] = gettext("The Other single timeout value must be an integer."); 
156
	}
157
	if ($_POST['othermultipletimeout'] && !is_numericint($_POST['othermultipletimeout'])) { 
158
		$input_errors[] = gettext("The Other multiple timeout value must be an integer."); 
159
	}
160

    
161
	ob_flush();
162
	flush();
163

    
164
	if (!$input_errors) {
165

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

    
171
		if($_POST['disablevpnrules'] == "yes")
172
			$config['system']['disablevpnrules'] = true;
173
		else
174
			unset($config['system']['disablevpnrules']);
175
		if($_POST['rfc959workaround'] == "yes")
176
			$config['system']['rfc959workaround'] = "enabled";
177
		else
178
			unset($config['system']['rfc959workaround']);
179

    
180
		if($_POST['scrubnodf'] == "yes")
181
			$config['system']['scrubnodf'] = "enabled";
182
		else
183
			unset($config['system']['scrubnodf']);
184

    
185
		if($_POST['scrubrnid'] == "yes")
186
			$config['system']['scrubrnid'] = "enabled";
187
		else
188
			unset($config['system']['scrubrnid']);
189

    
190
		if (!empty($_POST['adaptiveend']))
191
			$config['system']['adaptiveend'] = $_POST['adaptiveend'];
192
		else
193
			unset($config['system']['adaptiveend']);
194
		if (!empty($_POST['adaptivestart']))
195
			$config['system']['adaptivestart'] = $_POST['adaptivestart'];
196
		else
197
			unset($config['system']['adaptivestart']);
198

    
199
		if ($_POST['checkaliasesurlcert'] == "yes")
200
			$config['system']['checkaliasesurlcert'] = true;
201
		else
202
			unset($config['system']['checkaliasesurlcert']);
203

    
204
		$config['system']['optimization'] = $_POST['optimization'];
205
		$config['system']['maximumstates'] = $_POST['maximumstates'];
206
		$config['system']['aliasesresolveinterval'] = $_POST['aliasesresolveinterval'];
207
		$config['system']['maximumtableentries'] = $_POST['maximumtableentries'];
208

    
209
		if (!empty($_POST['tcpfirsttimeout'])) {
210
                        $config['system']['tcpfirsttimeout'] = $_POST['tcpfirsttimeout'];
211
                } else {
212
                        unset($config['system']['tcpfirsttimeout']);
213
                }
214
                if (!empty($_POST['tcpopeningtimeout'])) {
215
                        $config['system']['tcpopeningtimeout'] = $_POST['tcpopeningtimeout'];
216
                } else {
217
                        unset($config['system']['tcpopeningtimeout']);
218
                }
219
                if (!empty($_POST['tcpestablishedtimeout'])) {
220
                        $config['system']['tcpestablishedtimeout'] = $_POST['tcpestablishedtimeout'];
221
                } else {
222
                        unset($config['system']['tcpestablishedtimeout']);
223
                }
224
                if (!empty($_POST['tcpclosingtimeout'])) {
225
                        $config['system']['tcpclosingtimeout'] = $_POST['tcpclosingtimeout'];
226
                } else {
227
                        unset($config['system']['tcpclosingtimeout']);
228
                }
229
                if (!empty($_POST['tcpfinwaittimeout'])) {
230
                        $config['system']['tcpfinwaittimeout'] = $_POST['tcpfinwaittimeout'];
231
                } else {
232
                        unset($config['system']['tcpfinwaittimeout']);
233
                }
234
                if (!empty($_POST['tcpclosedtimeout'])) {
235
                        $config['system']['tcpclosedtimeout'] = $_POST['tcpclosedtimeout'];
236
                } else {
237
                        unset($config['system']['tcpclosedtimeout']);
238
                }
239
                if (!empty($_POST['udpfirsttimeout'])) {
240
                        $config['system']['udpfirsttimeout'] = $_POST['udpfirsttimeout'];
241
                } else {
242
                        unset($config['system']['udpfirsttimeout']);
243
                }
244
                if (!empty($_POST['udpsingletimeout'])) {
245
                        $config['system']['udpsingletimeout'] = $_POST['udpsingletimeout'];
246
                } else {
247
                        unset($config['system']['udpsingletimeout']);
248
                }
249
                if (!empty($_POST['udpmultipletimeout'])) {
250
                        $config['system']['udpmultipletimeout'] = $_POST['udpmultipletimeout'];
251
                } else {
252
                        unset($config['system']['udpmultipletimeout']);
253
                }
254
                if (!empty($_POST['icmpfirsttimeout'])) {
255
                        $config['system']['icmpfirsttimeout'] = $_POST['icmpfirsttimeout'];
256
                } else {
257
                        unset($config['system']['icmpfirsttimeout']);
258
                }
259
                if (!empty($_POST['icmperrortimeout'])) {
260
                        $config['system']['icmperrortimeout'] = $_POST['icmperrortimeout'];
261
                } else {
262
                        unset($config['system']['icmperrortimeout']);
263
                }
264
                if (!empty($_POST['otherfirsttimeout'])) {
265
                        $config['system']['otherfirsttimeout'] = $_POST['otherfirsttimeout'];
266
                } else {
267
                        unset($config['system']['otherfirsttimeout']);
268
                }
269
                if (!empty($_POST['othersingletimeout'])) {
270
                        $config['system']['othersingletimeout'] = $_POST['othersingletimeout'];
271
                } else {
272
                        unset($config['system']['othersingletimeout']);
273
                }
274
                if (!empty($_POST['othermultipletimeout'])) {
275
                        $config['system']['othermultipletimeout'] = $_POST['othermultipletimeout'];
276
                } else {
277
                        unset($config['system']['othermultipletimeout']);
278
                }
279

    
280
		if($_POST['natreflection'] == "proxy") {
281
			unset($config['system']['disablenatreflection']);
282
			unset($config['system']['enablenatreflectionpurenat']);
283
		} else if($_POST['natreflection'] == "purenat") {
284
			unset($config['system']['disablenatreflection']);
285
			$config['system']['enablenatreflectionpurenat'] = "yes";
286
		} else {
287
			$config['system']['disablenatreflection'] = "yes";
288
			unset($config['system']['enablenatreflectionpurenat']);
289
		}
290

    
291
		if($_POST['enablebinatreflection'] == "yes")
292
			$config['system']['enablebinatreflection'] = "yes";
293
		else
294
			unset($config['system']['enablebinatreflection']);
295

    
296
		if($_POST['disablereplyto'] == "yes")
297
			$config['system']['disablereplyto'] = $_POST['disablereplyto'];
298
		else
299
			unset($config['system']['disablereplyto']);
300

    
301
		if($_POST['disablenegate'] == "yes")
302
			$config['system']['disablenegate'] = $_POST['disablenegate'];
303
		else
304
			unset($config['system']['disablenegate']);
305

    
306
		if($_POST['enablenatreflectionhelper'] == "yes")
307
			$config['system']['enablenatreflectionhelper'] = "yes";
308
		else
309
			unset($config['system']['enablenatreflectionhelper']);
310

    
311
		$config['system']['reflectiontimeout'] = $_POST['reflectiontimeout'];
312

    
313
		if($_POST['bypassstaticroutes'] == "yes")
314
			$config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes'];
315
		elseif(isset($config['filter']['bypassstaticroutes']))
316
			unset($config['filter']['bypassstaticroutes']);
317

    
318
		if($_POST['disablescrub'] == "yes")
319
			$config['system']['disablescrub'] = $_POST['disablescrub'];
320
		else
321
			unset($config['system']['disablescrub']);
322

    
323
		if ($_POST['tftpinterface'])
324
			$config['system']['tftpinterface'] = implode(",", $_POST['tftpinterface']);
325
		else
326
			unset($config['system']['tftpinterface']);
327

    
328
		if ($_POST['bogonsinterval'] != $config['system']['bogons']['interval']) {
329
			switch ($_POST['bogonsinterval']) {
330
				case 'daily':
331
					install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "*", "*", "*");
332
					break;
333
				case 'weekly':
334
					install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "*", "*", "0");
335
					break;
336
				case 'monthly':
337
					// fall through
338
				default:
339
					install_cron_job("/usr/bin/nice -n20 /etc/rc.update_bogons.sh", true, "1", "3", "1", "*", "*");
340
			}
341
			$config['system']['bogons']['interval'] = $_POST['bogonsinterval'];
342
		}
343

    
344
		write_config();
345

    
346
		// Kill filterdns when value changes, filter_configure() will restart it
347
		if (($old_aliasesresolveinterval != $config['system']['aliasesresolveinterval']) &&
348
		    isvalidpid("{$g['varrun_path']}/filterdns.pid"))
349
			killbypid("{$g['varrun_path']}/filterdns.pid");
350

    
351
		$retval = 0;
352
		$retval = filter_configure();
353
		if(stristr($retval, "error") <> true)
354
			$savemsg = get_std_save_message($retval);
355
		else
356
			$savemsg = $retval;
357
	}
358
}
359

    
360
$pgtitle = array(gettext("System"),gettext("Advanced: Firewall and NAT"));
361
include("head.inc");
362

    
363
?>
364

    
365
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
366
<?php include("fbegin.inc"); ?>
367

    
368
<script type="text/javascript">
369
//<![CDATA[
370

    
371
var descs=new Array(5);
372
descs[0]="<?=gettext("as the name says, it's the normal optimization algorithm");?>";
373
descs[1]="<?=gettext("used for high latency links, such as satellite links.  Expires idle connections later than default");?>";
374
descs[2]="<?=gettext("expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate idle connections");?>";
375
descs[3]="<?=gettext("tries to avoid dropping any legitimate idle connections at the expense of increased memory usage and CPU utilization.");?>";
376

    
377
function update_description(itemnum) {
378
	document.forms[0].info.value=descs[itemnum];
379

    
380
}
381

    
382
//]]>
383
</script>
384

    
385
<?php
386
	if ($input_errors)
387
		print_input_errors($input_errors);
388
	if ($savemsg)
389
		print_info_box($savemsg);
390
?>
391
	<form action="system_advanced_firewall.php" method="post" name="iform" id="iform">
392
		<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced firewall/nat">
393
			<tr>
394
				<td class="tabnavtbl">
395
					<?php
396
						$tab_array = array();
397
						$tab_array[] = array(gettext("Admin Access"), false, "system_advanced_admin.php");
398
						$tab_array[] = array(gettext("Firewall / NAT"), true, "system_advanced_firewall.php");
399
						$tab_array[] = array(gettext("Networking"), false, "system_advanced_network.php");
400
						$tab_array[] = array(gettext("Miscellaneous"), false, "system_advanced_misc.php");
401
						$tab_array[] = array(gettext("System Tunables"), false, "system_advanced_sysctl.php");
402
						$tab_array[] = array(gettext("Notifications"), false, "system_advanced_notifications.php");
403
						display_top_tabs($tab_array);
404
					?>
405
				</td>
406
			</tr>
407
			<tr>
408
				<td id="mainarea">
409
					<div class="tabcont">
410
						<span class="vexpl">
411
							<span class="red">
412
								<strong><?=gettext("NOTE:");?>&nbsp;</strong>
413
							</span>
414
							<?=gettext("The options on this page are intended for use by advanced users only.");?>
415
							<br />
416
						</span>
417
						<br />
418
						<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
419
							<tr>
420
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Firewall Advanced");?></td>
421
							</tr>
422
							<tr>
423
								<td width="22%" valign="top" class="vncell"><?=gettext("IP Do-Not-Fragment compatibility");?></td>
424
								<td width="78%" class="vtable">
425
									<input name="scrubnodf" type="checkbox" id="scrubnodf" value="yes" <?php if (isset($config['system']['scrubnodf'])) echo "checked=\"checked\""; ?> />
426
									<strong><?=gettext("Clear invalid DF bits instead of dropping the packets");?></strong><br />
427
									<?=gettext("This allows for communications with hosts that generate fragmented " .
428
									"packets with the don't fragment (DF) bit set. Linux NFS is known to " .
429
									"do this. This will cause the filter to not drop such packets but " .
430
									"instead clear the don't fragment bit.");?>
431
								</td>
432
							</tr>
433
							<tr>
434
								<td width="22%" valign="top" class="vncell"><?=gettext("IP Random id generation");?></td>
435
								<td width="78%" class="vtable">
436
									<input name="scrubrnid" type="checkbox" id="scrubrnid" value="yes" <?php if (isset($config['system']['scrubrnid'])) echo "checked=\"checked\""; ?> />
437
									<strong><?=gettext("Insert a stronger id into IP header of packets passing through the filter.");?></strong><br />
438
									<?=gettext("Replaces the IP identification field of packets with random values to " .
439
									"compensate for operating systems that use predictable values. " .
440
									"This option only applies to packets that are not fragmented after the " .
441
									"optional packet reassembly.");?>
442
								</td>
443
							</tr>
444
							<tr>
445
								<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Optimization Options");?></td>
446
								<td width="78%" class="vtable">
447
									<select onchange="update_description(this.selectedIndex);" name="optimization" id="optimization">
448
										<option value="normal"<?php if($config['system']['optimization']=="normal") echo " selected=\"selected\""; ?>><?=gettext("normal");?></option>
449
										<option value="high-latency"<?php if($config['system']['optimization']=="high-latency") echo " selected=\"selected\""; ?>><?=gettext("high-latency");?></option>
450
										<option value="aggressive"<?php if($config['system']['optimization']=="aggressive") echo " selected=\"selected\""; ?>><?=gettext("aggressive");?></option>
451
										<option value="conservative"<?php if($config['system']['optimization']=="conservative") echo " selected=\"selected\""; ?>><?=gettext("conservative");?></option>
452
									</select>
453
									<br />
454
									<textarea readonly="readonly" cols="60" rows="2" id="info" name="info" style="padding:5px; border:1px dashed #990000; background-color: #ffffff; color: #000000; font-size: 8pt;"></textarea>
455
									<script type="text/javascript">
456
									//<![CDATA[
457
										update_description(document.forms[0].optimization.selectedIndex);
458
									//]]>
459
									</script>
460
									<br />
461
									<?=gettext("Select the type of state table optimization to use");?>
462
								</td>
463
							</tr>
464
							<tr>
465
								<td width="22%" valign="top" class="vncell"><?=gettext("Disable Firewall");?></td>
466
								<td width="78%" class="vtable">
467
									<input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked=\"checked\""; ?> />
468
									<strong><?=gettext("Disable all packet filtering.");?></strong>
469
									<br />
470
									<span class="vexpl"><?php printf(gettext("Note:  This converts %s into a routing only platform!"), $g['product_name']);?><br />
471
										<?=gettext("Note:  This will also turn off NAT!");?>
472
										<br /><?=gettext("If you only want to disable NAT, and not firewall rules, visit the");?> <a href="firewall_nat_out.php"><?=gettext("Outbound NAT");?></a> <?=gettext("page");?>.
473
									</span>
474
								</td>
475
							</tr>
476
							<tr>
477
								<td width="22%" valign="top" class="vncell"><?=gettext("Disable Firewall Scrub");?></td>
478
								<td width="78%" class="vtable">
479
									<input name="disablescrub" type="checkbox" id="disablescrub" value="yes" <?php if (isset($config['system']['disablescrub'])) echo "checked=\"checked\""; ?> />
480
									<strong><?=gettext("Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.");?></strong>
481
									<br />
482
								</td>
483
							</tr>
484
							<tr>
485
								<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Adaptive Timeouts");?></td>
486
								<td width="78%" class="vtable">
487
									<strong><?=gettext("Timeouts for states can be scaled adaptively as the number of state table entries grows.");?></strong>
488
									<br />
489
									<input name="adaptivestart" type="text" id="adaptivestart" value="<?php echo $pconfig['adaptivestart']; ?>" />
490
									<br /><?=gettext("When the number of state entries exceeds this value, adaptive scaling begins.  All timeout values are scaled linearly with factor (adaptive.end - number of states) / (adaptive.end - adaptive.start).");?>
491

    
492
									<br />
493
									<input name="adaptiveend" type="text" id="adaptiveend" value="<?php echo $pconfig['adaptiveend']; ?>" />
494
									<br /><?=gettext("When reaching this number of state entries, all timeout values become zero, effectively purging all state entries immediately.  This value is used to define the scale factor, it should not actually be reached (set a lower state limit, see below).");?>
495
									<br />
496
									<span class="vexpl"><?=gettext("Note: Leave this blank for the default, which auto-calculates these values from your maximum state table size. Adaptive start is 60% and end is 120% of the state table size by default.");?></span>
497
								</td>
498
							</tr>
499
							<tr>
500
								<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Maximum States");?></td>
501
								<td width="78%" class="vtable">
502
									<input name="maximumstates" type="text" id="maximumstates" value="<?php echo $pconfig['maximumstates']; ?>" />
503
									<br />
504
									<strong><?=gettext("Maximum number of connections to hold in the firewall state table.");?></strong>
505
									<br />
506
									<span class="vexpl"><?=gettext("Note:  Leave this blank for the default.  On your system the default size is:");?> <?= pfsense_default_state_size() ?></span>
507
								</td>
508
							</tr>
509
							<tr>
510
								<td width="22%" valign="top" class="vncell"><?=gettext("Firewall Maximum Table Entries");?></td>
511
								<td width="78%" class="vtable">
512
									<input name="maximumtableentries" type="text" id="maximumtableentries" value="<?php echo $pconfig['maximumtableentries']; ?>" />
513
									<br />
514
									<strong><?=gettext("Maximum number of table entries for systems such as aliases, sshlockout, snort, etc, combined.");?></strong>
515
									<br />
516
									<span class="vexpl">
517
										<?=gettext("Note:  Leave this blank for the default.");?>
518
										<?php if (empty($pconfig['maximumtableentries'])): ?>
519
											<?= gettext("On your system the default size is:");?> <?= pfsense_default_table_entries_size(); ?>
520
										<?php endif; ?>
521
									</span>
522
								</td>
523
							</tr>
524
							<tr>
525
								<td width="22%" valign="top" class="vncell"><?=gettext("Static route filtering");?></td>
526
								<td width="78%" class="vtable">
527
									<input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked=\"checked\""; ?> />
528
									<strong><?=gettext("Bypass firewall rules for traffic on the same interface");?></strong>
529
									<br />
530
									<?=gettext("This option only applies if you have defined one or more static routes. If it is enabled, traffic that enters and " .
531
									"leaves through the same interface will not be checked by the firewall. This may be desirable in some situations where " .
532
									"multiple subnets are connected to the same interface.");?>
533
									<br />
534
								</td>
535
							</tr>
536
							<tr>
537
								<td width="22%" valign="top" class="vncell">Disable Auto-added VPN rules</td>
538
								<td width="78%" class="vtable">
539
									<input name="disablevpnrules" type="checkbox" id="disablevpnrules" value="yes" <?php if (isset($config['system']['disablevpnrules'])) echo "checked=\"checked\""; ?> />
540
									<strong><?=gettext("Disable all auto-added VPN rules.");?></strong>
541
									<br />
542
									<span class="vexpl"><?=gettext("Note: This disables automatically added rules for IPsec, PPTP.");?>
543
									</span>
544
								</td>
545
							</tr>
546
							<tr>
547
								<td width="22%" valign="top" class="vncell">Disable reply-to</td>
548
								<td width="78%" class="vtable">
549
									<input name="disablereplyto" type="checkbox" id="disablereplyto" value="yes" <?php if ($pconfig['disablereplyto']) echo "checked=\"checked\""; ?> />
550
									<strong><?=gettext("Disable reply-to on WAN rules");?></strong>
551
									<br />
552
									<?=gettext("With Multi-WAN you generally want to ensure traffic leaves the same interface it arrives on, hence reply-to is added automatically by default. " .
553
									"When using bridging, you must disable this behavior if the WAN gateway IP is different from the gateway IP of the hosts behind the bridged interface.");?>
554
									<br />
555
								</td>
556
							</tr>
557
							<tr>
558
								<td width="22%" valign="top" class="vncell">Disable Negate rules</td>
559
								<td width="78%" class="vtable">
560
									<input name="disablenegate" type="checkbox" id="disablenegate" value="yes" <?php if ($pconfig['disablenegate']) echo "checked=\"checked\""; ?> />
561
									<strong><?=gettext("Disable Negate rule on policy routing rules");?></strong>
562
									<br />
563
									<?=gettext("With Multi-WAN you generally want to ensure traffic reaches directly connected networks and VPN networks when using policy routing. You can disable this for special purposes but it requires manually creating rules for these networks");?>
564
									<br />
565
								</td>
566
							</tr>
567
							<tr>
568
								<td width="22%" valign="top" class="vncell"><?=gettext("Aliases Hostnames Resolve Interval");?></td>
569
								<td width="78%" class="vtable">
570
									<input name="aliasesresolveinterval" type="text" id="aliasesresolveinterval" value="<?php echo $pconfig['aliasesresolveinterval']; ?>" />
571
									<br />
572
									<strong><?=gettext("Interval, in seconds, that will be used to resolve hostnames configured on aliases.");?></strong>
573
									<br />
574
									<span class="vexpl"><?=gettext("Note:  Leave this blank for the default (300s).");?></span>
575
								</td>
576
							</tr>
577
							<tr>
578
							<td width="22%" valign="top" class="vncell"><?=gettext("Check certificate of aliases URLs");?></td>
579
								<td width="78%" class="vtable">
580
									<input name="checkaliasesurlcert" type="checkbox" id="checkaliasesurlcert" value="yes" <?php if ($pconfig['checkaliasesurlcert']) echo "checked=\"checked\""; ?> />
581
									<strong><?=gettext("Verify HTTPS certificates when downloading alias URLs");?></strong>
582
									<br />
583
									<?=gettext("Make sure the certificate is valid for all HTTPS addresses on aliases. If it's not valid or is revoked, do not download it.");?>
584
									<br />
585
								</td>
586
							</tr>
587
							<tr>
588
								<td colspan="2" class="list" height="12">&nbsp;</td>
589
							</tr>
590
							<tr>
591
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Bogon Networks");?></td>
592
							</tr>
593
							<tr>
594
								<td width="22%" valign="top" class="vncell"><?=gettext("Update Frequency");?></td>
595
								<td width="78%" class="vtable">
596
									<select name="bogonsinterval" class="formselect">
597
									<option value="monthly" <?php if (empty($pconfig['bogonsinterval']) || $pconfig['bogonsinterval'] == 'monthly') echo "selected=\"selected\""; ?>><?=gettext("Monthly"); ?></option>
598
									<option value="weekly" <?php if ($pconfig['bogonsinterval'] == 'weekly') echo "selected=\"selected\""; ?>><?=gettext("Weekly"); ?></option>
599
									<option value="daily" <?php if ($pconfig['bogonsinterval'] == 'daily') echo "selected=\"selected\""; ?>><?=gettext("Daily"); ?></option>
600
									</select>
601
									<br />
602
									<?=gettext("The frequency of updating the lists of IP addresses that are reserved (but not RFC 1918) or not yet assigned by IANA.");?>
603
								</td>
604
							</tr>
605
							<tr>
606
								<td colspan="2" class="list" height="12">&nbsp;</td>
607
							</tr>
608
							<?php if(count($config['interfaces']) > 1): ?>
609
							<tr>
610
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Network Address Translation");?></td>
611
							</tr>
612
							<tr>
613
								<td width="22%" valign="top" class="vncell"><?=gettext("NAT Reflection mode for port forwards");?></td>
614
								<td width="78%" class="vtable">
615
									<select name="natreflection" class="formselect">
616
									<option value="disable" <?php if (isset($config['system']['disablenatreflection'])) echo "selected=\"selected\""; ?>><?=gettext("Disable"); ?></option>
617
									<option value="proxy" <?php if (!isset($config['system']['disablenatreflection']) && !isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (NAT + Proxy)"); ?></option>
618
									<option value="purenat" <?php if (!isset($config['system']['disablenatreflection']) && isset($config['system']['enablenatreflectionpurenat'])) echo "selected=\"selected\""; ?>><?=gettext("Enable (Pure NAT)"); ?></option>
619
									</select>
620
									<br />
621
									<strong><?=gettext("When enabled, this automatically creates additional NAT redirect rules for access to port forwards on your external IP addresses from within your internal networks.");?></strong>
622
									<br /><br />
623
									<?=gettext("The NAT + proxy mode uses a helper program to send packets to the target of the port forward.  It is useful in setups where the interface and/or gateway IP used for communication with the target cannot be accurately determined at the time the rules are loaded.  Reflection rules are not created for ranges larger than 500 ports and will not be used for more than 1000 ports total between all port forwards.  Only TCP and UDP protocols are supported.");?>
624
									<br /><br />
625
									<?=gettext("The pure NAT mode uses a set of NAT rules to direct packets to the target of the port forward.  It has better scalability, but it must be possible to accurately determine the interface and gateway IP used for communication with the target at the time the rules are loaded.  There are no inherent limits to the number of ports other than the limits of the protocols.  All protocols available for port forwards are supported.");?>
626
									<br /><br />
627
									<?=gettext("Individual rules may be configured to override this system setting on a per-rule basis.");?>
628
								</td>
629
							</tr>
630
							<tr>
631
								<td width="22%" valign="top" class="vncell"><?=gettext("Reflection Timeout");?></td>
632
								<td width="78%" class="vtable">
633
									<input name="reflectiontimeout" id="reflectiontimeout" value="<?php echo $config['system']['reflectiontimeout']; ?>" /><br />
634
									<strong><?=gettext("Enter value for Reflection timeout in seconds.");?></strong>
635
									<br /><br />
636
									<?=gettext("Note: Only applies to Reflection on port forwards in NAT + proxy mode.");?>
637
								</td>
638
							</tr>
639
							<tr>
640
								<td width="22%" valign="top" class="vncell"><?=gettext("Enable NAT Reflection for 1:1 NAT");?></td>
641
								<td width="78%" class="vtable">
642
									<input name="enablebinatreflection" type="checkbox" id="enablebinatreflection" value="yes" <?php if (isset($config['system']['enablebinatreflection'])) echo "checked=\"checked\""; ?> />
643
									<strong><?=gettext("Enables the automatic creation of additional NAT redirect rules for access to 1:1 mappings of your external IP addresses from within your internal networks.");?></strong>
644
									<br /><br />
645
									<?=gettext("Note: Reflection on 1:1 mappings is only for the inbound component of the 1:1 mappings.  This functions the same as the pure NAT mode for port forwards.  For more details, refer to the pure NAT mode description above.");?>
646
									<br /><br />
647
									<?=gettext("Individual rules may be configured to override this system setting on a per-rule basis.");?>
648
								</td>
649
							</tr>
650
							<tr>
651
								<td width="22%" valign="top" class="vncell"><?=gettext("Enable automatic outbound NAT for Reflection");?></td>
652
								<td width="78%" class="vtable">
653
									<input name="enablenatreflectionhelper" type="checkbox" id="enablenatreflectionhelper" value="yes" <?php if (isset($config['system']['enablenatreflectionhelper'])) echo "checked=\"checked\""; ?> />
654
									<strong><?=gettext("Automatically create outbound NAT rules which assist inbound NAT rules that direct traffic back out to the same subnet it originated from.");?></strong>
655
									<br />
656
									<?=gettext("Required for full functionality of the pure NAT mode of NAT Reflection for port forwards or NAT Reflection for 1:1 NAT.");?>
657
									<br /><br />
658
									<?=gettext("Note: This only works for assigned interfaces.  Other interfaces require manually creating the outbound NAT rules that direct the reply packets back through the router.");?>
659
								</td>
660
							</tr>
661
							<tr>
662
								<td width="22%" valign="top" class="vncell"><?=gettext("TFTP Proxy");?></td>
663
								<td width="78%" class="vtable">
664
									<select name="tftpinterface[]" multiple="multiple" class="formselect" size="3">
665
<?php
666
										$ifdescs = get_configured_interface_with_descr();
667
										$rowIndex = 0;
668
										foreach ($ifdescs as $ifent => $ifdesc):
669
											$rowIndex++;
670
?>
671
											<option value="<?=$ifent;?>" <?php if (in_array($ifent, $pconfig['tftpinterface'])) echo "selected=\"selected\""; ?>><?=gettext($ifdesc);?></option>
672
<?php									endforeach;
673
										if ($rowIndex == 0)
674
											echo "<option></option>";
675
 ?>
676
									</select>
677
									<br/><strong><?=gettext("Choose the interfaces where you want TFTP proxy helper to be enabled.");?></strong>
678
								</td>
679
							</tr>
680
							<?php endif; ?>
681
							<tr>
682
								<td colspan="2" valign="top" class="listtopic"><?=gettext("State Timeouts");?></td>
683
							</tr>
684
							<tr>
685
								<td colspan="2">
686
									<strong><?=gettext("NOTE: The options below should usually be left at their defaults, as chosen by Firewall Optimization Options above. Click the Help link on this page for information.");?>&nbsp;</strong>
687
								</td>
688
							<br />
689
							</tr>
690
							<tr>
691
								<td width="22%" valign="top" class="vncell"><?=gettext("TCP Timeouts");?></td>
692
								<td width="78%" class="vtable">
693
									<strong><?=gettext("TCP First: ");?></strong><input name="tcpfirsttimeout" id="tcpfirsttimeout" value="<?php echo $config['system']['tcpfirsttimeout']; ?>" /> <br/>
694
									<?=gettext("Enter value for TCP first timeout in seconds. Leave blank for default (recommended).");?>
695
									<br/><br/>
696
									<strong><?=gettext("TCP Opening: ");?></strong><input name="tcpopeningtimeout" id="tcpopeningtimeout" value="<?php echo $config['system']['tcpopeningtimeout']; ?>" /><br />
697
									<?=gettext("Enter value for TCP opening timeout in seconds. Leave blank for default (recommended).");?>									
698
									<br/><br/>
699
									<strong><?=gettext("TCP Established: ");?></strong><input name="tcpestablishedtimeout" id="tcpestablishedtimeout" value="<?php echo $config['system']['tcpestablishedtimeout']; ?>" /><br />
700
									<?=gettext("Enter value for TCP established timeout in seconds. Leave blank for default (recommended).");?>
701
									<br/><br/>
702
									<strong><?=gettext("TCP Closing: ");?></strong><input name="tcpclosingtimeout" id="tcpclosingtimeout" value="<?php echo $config['system']['tcpclosingtimeout']; ?>" /><br />
703
									<?=gettext("Enter value for TCP closing timeout in seconds. Leave blank for default (recommended).");?>
704
									<br/><br/>
705
									<strong><?=gettext("TCP FIN Wait: ");?></strong><input name="tcpfinwaittimeout" id="tcpfinwaittimeout" value="<?php echo $config['system']['tcpfinwaittimeout']; ?>" /><br />
706
									<?=gettext("Enter value for TCP FIN wait timeout in seconds. Leave blank for default (recommended).");?>
707
									<br/><br/>
708
									<strong><?=gettext("TCP Closed: ");?></strong><input name="tcpclosedtimeout" id="tcpclosedtimeout" value="<?php echo $config['system']['tcpclosedtimeout']; ?>" /><br />
709
									<?=gettext("Enter value for TCP closed timeout in seconds. Leave blank for default (recommended).");?>							
710
								</td>
711
							</tr>
712
							<tr>
713
								<td width="22%" valign="top" class="vncell"><?=gettext("UDP Timeouts");?></td>
714
								<td width="78%" class="vtable">
715
									<strong><?=gettext("UDP First: ");?></strong><input name="udpfirsttimeout" id="udpfirsttimeout" value="<?php echo $config['system']['udpfirsttimeout']; ?>" /><br />
716
									<?=gettext("Enter value for UDP first timeout in seconds. Leave blank for default (recommended).");?>
717
									<br /><br />
718
									<strong><?=gettext("UDP Single: ");?></strong><input name="udpsingletimeout" id="udpsingletimeout" value="<?php echo $config['system']['udpsingletimeout']; ?>" /><br />
719
									<?=gettext("Enter value for UDP single timeout in seconds. Leave blank for default (recommended).");?>
720
									<br /><br />
721
									<strong><?=gettext("UDP Multiple: ");?></strong><input name="udpmultipletimeout" id="udpmultipletimeout" value="<?php echo $config['system']['udpmultipletimeout']; ?>" /><br />
722
									<?=gettext("Enter value for UDP multiple timeout in seconds. Leave blank for default (recommended).");?>
723
								</td>
724
							</tr>
725
							<tr>
726
								<td width="22%" valign="top" class="vncell"><?=gettext("ICMP Timeouts");?></td>
727
								<td width="78%" class="vtable">
728
									<strong><?=gettext("ICMP First: ");?></strong><input name="icmpfirsttimeout" id="icmpfirsttimeout" value="<?php echo $config['system']['icmpfirsttimeout']; ?>" /><br />
729
									<?=gettext("Enter value for ICMP first timeout in seconds. Leave blank for default (recommended).");?>
730
									<br /><br />
731
									<strong><?=gettext("ICMP Error: ");?></strong><input name="icmperrortimeout" id="icmperrortimeout" value="<?php echo $config['system']['icmperrortimeout']; ?>" /><br />
732
									<?=gettext("Enter value for ICMP error timeout in seconds. Leave blank for default (recommended).");?>
733
								</td>
734
							</tr>
735
							<tr>
736
								<td width="22%" valign="top" class="vncell"><?=gettext("Other Timeouts");?></td>
737
								<td width="78%" class="vtable">
738
									<strong><?=gettext("Other First: ");?></strong><input name="otherfirsttimeout" id="otherfirsttimeout" value="<?php echo $config['system']['otherfirsttimeout']; ?>" /><br />
739
									<?=gettext("Enter value for Other first timeout in seconds. Leave blank for default (recommended).");?>
740
									<br /><br />
741
									<strong><?=gettext("Other Single: ");?></strong><input name="othersingletimeout" id="othersingletimeout" value="<?php echo $config['system']['othersingletimeout']; ?>" /><br />
742
									<?=gettext("Enter value for Other single timeout in seconds. Leave blank for default (recommended).");?>
743
									<br /><br />
744
									<strong><?=gettext("Other Multiple: ");?></strong><input name="othermultipletimeout" id="othermultipletimeout" value="<?php echo $config['system']['othermultipletimeout']; ?>" /><br />
745
									<?=gettext("Enter value for Other multiple timeout in seconds. Leave blank for default (recommended).");?>
746
								</td>
747
							</tr>
748
							<tr>
749
								<td colspan="2" class="list" height="12">&nbsp;</td>
750
							</tr>
751
							<tr>
752
								<td width="22%" valign="top">&nbsp;</td>
753
								<td width="78%"><input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /></td>
754
							</tr>
755
						</table>
756
					</div>
757
				</td>
758
			</tr>
759
		</table>
760
	</form>
761

    
762
<?php include("fend.inc"); ?>
763
</body>
764
</html>
(206-206/256)