Project

General

Profile

Download (21.7 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
require_once("vslb.inc");
53

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

    
71
if ($_POST) {
72

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

    
76
	ob_flush();
77
	flush();
78

    
79
	if (!$input_errors) {
80

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

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

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

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

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

    
107
		$need_relayd_restart = false;
108
		if($_POST['lb_use_sticky'] == "yes") {
109
			if (!isset($config['system']['lb_use_sticky'])) {
110
				$config['system']['lb_use_sticky'] = true;
111
				$config['system']['srctrack'] = $_POST['srctrack'];
112
				$need_relayd_restart = true;
113
			}
114
		} else {
115
			if (isset($config['system']['lb_use_sticky'])) {
116
				unset($config['system']['lb_use_sticky']);
117
				$need_relayd_restart = true;
118
			}
119
		}
120

    
121
		if($_POST['gw_switch_default'] == "yes")
122
			$config['system']['gw_switch_default'] = true;
123
		else
124
			unset($config['system']['gw_switch_default']);
125

    
126
		if($_POST['preferoldsa_enable'] == "yes")
127
			$config['ipsec']['preferoldsa'] = true;
128
		elseif (isset($config['ipsec']['preferoldsa']))
129
			unset($config['ipsec']['preferoldsa']);
130

    
131
		$need_racoon_restart = false;
132
		if($_POST['racoondebug_enable'] == "yes") {
133
			if (!isset($config['ipsec']['racoondebug'])) {
134
				$config['ipsec']['racoondebug'] = true;
135
				$need_racoon_restart = true;
136
			}
137
		} else {
138
			if (isset($config['ipsec']['racoondebug'])) {
139
				unset($config['ipsec']['racoondebug']);
140
				$need_racoon_restart = true;
141
			}
142
		}
143

    
144
		if($_POST['maxmss_enable'] == "yes") {
145
                        $config['system']['maxmss_enable'] = true;
146
			$config['system']['maxmss'] = $_POST['maxmss'];
147
                } else {
148
                        unset($config['system']['maxmss_enable']);
149
                        unset($config['system']['maxmss']);
150
		}
151

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

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

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

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

    
172
		write_config();
173

    
174
		$retval = 0;
175
		system_resolvconf_generate(true);
176
		$retval = filter_configure();
177
		if(stristr($retval, "error") <> true)
178
		    $savemsg = get_std_save_message(gettext($retval));
179
		else
180
		    $savemsg = gettext($retval);
181
		
182
		activate_powerd();
183
		load_glxsb();
184
		vpn_ipsec_configure_preferoldsa();
185
		if ($need_racoon_restart)
186
			vpn_ipsec_force_reload();
187
	}
188
}
189

    
190
$pgtitle = array(gettext("System"),gettext("Advanced: Miscellaneous"));
191
include("head.inc");
192

    
193
?>
194

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

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

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

    
(190-190/238)