Project

General

Profile

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

    
8
	Copyright (C) 2008 Shrew Soft Inc
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-misc
41
##|*NAME=System: Advanced: Miscellaneous page
42
##|*DESCR=Allow access to the 'System: Advanced: Miscellaneous' page.
43
##|*MATCH=system_advanced.php*
44
##|-PRIV
45

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

    
53
$pconfig['proxyurl'] = $config['system']['proxyurl'];
54
$pconfig['proxyport'] = $config['system']['proxyport'];
55
$pconfig['proxyuser'] = $config['system']['proxyuser'];
56
$pconfig['proxypass'] = $config['system']['proxypass'];
57
$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
58
$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
59
$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']);
60
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
61
$pconfig['racoondebug_enable'] = isset($config['ipsec']['racoondebug']);
62
$pconfig['maxmss_enable'] = isset($config['system']['maxmss_enable']);
63
$pconfig['maxmss'] = $config['system']['maxmss'];
64
$pconfig['powerd_enable'] = isset($config['system']['powerd_enable']);
65
$pconfig['glxsb_enable'] = isset($config['system']['glxsb_enable']);
66
$pconfig['schedule_states'] = isset($config['system']['schedule_states']);
67
$pconfig['kill_states'] = isset($config['system']['kill_states']);
68
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
69

    
70
if ($_POST) {
71

    
72
    unset($input_errors);
73
    $pconfig = $_POST;
74

    
75
	ob_flush();
76
	flush();
77

    
78
	if (!$input_errors) {
79

    
80
		if($_POST['harddiskstandby'] <> "") {
81
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
82
			system_set_harddisk_standby();
83
		} else
84
			unset($config['system']['harddiskstandby']);
85

    
86
		if($_POST['proxyurl'] <> "")
87
			$config['system']['proxyurl'] = $_POST['proxyurl'];
88
		else
89
			unset($config['system']['proxyurl']);
90

    
91
		if($_POST['proxyport'] <> "")
92
			$config['system']['proxyport'] = $_POST['proxyport'];
93
		else
94
			unset($config['system']['proxyport']);
95

    
96
		if($_POST['proxyuser'] <> "")
97
			$config['system']['proxyuser'] = $_POST['proxyuser'];
98
		else
99
			unset($config['system']['proxyuser']);
100

    
101
		if($_POST['proxypass'] <> "")
102
			$config['system']['proxypass'] = $_POST['proxypass'];
103
		else
104
			unset($config['system']['proxypass']);
105

    
106
		if($_POST['lb_use_sticky'] == "yes")
107
			$config['system']['lb_use_sticky'] = true;
108
		else
109
			unset($config['system']['lb_use_sticky']);
110

    
111
		if($_POST['gw_switch_default'] == "yes")
112
			$config['system']['gw_switch_default'] = true;
113
		else
114
			unset($config['system']['gw_switch_default']);
115

    
116
		if($_POST['preferoldsa_enable'] == "yes")
117
			$config['ipsec']['preferoldsa'] = true;
118
		else
119
			unset($config['ipsec']['preferoldsa']);
120

    
121
		$need_racoon_restart = false;
122
		if($_POST['racoondebug_enable'] == "yes") {
123
			if (!isset($config['ipsec']['racoondebug'])) {
124
				$config['ipsec']['racoondebug'] = true;
125
				$need_racoon_restart = true;
126
			}
127
		} else {
128
			if (isset($config['ipsec']['racoondebug'])) {
129
				unset($config['ipsec']['racoondebug']);
130
				$need_racoon_restart = true;
131
			}
132
		}
133

    
134
		if($_POST['maxmss_enable'] == "yes") {
135
                        $config['system']['maxmss_enable'] = true;
136
			$config['system']['maxmss'] = $_POST['maxmss'];
137
                } else {
138
                        unset($config['system']['maxmss_enable']);
139
                        unset($config['system']['maxmss']);
140
		}
141

    
142
		if($_POST['powerd_enable'] == "yes")
143
                        $config['system']['powerd_enable'] = true;
144
                else
145
                        unset($config['system']['powerd_enable']);
146

    
147
		if($_POST['glxsb_enable'] == "yes")
148
                        $config['system']['glxsb_enable'] = true;
149
                else
150
                        unset($config['system']['glxsb_enable']);
151

    
152
		if($_POST['schedule_states'] == "yes")
153
                        $config['system']['schedule_states'] = true;
154
                else
155
                        unset($config['system']['schedule_states']);
156

    
157
		if($_POST['kill_states'] == "yes")
158
                        $config['system']['kill_states'] = true;
159
                else
160
                        unset($config['system']['kill_states']);
161

    
162
		if($_POST['dnslocalhost'] == "yes")
163
                        $config['system']['dnslocalhost'] = true;
164
                else
165
                        unset($config['system']['dnslocalhost']);
166

    
167
		write_config();
168

    
169
		$retval = 0;
170
		system_resolvconf_generate(true);
171
		$retval = filter_configure();
172
		if(stristr($retval, "error") <> true)
173
		    $savemsg = get_std_save_message(gettext($retval));
174
		else
175
		    $savemsg = gettext($retval);
176
		
177
		activate_powerd();
178
		load_glxsb();
179
		vpn_ipsec_configure_preferoldsa();
180
		if ($need_racoon_restart)
181
			vpn_ipsec_force_reload();
182
	}
183
}
184

    
185
$pgtitle = array(gettext("System"),gettext("Advanced: Miscellaneous"));
186
include("head.inc");
187

    
188
?>
189

    
190
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
191
<?php
192
	include("fbegin.inc");
193
	if ($input_errors)
194
		print_input_errors($input_errors);
195
	if ($savemsg)
196
		print_info_box($savemsg);
197
?>
198
<script type="text/javascript" >
199
function maxmss_checked(obj) {
200
	if (obj.checked)
201
		$('maxmss').enable();
202
	else
203
		$('maxmss').disable();
204
}
205
</script>
206
	<form action="system_advanced_misc.php" method="post" name="iform" id="iform">
207
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
208
			<tr>
209
				<td>
210
					<?php
211
						$tab_array = array();
212
						$tab_array[] = array(gettext("Admin Access"), false, "system_advanced_admin.php");
213
						$tab_array[] = array(gettext("Firewall / NAT"), false, "system_advanced_firewall.php");
214
						$tab_array[] = array(gettext("Networking"), false, "system_advanced_network.php");
215
						$tab_array[] = array(gettext("Miscellaneous"), true, "system_advanced_misc.php");
216
						$tab_array[] = array(gettext("System Tunables"), false, "system_advanced_sysctl.php");
217
						$tab_array[] = array(gettext("Notifications"), false, "system_advanced_notifications.php");
218
						display_top_tabs($tab_array);
219
					?>
220
				</td>
221
			</tr>
222
			<tr>
223
				<td id="mainarea">
224
					<div class="tabcont">
225
						<span class="vexpl">
226
							<span class="red">
227
								<strong><?=gettext("NOTE:"); ?>&nbsp</strong>
228
							</span>
229
							<?=gettext("The options on this page are intended for use by advanced users only."); ?>
230
							<br/>
231
						</span>
232
						<br/>
233
						<table width="100%" border="0" cellpadding="6" cellspacing="0">
234
							<tr>
235
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Proxy support"); ?></td>
236
							</tr>
237
							<tr>
238
								<td width="22%" valign="top" class="vncell"><?=gettext("Proxy URL"); ?></td>
239
								<td width="78%" class="vtable">
240
									<input name="proxyurl" id="proxyurl" value="<?php if ($pconfig['proxyurl'] <> "") echo $pconfig['proxyurl']; ?>" class="formfld unknown">
241
									<br />
242
									<?php printf(gettext("Proxy url for allowing %s to use this proxy to connect outside."),$g['product']); ?>
243
								</td>
244
							</tr>
245
							<tr>
246
								<td width="22%" valign="top" class="vncell"><?=gettext("Proxy Port"); ?></td>
247
								<td width="78%" class="vtable">
248
									<input name="proxyport" id="proxyport" value="<?php if ($pconfig['proxyport'] <> "") echo $pconfig['proxyport']; ?>" class="formfld unknown">
249
									<br />
250
									<?php printf(gettext("Proxy url for allowing %s to use this proxy port to connect outside. Default is 8080 for http protocol or ssl for 443."),$g['product']); ?>
251
								</td>
252
							</tr>
253
							<tr>
254
								<td width="22%" valign="top" class="vncell"><?=gettext("Proxy Username"); ?></td>
255
								<td width="78%" class="vtable">
256
									<input name="proxyuser" id="proxyuser" value="<?php if ($pconfig['proxyuser'] <> "") echo $pconfig['proxyuser']; ?>" class="formfld unknown">
257
									<br />
258
									<?php printf(gettext("Proxy username for allowing %s to use this proxy to connect outside"),$g['product']); ?>
259
								</td>
260
							</tr>
261
							<tr>
262
								<td width="22%" valign="top" class="vncell"><?=gettext("Proxy URL"); ?></td>
263
								<td width="78%" class="vtable">
264
									<input type="password" name="proxypass" id="proxypass" value="<?php if ($pconfig['proxypass'] <> "") echo $pconfig['proxypass']; ?>" class="formfld unknown">
265
									<br />
266
									<?php printf(gettext("Proxy password for allowing %s to use this proxy to connect outside"),$g['product']); ?>
267
								</td>
268
							</tr>
269
							<tr>
270
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Load Balancing"); ?></td>
271
							</tr>
272
							<tr>
273
								<td width="22%" valign="top" class="vncell"><?=gettext("Load Balancing"); ?></td>
274
								<td width="78%" class="vtable">
275
									<input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?php if ($pconfig['lb_use_sticky']) echo "checked=\"checked\""; ?> />
276
									<strong><?=gettext("Use sticky connections"); ?></strong><br/>
277
									<?=gettext("Successive connections will be redirected to the servers " .
278
									"in a round-robin manner with connections from the same " .
279
									"source being sent to the same web server. This 'sticky " .
280
									"connection' will exist as long as there are states that " .
281
									"refer to this connection. Once the states expire, so will " .
282
									"the sticky connection. Further connections from that host " .
283
									"will be redirected to the next web server in the round " .
284
									"robin."); ?>
285
								</td>
286
							</tr>
287
							<tr>
288
								<td width="22%" valign="top" class="vncell"><?=gettext("Load Balancing"); ?></td>
289
								<td width="78%" class="vtable">
290
									<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?php if ($pconfig['gw_switch_default']) echo "checked=\"checked\""; ?> />
291
									<strong><?=gettext("Allow default gateway switching"); ?></strong><br/>
292
									<?=gettext("If the link where the default gateway resides fails " .
293
									"switch the default gateway to another available one."); ?>
294
								</td>
295
							</tr>
296
							<tr>
297
								<td colspan="2" class="list" height="12">&nbsp;</td>
298
							</tr>
299
							<tr>
300
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Power savings"); ?></td>
301
							</tr>
302
							<tr>
303
								<td width="22%" valign="top" class="vncell"><?=gettext("PowerD"); ?></td>
304
								<td width="78%" class="vtable">
305
									<input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?php if ($pconfig['powerd_enable']) echo "checked"; ?> />
306
									<strong><?=gettext("Use PowerD"); ?></strong><br/>
307
									<br />
308
								     <?=gettext("The powerd utility monitors the system state and sets various power control " .
309
								     "options accordingly. It offers three modes (maximum, minimum, and " .
310
								     "adaptive) that can be individually selected while on AC power or batteries. " . 
311
								     "The modes maximum, minimum, and adaptive may be abbreviated max, " .
312
								     "min, adp.   Maximum mode chooses the highest performance values.  Minimum " .
313
								     "mode selects the lowest performance values to get the most power savings. " .
314
								     "Adaptive mode attempts to strike a balance by degrading performance when " .
315
								     "the system appears idle and increasing it when the system is busy.  It " .
316
								     "offers a good balance between a small performance loss for greatly " .
317
								     "increased power savings.  The default mode for {$g['product_name']} is adaptive."); ?>
318
								</td>
319
							</tr>
320
							<tr>
321
								<td colspan="2" class="list" height="12">&nbsp;</td>
322
							</tr>
323
							<tr>
324
								<td colspan="2" valign="top" class="listtopic"><?=gettext("glxsb Crypto Acceleration"); ?></td>
325
							</tr>
326
							<tr>
327
								<td width="22%" valign="top" class="vncell"><?=gettext("glxsb"); ?></td>
328
								<td width="78%" class="vtable">
329
									<input name="glxsb_enable" type="checkbox" id="glxsb_enable" value="yes" <?php if ($pconfig['glxsb_enable']) echo "checked"; ?> />
330
									<strong><?=gettext("Use glxsb"); ?></strong><br/>
331
									<br />
332
								     <?=gettext("The AMD Geode LX Security Block will accelerate some cryptographic functions " .
333
								     "on systems which have the chip. Do not enable this option if you have a " .
334
								     "Hifn cryptographic acceleration card, as this will take precedence and the " .
335
								     "Hifn card will not be used. Acceleration should be automatic for IPsec " .
336
								     "when using Rijndael (AES). OpenVPN should be set for AES-128-CBC."); ?>
337
								     <br/><br/>
338
								     <?=gettext("If you do not have a glxsb chip in your system, this option will have no " .
339
								     "effect. To unload the module, uncheck this option and then reboot."); ?>
340
								</td>
341
							</tr>
342
							<tr>
343
								<td colspan="2" class="list" height="12">&nbsp;</td>
344
							</tr>
345
							<tr>
346
								<td colspan="2" valign="top" class="listtopic"><?=gettext("IP Security"); ?></td>
347
							</tr>
348
							<tr>
349
								<td width="22%" valign="top" class="vncell"><?=gettext("Security Associations"); ?></td>
350
								<td width="78%" class="vtable">
351
									<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
352
									<strong><?=gettext("Prefer older IPsec SAs"); ?></strong>
353
									<br />
354
									<?=gettext("By default, if several SAs match, the newest one is " .
355
									"preferred if it's at least 30 seconds old. Select this " .
356
									"option to always prefer old SAs over new ones."); ?>
357
								</td>
358
							</tr>
359
							<tr>
360
								<td width="22%" valign="top" class="vncell"><?=gettext("IPsec Debug"); ?></td>
361
								<td width="78%" class="vtable">
362
									<input name="racoondebug_enable" type="checkbox" id="racoondebug_enable" value="yes" <?php if ($pconfig['racoondebug_enable']) echo "checked"; ?> />
363
									<strong><?=gettext("Start racoon in debug mode"); ?></strong>
364
									<br />
365
									<?=gettext("Launches racoon in debug mode so that more verbose logs " .
366
									"will be generated to aid in troubleshooting."); ?><br/>
367
									<?=gettext("NOTE: Changing this setting will restart racoon."); ?>
368
								</td>
369
							</tr>
370
							<tr>
371
								<td width="22%" valign="top" class="vncell"><?=gettext("Maximum MSS"); ?></td>
372
								<td width="78%" class="vtable">
373
									<input name="maxmss_enable" type="checkbox" id="maxmss_enable" value="yes" <?php if ($pconfig['maxmss_enable'] == true) echo "checked"; ?> onClick="maxmss_checked(this)" />
374
									<strong><?=gettext("Enable MSS clamping on VPN traffic"); ?></strong>
375
									<br />
376
									<input name="maxmss" id="maxmss" value="<?php if ($pconfig['maxmss'] <> "") echo $pconfig['maxmss']; else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['maxmss_enable'] == false) echo "disabled"; ?>>
377
									<br />
378
									<?=gettext("Enable MSS clamping on TCP flows over VPN. " .
379
									"This helps overcome problems with PMTUD on IPsec VPN links. If left blank, the default value is 1400 bytes. "); ?>
380
								</td>
381
							</tr>
382
                                                        <tr>
383
                                                                <td colspan="2" class="list" height="12">&nbsp;</td>
384
                                                        </tr>
385
                                                        <tr>
386
                                                                <td colspan="2" valign="top" class="listtopic"><?=gettext("Schedules"); ?></td>
387
                                                        </tr>
388
                                                        <tr>
389
                                                                <td width="22%" valign="top" class="vncell"><?=gettext("Schedule States"); ?></td>
390
                                                                <td width="78%" class="vtable">
391
                                                                        <input name="schedule_states" type="checkbox" id="schedule_states" value="yes" <?php if ($pconfig['schedule_states']) echo "checked"; ?> />
392
                                                                        <br />
393
									<?=gettext("By default schedules clear the states of existing connections when expiry time has come. ".
394
									"This option allows to override this setting by not clearing states for existing connections."); ?>
395
                                                                </td>
396
                                                        </tr>
397
                                                        <tr>
398
                                                                <td colspan="2" class="list" height="12">&nbsp;</td>
399
                                                        </tr>
400
                                                        <tr>
401
                                                                <td colspan="2" valign="top" class="listtopic"><?=gettext("DNS Forwarder"); ?></td>
402
                                                        </tr>
403
                                                        <tr>
404
                                                                <td width="22%" valign="top" class="vncell"><?=gettext("Localhost inclusion"); ?></td>
405
                                                                <td width="78%" class="vtable">
406
                                                                        <input name="dnslocalhost" type="checkbox" id="dnslocalhost" value="yes" <?php if ($pconfig['dnslocalhost']) echo "checked"; ?> />
407
                                                                        <br />
408
									<?=gettext("By default localhost (127.0.0.1) will be used as the first DNS server where the DNS forwarder is enabled, so this system uses the DNS forwarder to perform lookups. ".
409
									"Checking this box omits localhost from the list of DNS servers."); ?>
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"><?=gettext("Gateway Monitoring"); ?></td>
417
                                                        </tr>
418
                                                        <tr>
419
                                                                <td width="22%" valign="top" class="vncell"><?=gettext("States"); ?></td>
420
                                                                <td width="78%" class="vtable">
421
                                                                        <input name="kill_states" type="checkbox" id="kill_states" value="yes" <?php if ($pconfig['kill_states']) echo "checked"; ?> />
422
                                                                        <br />
423
									<?=gettext("By default the monitoring process will flush states for a gateway that goes down. ".
424
									"This option allows to override this setting by not clearing states for existing connections."); ?>
425
                                                                </td>
426
                                                        </tr>
427
							<tr>
428
								<td colspan="2" class="list" height="12">&nbsp;</td>
429
							</tr>
430
							<?php if($g['platform'] == "pfSenseDISABLED"): ?>
431
							<tr>
432
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Hardware Settings"); ?></td>
433
							</tr>
434
							<tr>
435
								<td width="22%" valign="top" class="vncell"><?=gettext("Hard disk standby time "); ?></td>
436
								<td width="78%" class="vtable">
437
									<select name="harddiskstandby" class="formselect">
438
										<?php
439
										 	## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
440
											$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");
441
										?>
442
										<option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>><?=gettext("Always on"); ?></option>
443
										<?php
444
											foreach ($sbvals as $sbval):
445
												list($min,$val) = explode(",", $sbval);
446
										?>
447
										<option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> <?=gettext("minutes"); ?></option>
448
										<?php endforeach; ?>
449
									</select>
450
									<br/>
451
									<?=gettext("Puts the hard disk into standby mode when the selected amount of time after the last ".
452
									"access has elapsed."); ?> <em><?=gettext("Do not set this for CF cards."); ?></em>
453
								</td>
454
							</tr>
455
							<tr>
456
								<td colspan="2" class="list" height="12">&nbsp;</td>
457
							</tr>
458
							<?php endif; ?>
459

    
460
							<tr>
461
								<td width="22%" valign="top">&nbsp;</td>
462
								<td width="78%">
463
									<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
464
								</td>
465
							</tr>
466
						</table>
467
					</div>
468
				</td>
469
			</tr>
470
		</table>
471
	</form>
472

    
473
<?php include("fend.inc"); ?>
474
</body>
475
</html>
476

    
(185-185/232)