Project

General

Profile

Download (39 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	vpn_ipsec_phase1.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5

    
6
	Copyright (C) 2008 Shrew Soft Inc
7
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
8
	Copyright (C) 2014 Ermal LUÇI
9
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
10
	All rights reserved.
11

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

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

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

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

    
34
##|+PRIV
35
##|*IDENT=page-vpn-ipsec-editphase1
36
##|*NAME=VPN: IPsec: Edit Phase 1 page
37
##|*DESCR=Allow access to the 'VPN: IPsec: Edit Phase 1' page.
38
##|*MATCH=vpn_ipsec_phase1.php*
39
##|-PRIV
40

    
41
require("functions.inc");
42
require("guiconfig.inc");
43
require_once("ipsec.inc");
44
require_once("vpn.inc");
45
require_once("filter.inc");
46

    
47
if (!is_array($config['ipsec']['phase1']))
48
	$config['ipsec']['phase1'] = array();
49

    
50
if (!is_array($config['ipsec']['phase2']))
51
	$config['ipsec']['phase2'] = array();
52

    
53
$a_phase1 = &$config['ipsec']['phase1'];
54
$a_phase2 = &$config['ipsec']['phase2'];
55

    
56
if (is_numericint($_GET['p1index']))
57
	$p1index = $_GET['p1index'];
58
if (isset($_POST['p1index']) && is_numericint($_POST['p1index']))
59
	$p1index = $_POST['p1index'];
60

    
61
if (isset($_GET['dup']) && is_numericint($_GET['dup']))
62
	$p1index = $_GET['dup'];
63

    
64
if (isset($p1index) && $a_phase1[$p1index]) {
65
	// don't copy the ikeid on dup
66
	if (!isset($_GET['dup']) || !is_numericint($_GET['dup']))
67
		$pconfig['ikeid'] = $a_phase1[$p1index]['ikeid'];
68

    
69
	$old_ph1ent = $a_phase1[$p1index];
70

    
71
	$pconfig['disabled'] = isset($a_phase1[$p1index]['disabled']);
72

    
73
	if ($a_phase1[$p1index]['interface'])
74
		$pconfig['interface'] = $a_phase1[$p1index]['interface'];
75
	else
76
		$pconfig['interface'] = "wan";
77

    
78
	list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $a_phase1[$p1index]['remote-subnet']);
79

    
80
	if (isset($a_phase1[$p1index]['mobile']))
81
		$pconfig['mobile'] = 'true';
82
	else
83
		$pconfig['remotegw'] = $a_phase1[$p1index]['remote-gateway'];
84

    
85
	if (empty($a_phase1[$p1index]['iketype']))
86
		$pconfig['iketype'] = "ikev1";
87
	else
88
		$pconfig['iketype'] = $a_phase1[$p1index]['iketype'];
89
	$pconfig['mode'] = $a_phase1[$p1index]['mode'];
90
	$pconfig['protocol'] = $a_phase1[$p1index]['protocol'];
91
	$pconfig['myid_type'] = $a_phase1[$p1index]['myid_type'];
92
	$pconfig['myid_data'] = $a_phase1[$p1index]['myid_data'];
93
	$pconfig['peerid_type'] = $a_phase1[$p1index]['peerid_type'];
94
	$pconfig['peerid_data'] = $a_phase1[$p1index]['peerid_data'];
95
	$pconfig['ealgo'] = $a_phase1[$p1index]['encryption-algorithm'];
96
	$pconfig['halgo'] = $a_phase1[$p1index]['hash-algorithm'];
97
	$pconfig['dhgroup'] = $a_phase1[$p1index]['dhgroup'];
98
	$pconfig['lifetime'] = $a_phase1[$p1index]['lifetime'];
99
	$pconfig['authentication_method'] = $a_phase1[$p1index]['authentication_method'];
100

    
101
	if (($pconfig['authentication_method'] == "pre_shared_key") ||
102
		($pconfig['authentication_method'] == "xauth_psk_server")) {
103
		$pconfig['pskey'] = $a_phase1[$p1index]['pre-shared-key'];
104
	} else {
105
		$pconfig['certref'] = $a_phase1[$p1index]['certref'];
106
		$pconfig['caref'] = $a_phase1[$p1index]['caref'];
107
	}
108

    
109
	$pconfig['descr'] = $a_phase1[$p1index]['descr'];
110
	$pconfig['nat_traversal'] = $a_phase1[$p1index]['nat_traversal'];
111
        $pconfig['mobike'] = $a_phase1[$p1index]['mobike'];
112

    
113
	if (isset($a_phase1[$p1index]['reauth_enable']))
114
		$pconfig['reauth_enable'] = true;
115
	if (isset($a_phase1[$p1index]['rekey_enable']))
116
		$pconfig['rekey_enable'] = true;
117
	if (isset($a_phase1[$p1index]['responderonly']))
118
		$pconfig['responderonly'] = true;
119

    
120
	if ($a_phase1[$p1index]['dpd_delay'] &&	$a_phase1[$p1index]['dpd_maxfail']) {
121
		$pconfig['dpd_enable'] = true;
122
		$pconfig['dpd_delay'] = $a_phase1[$p1index]['dpd_delay'];
123
		$pconfig['dpd_maxfail'] = $a_phase1[$p1index]['dpd_maxfail'];
124
	}
125
} else {
126
	/* defaults */
127
	$pconfig['interface'] = "wan";
128
	if($config['interfaces']['lan'])
129
		$pconfig['localnet'] = "lan";
130
	$pconfig['mode'] = "main";
131
	$pconfig['protocol'] = "inet";
132
	$pconfig['myid_type'] = "myaddress";
133
	$pconfig['peerid_type'] = "peeraddress";
134
	$pconfig['authentication_method'] = "pre_shared_key";
135
	$pconfig['ealgo'] = array( name => "aes" );
136
	$pconfig['halgo'] = "sha1";
137
	$pconfig['dhgroup'] = "2";
138
	$pconfig['lifetime'] = "28800";
139
	$pconfig['nat_traversal'] = 'on';
140
        $pconfig['mobike'] = 'off';
141
	$pconfig['dpd_enable'] = true;
142
	$pconfig['iketype'] = "ikev1";
143

    
144
	/* mobile client */
145
	if($_GET['mobile']) {
146
		$pconfig['mobile']=true;
147
                $pconfig['mode'] = "aggressive";
148
	}
149
}
150

    
151
if (isset($_GET['dup']) && is_numericint($_GET['dup']))
152
	unset($p1index);
153

    
154
if ($_POST) {
155
	unset($input_errors);
156
	$pconfig = $_POST;
157

    
158
	/* input validation */
159

    
160
	$method = $pconfig['authentication_method'];
161
	// Unset ca and cert if not required to avaoid storing in config
162
	if ($method == "pre_shared_key" || $method == "xauth_psk_server"){
163
		unset($pconfig['caref']);
164
		unset($pconfig['certref']);
165
	}
166

    
167
	// Only require PSK here for normal PSK tunnels (not mobile) or xauth.
168
	// For RSA methods, require the CA/Cert.
169
	switch ($method) {
170
		case 'eap-mschapv2':
171
			if ($pconfig['iketype'] != 'ikev2')
172
				$input_errors[] = gettext("EAP-MSChapv2 can only be used with IKEv2 type VPNs.");
173
			break;
174
		case "eap-tls":
175
			if ($pconfig['iketype'] != 'ikev2')
176
				$input_errors[] = gettext("EAP-TLS can only be used with IKEv2 type VPNs.");
177
			break;
178
		case "pre_shared_key":
179
			// If this is a mobile PSK tunnel the user PSKs go on
180
			//    the PSK tab, not here, so skip the check.
181
			if ($pconfig['mobile'])
182
				break;
183
		case "xauth_psk_server":
184
			$reqdfields = explode(" ", "pskey");
185
			$reqdfieldsn = array(gettext("Pre-Shared Key"));
186
			$validate_pskey = true;
187
			break;
188
		case "hybrid_rsa_server":
189
		case "xauth_rsa_server":
190
		case "rsasig":
191
			$reqdfields = explode(" ", "caref certref");
192
			$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
193
			break;
194
	}
195
	if (!$pconfig['mobile']) {
196
		$reqdfields[] = "remotegw";
197
		$reqdfieldsn[] = gettext("Remote gateway");
198
	}
199

    
200
	do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
201

    
202
	if (isset($validate_pskey) && isset($pconfig['pskey']) && !preg_match('/^[[:ascii:]]*$/', $pconfig['pskey'])) {
203
		unset($validate_pskey);
204
		$input_errors[] = gettext("Pre-Shared Key contains invalid characters.");
205
	}
206

    
207
	if (($pconfig['lifetime'] && !is_numeric($pconfig['lifetime'])))
208
		$input_errors[] = gettext("The P1 lifetime must be an integer.");
209

    
210
	if ($pconfig['remotegw']) {
211
		if (!is_ipaddr($pconfig['remotegw']) && !is_domain($pconfig['remotegw']))
212
			$input_errors[] = gettext("A valid remote gateway address or host name must be specified.");
213
		elseif (is_ipaddrv4($pconfig['remotegw']) && ($pconfig['protocol'] != "inet"))
214
			$input_errors[] = gettext("A valid remote gateway IPv4 address must be specified or you need to change protocol to IPv6");
215
		elseif (is_ipaddrv6($pconfig['remotegw']) && ($pconfig['protocol'] != "inet6"))
216
			$input_errors[] = gettext("A valid remote gateway IPv6 address must be specified or you need to change protocol to IPv4");
217
	}
218

    
219
	if (($pconfig['remotegw'] && is_ipaddr($pconfig['remotegw']) && !isset($pconfig['disabled']) )) {
220
		$t = 0;
221
		foreach ($a_phase1 as $ph1tmp) {
222
			if ($p1index <> $t) {
223
				$tremotegw = $pconfig['remotegw'];
224
				if (($ph1tmp['remote-gateway'] == $tremotegw) && !isset($ph1tmp['disabled'])) {
225
					$input_errors[] = sprintf(gettext('The remote gateway "%1$s" is already used by phase1 "%2$s".'), $tremotegw, $ph1tmp['descr']);
226
				}
227
			}
228
			$t++;
229
		}
230
	}
231

    
232
	if (is_array($a_phase2) && (count($a_phase2))) {
233
		foreach ($a_phase2 as $phase2) {
234
			if($phase2['ikeid'] == $pconfig['ikeid']) {
235
				if (($pconfig['protocol'] == "inet") && ($phase2['mode'] == "tunnel6")) {
236
					$input_errors[] = gettext("There is a Phase 2 using IPv6, you cannot use IPv4.");
237
					break;
238
				}
239
				if (($pconfig['protocol'] == "inet6") && ($phase2['mode'] == "tunnel")) {
240
					$input_errors[] = gettext("There is a Phase 2 using IPv4, you cannot use IPv6.");
241
					break;
242
				}
243
			}
244
		}
245
	}
246

    
247
	/* My identity */
248

    
249
	if ($pconfig['myid_type'] == "myaddress")
250
		$pconfig['myid_data'] = "";
251

    
252
	if ($pconfig['myid_type'] == "address" and $pconfig['myid_data'] == "")
253
		$input_errors[] = gettext("Please enter an address for 'My Identifier'");
254

    
255
	if ($pconfig['myid_type'] == "keyid tag" and $pconfig['myid_data'] == "")
256
		$input_errors[] = gettext("Please enter a keyid tag for 'My Identifier'");
257

    
258
	if ($pconfig['myid_type'] == "fqdn" and $pconfig['myid_data'] == "")
259
		$input_errors[] = gettext("Please enter a fully qualified domain name for 'My Identifier'");
260

    
261
	if ($pconfig['myid_type'] == "user_fqdn" and $pconfig['myid_data'] == "")
262
		$input_errors[] = gettext("Please enter a user and fully qualified domain name for 'My Identifier'");
263

    
264
	if ($pconfig['myid_type'] == "dyn_dns" and $pconfig['myid_data'] == "")
265
		$input_errors[] = gettext("Please enter a dynamic domain name for 'My Identifier'");
266

    
267
	if ((($pconfig['myid_type'] == "address") && !is_ipaddr($pconfig['myid_data'])))
268
		$input_errors[] = gettext("A valid IP address for 'My identifier' must be specified.");
269

    
270
	if ((($pconfig['myid_type'] == "fqdn") && !is_domain($pconfig['myid_data'])))
271
		$input_errors[] = gettext("A valid domain name for 'My identifier' must be specified.");
272

    
273
	if ($pconfig['myid_type'] == "fqdn")
274
		if (is_domain($pconfig['myid_data']) == false)
275
			$input_errors[] = gettext("A valid FQDN for 'My identifier' must be specified.");
276

    
277
	if ($pconfig['myid_type'] == "user_fqdn") {
278
		$user_fqdn = explode("@",$pconfig['myid_data']);
279
		if (is_domain($user_fqdn[1]) == false)
280
			$input_errors[] = gettext("A valid User FQDN in the form of user@my.domain.com for 'My identifier' must be specified.");
281
	}
282

    
283
	if ($pconfig['myid_type'] == "dyn_dns")
284
		if (is_domain($pconfig['myid_data']) == false)
285
			$input_errors[] = gettext("A valid Dynamic DNS address for 'My identifier' must be specified.");
286

    
287
	/* Peer identity */
288

    
289
	if ($pconfig['myid_type'] == "peeraddress")
290
		$pconfig['peerid_data'] = "";
291

    
292
	// Only enforce peer ID if we are not dealing with a pure-psk mobile config.
293
	if (!(($pconfig['authentication_method'] == "pre_shared_key") && ($pconfig['mobile']))) {
294
		if ($pconfig['peerid_type'] == "address" and $pconfig['peerid_data'] == "")
295
			$input_errors[] = gettext("Please enter an address for 'Peer Identifier'");
296

    
297
		if ($pconfig['peerid_type'] == "keyid tag" and $pconfig['peerid_data'] == "")
298
			$input_errors[] = gettext("Please enter a keyid tag for 'Peer Identifier'");
299

    
300
		if ($pconfig['peerid_type'] == "fqdn" and $pconfig['peerid_data'] == "")
301
			$input_errors[] = gettext("Please enter a fully qualified domain name for 'Peer Identifier'");
302

    
303
		if ($pconfig['peerid_type'] == "user_fqdn" and $pconfig['peerid_data'] == "")
304
			$input_errors[] = gettext("Please enter a user and fully qualified domain name for 'Peer Identifier'");
305

    
306
		if ((($pconfig['peerid_type'] == "address") && !is_ipaddr($pconfig['peerid_data'])))
307
			$input_errors[] = gettext("A valid IP address for 'Peer identifier' must be specified.");
308

    
309
		if ((($pconfig['peerid_type'] == "fqdn") && !is_domain($pconfig['peerid_data'])))
310
			$input_errors[] = gettext("A valid domain name for 'Peer identifier' must be specified.");
311

    
312
		if ($pconfig['peerid_type'] == "fqdn")
313
			if (is_domain($pconfig['peerid_data']) == false)
314
				$input_errors[] = gettext("A valid FQDN for 'Peer identifier' must be specified.");
315

    
316
		if ($pconfig['peerid_type'] == "user_fqdn") {
317
			$user_fqdn = explode("@",$pconfig['peerid_data']);
318
			if (is_domain($user_fqdn[1]) == false)
319
				$input_errors[] = gettext("A valid User FQDN in the form of user@my.domain.com for 'Peer identifier' must be specified.");
320
		}
321
	}
322

    
323
	if ($pconfig['dpd_enable']) {
324
		if (!is_numeric($pconfig['dpd_delay']))
325
			$input_errors[] = gettext("A numeric value must be specified for DPD delay.");
326

    
327
		if (!is_numeric($pconfig['dpd_maxfail']))
328
			$input_errors[] = gettext("A numeric value must be specified for DPD retries.");
329
	}
330

    
331
	if (!empty($pconfig['iketype']) && $pconfig['iketype'] != "ikev1" && $pconfig['iketype'] != "ikev2" && $pconfig['iketype'] != "auto")
332
		$input_errors[] = gettext("Valid arguments for IKE type is v1 or v2 or auto");
333
                
334
        if (!empty($_POST['ealgo']) && isset($config['system']['crypto_hardware'])) {
335
            if ($config['system']['crypto_hardware'] == "glxsb") {
336
                if ($_POST['ealgo'] == "aes" && $_POST['ealgo_keylen'] != "128")
337
                    $input_errors[] = gettext("Only 128 bit AES can be used where the glxsb crypto accelerator is enabled.");
338
            }
339
        }
340

    
341
	/* build our encryption algorithms array */
342
	$pconfig['ealgo'] = array();
343
	$pconfig['ealgo']['name'] = $_POST['ealgo'];
344
	if($pconfig['ealgo_keylen'])
345
		$pconfig['ealgo']['keylen'] = $_POST['ealgo_keylen'];
346

    
347
	if (!$input_errors) {
348
		$ph1ent['ikeid'] = $pconfig['ikeid'];
349
		$ph1ent['iketype'] = $pconfig['iketype'];
350
		if ($pconfig['iketype'] != 'ikev1')
351
			unset($ph1ent['mode']);
352
		else
353
			$ph1ent['mode'] = $pconfig['mode'];
354
		$ph1ent['disabled'] = $pconfig['disabled'] ? true : false;
355
		$ph1ent['interface'] = $pconfig['interface'];
356
		/* if the remote gateway changed and the interface is not WAN then remove route */
357
		/* the vpn_ipsec_configure() handles adding the route */
358
		if ($pconfig['interface'] <> "wan") {
359
			if($old_ph1ent['remote-gateway'] <> $pconfig['remotegw']) {
360
				mwexec("/sbin/route delete -host {$old_ph1ent['remote-gateway']}");
361
			}
362
		}
363

    
364
		if ($pconfig['mobile'])
365
			$ph1ent['mobile'] = true;
366
		else
367
			$ph1ent['remote-gateway'] = $pconfig['remotegw'];
368

    
369
		$ph1ent['protocol'] = $pconfig['protocol'];
370

    
371
		$ph1ent['myid_type'] = $pconfig['myid_type'];
372
		$ph1ent['myid_data'] = $pconfig['myid_data'];
373
		$ph1ent['peerid_type'] = $pconfig['peerid_type'];
374
		$ph1ent['peerid_data'] = $pconfig['peerid_data'];
375

    
376
		$ph1ent['encryption-algorithm'] = $pconfig['ealgo'];
377
		$ph1ent['hash-algorithm'] = $pconfig['halgo'];
378
		$ph1ent['dhgroup'] = $pconfig['dhgroup'];
379
		$ph1ent['lifetime'] = $pconfig['lifetime'];
380
		$ph1ent['pre-shared-key'] = $pconfig['pskey'];
381
		$ph1ent['private-key'] = base64_encode($pconfig['privatekey']);
382
		$ph1ent['certref'] = $pconfig['certref'];
383
		$ph1ent['caref'] = $pconfig['caref'];
384
		$ph1ent['authentication_method'] = $pconfig['authentication_method'];
385
		$ph1ent['descr'] = $pconfig['descr'];
386
		$ph1ent['nat_traversal'] = $pconfig['nat_traversal'];
387
                $ph1ent['mobike'] = $pconfig['mobike'];
388

    
389
		if (isset($pconfig['reauth_enable']))
390
			$ph1ent['reauth_enable'] = true;
391
		else
392
			unset($ph1ent['reauth_enable']);
393
		if (isset($pconfig['rekey_enable']))
394
			$ph1ent['rekey_enable'] = true;
395
		else
396
			unset($ph1ent['rekey_enable']);
397

    
398
		if (isset($pconfig['responderonly']))
399
			$ph1ent['responderonly'] = true;
400
		else
401
			unset($ph1ent['responderonly']);
402

    
403
		if (isset($pconfig['dpd_enable'])) {
404
			$ph1ent['dpd_delay'] = $pconfig['dpd_delay'];
405
			$ph1ent['dpd_maxfail'] = $pconfig['dpd_maxfail'];
406
		}
407

    
408
		/* generate unique phase1 ikeid */
409
		if ($ph1ent['ikeid'] == 0)
410
			$ph1ent['ikeid'] = ipsec_ikeid_next();
411

    
412
		if (isset($p1index) && $a_phase1[$p1index])
413
			$a_phase1[$p1index] = $ph1ent;
414
		else
415
			$a_phase1[] = $ph1ent;
416

    
417
		write_config();
418
		mark_subsystem_dirty('ipsec');
419

    
420
		header("Location: vpn_ipsec.php");
421
		exit;
422
	}
423
}
424

    
425
if ($pconfig['mobile'])
426
	$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Edit Phase 1"), gettext("Mobile Client"));
427
else
428
	$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Edit Phase 1"));
429
$shortcut_section = "ipsec";
430

    
431

    
432
include("head.inc");
433

    
434
?>
435

    
436
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
437
<?php include("fbegin.inc"); ?>
438
<script type="text/javascript">
439
//<![CDATA[
440

    
441
function myidsel_change() {
442
	index = document.iform.myid_type.selectedIndex;
443
	value = document.iform.myid_type.options[index].value;
444
	if (value == 'myaddress')
445
			document.getElementById('myid_data').style.visibility = 'hidden';
446
	else
447
			document.getElementById('myid_data').style.visibility = 'visible';
448
}
449

    
450
function iketype_change() {
451
	index = document.iform.iketype.selectedIndex;
452
	value = document.iform.iketype.options[index].value;
453
	if (value == 'ikev2') {
454
			document.getElementById('negmode').style.display= 'none';
455
                        document.getElementById('mobike').style.display= '';
456
                        document.getElementById('natt').style.display= 'none';
457
                        document.getElementById('disablereauth').style.display= '';
458
        } else {
459
			document.getElementById('negmode').style.display = '';
460
                        document.getElementById('mobike').style.display = 'none';
461
                        document.getElementById('natt').style.display= '';
462
                        document.getElementById('disablereauth').style.display= 'none';
463
        }
464
}
465

    
466
function peeridsel_change() {
467
	index = document.iform.peerid_type.selectedIndex;
468
	value = document.iform.peerid_type.options[index].value;
469
	if (value == 'peeraddress')
470
			document.getElementById('peerid_data').style.visibility = 'hidden';
471
	else
472
			document.getElementById('peerid_data').style.visibility = 'visible';
473
}
474

    
475
function methodsel_change() {
476
	index = document.iform.authentication_method.selectedIndex;
477
	value = document.iform.authentication_method.options[index].value;
478

    
479
	switch (value) {
480
	case 'eap-mschapv2':
481
	case 'eap-tls':
482
		document.getElementById('opt_psk').style.display = 'none';
483
		document.getElementById('opt_peerid').style.display = '';
484
		document.getElementById('opt_cert').style.display = '';
485
		document.getElementById('opt_ca').style.display = '';
486
		document.getElementById('opt_cert').disabled = false;
487
		document.getElementById('opt_ca').disabled = false;
488
		break;
489
	case 'hybrid_rsa_server':
490
		document.getElementById('opt_psk').style.display = 'none';
491
		document.getElementById('opt_peerid').style.display = '';
492
		document.getElementById('opt_cert').style.display = '';
493
		document.getElementById('opt_ca').style.display = '';
494
		document.getElementById('opt_cert').disabled = false;
495
		document.getElementById('opt_ca').disabled = false;
496
		break;
497
	case 'xauth_rsa_server':
498
	case 'rsasig':
499
		document.getElementById('opt_psk').style.display = 'none';
500
		document.getElementById('opt_peerid').style.display = '';
501
		document.getElementById('opt_cert').style.display = '';
502
		document.getElementById('opt_ca').style.display = '';
503
		document.getElementById('opt_cert').disabled = false;
504
		document.getElementById('opt_ca').disabled = false;
505
		break;
506
<?php if ($pconfig['mobile']) { ?>
507
	case 'pre_shared_key':
508
		document.getElementById('opt_psk').style.display = 'none';
509
		document.getElementById('opt_peerid').style.display = 'none';
510
		document.getElementById('opt_cert').style.display = 'none';
511
		document.getElementById('opt_ca').style.display = 'none';
512
		document.getElementById('opt_cert').disabled = true;
513
		document.getElementById('opt_ca').disabled = true;
514
		break;
515
<?php } ?>
516
	default: /* psk modes*/
517
		document.getElementById('opt_psk').style.display = '';
518
		document.getElementById('opt_peerid').style.display = '';
519
		document.getElementById('opt_cert').style.display = 'none';
520
		document.getElementById('opt_ca').style.display = 'none';
521
		document.getElementById('opt_cert').disabled = true;
522
		document.getElementById('opt_ca').disabled = true;
523
		break;
524
	}
525
}
526

    
527
/* PHP generated java script for variable length keys */
528
function ealgosel_change(bits) {
529
	switch (document.iform.ealgo.selectedIndex) {
530
<?php
531
$i = 0;
532
foreach ($p1_ealgos as $algo => $algodata) {
533
	if (is_array($algodata['keysel'])) {
534
		echo "		case {$i}:\n";
535
		echo "			document.iform.ealgo_keylen.style.visibility = 'visible';\n";
536
		echo "			document.iform.ealgo_keylen.options.length = 0;\n";
537
	//      echo "			document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( 'auto', 'auto' );\n";
538

    
539
		$key_hi = $algodata['keysel']['hi'];
540
		$key_lo = $algodata['keysel']['lo'];
541
		$key_step = $algodata['keysel']['step'];
542

    
543
		for ($keylen = $key_hi; $keylen >= $key_lo; $keylen -= $key_step)
544
			echo "			document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( '{$keylen} bits', '{$keylen}' );\n";
545
		echo "			break;\n";
546
	} else {
547
		echo "		case {$i}:\n";
548
		echo "			document.iform.ealgo_keylen.style.visibility = 'hidden';\n";
549
		echo "			document.iform.ealgo_keylen.options.length = 0;\n";
550
		echo "			break;\n";
551
	}
552
	$i++;
553
}
554
?>
555
	}
556

    
557
	if( bits )
558
		document.iform.ealgo_keylen.value = bits;
559
}
560

    
561
function dpdchkbox_change() {
562
	if( document.iform.dpd_enable.checked )
563
		document.getElementById('opt_dpd').style.display = '';
564
	else
565
		document.getElementById('opt_dpd').style.display = 'none';
566

    
567
	if (!document.iform.dpd_delay.value)
568
		document.iform.dpd_delay.value = "10";
569

    
570
	if (!document.iform.dpd_maxfail.value)
571
		document.iform.dpd_maxfail.value = "5";
572
}
573

    
574
//]]>
575
</script>
576

    
577
<form action="vpn_ipsec_phase1.php" method="post" name="iform" id="iform">
578

    
579
<?php
580
	if ($input_errors)
581
		print_input_errors($input_errors);
582
?>
583

    
584
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec phase-1">
585
	<tr class="tabnavtbl">
586
		<td id="tabnav">
587
			<?php
588
				$tab_array = array();
589
				$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
590
				$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
591
				$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
592
				$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
593
				display_top_tabs($tab_array);
594
			?>
595
		</td>
596
	</tr>
597
	<tr>
598
		<td id="mainarea">
599
			<div class="tabcont">
600
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
601
					<tr>
602
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
603
					</tr>
604
					<tr>
605
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
606
						<td width="78%" class="vtable">
607
							<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked=\"checked\""; ?> />
608
							<strong><?=gettext("Disable this phase1 entry"); ?></strong><br />
609
							<span class="vexpl">
610
								<?=gettext("Set this option to disable this phase1 without " .
611
								"removing it from the list"); ?>.
612
							</span>
613
						</td>
614
					</tr>
615
					<tr>
616
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Key Exchange version"); ?></td>
617
						<td width="78%" class="vtable">
618
							<select name="iketype" class="formselect" onchange='iketype_change()'>
619
							<?php
620
								$keyexchange = array("ikev1" => "V1", "ikev2" => "V2", "auto" => "Auto");
621
								foreach ($keyexchange as $kidx => $name):
622
							?>
623
								<option value="<?=$kidx;?>" <?php if ($kidx == $pconfig['iketype']) echo "selected=\"selected\""; ?>>
624
									<?=htmlspecialchars($name);?>
625
								</option>
626
							<?php endforeach; ?>
627
							</select> <br /> <span class="vexpl"><?=gettext("Select the Internet Key Exchange protocol version to be used, IKEv1 or IKEv2"); ?>.</span>
628
						</td>
629
					</tr>
630
					<tr>
631
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Internet Protocol"); ?></td>
632
						<td width="78%" class="vtable">
633
							<select name="protocol" class="formselect">
634
							<?php
635
								$protocols = array("inet" => "IPv4", "inet6" => "IPv6");
636
								foreach ($protocols as $protocol => $name):
637
							?>
638
								<option value="<?=$protocol;?>" <?php if ($protocol == $pconfig['protocol']) echo "selected=\"selected\""; ?>>
639
									<?=htmlspecialchars($name);?>
640
								</option>
641
							<?php endforeach; ?>
642
							</select> <br /> <span class="vexpl"><?=gettext("Select the Internet Protocol family from this dropdown"); ?>.</span>
643
						</td>
644
					</tr>
645
					<tr>
646
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
647
						<td width="78%" class="vtable">
648
							<select name="interface" class="formselect">
649
							<?php
650
								$interfaces = get_configured_interface_with_descr();
651

    
652
								$carplist = get_configured_carp_interface_list();
653
								foreach ($carplist as $cif => $carpip)
654
									$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
655

    
656
								$aliaslist = get_configured_ip_aliases_list();
657
								foreach ($aliaslist as $aliasip => $aliasif)
658
									$interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
659

    
660
								$grouplist = return_gateway_groups_array();
661
								foreach ($grouplist as $name => $group) {
662
									if($group[0]['vip'] <> "")
663
										$vipif = $group[0]['vip'];
664
									else
665
										$vipif = $group[0]['int'];
666
									$interfaces[$name] = "GW Group {$name}";
667
								}
668

    
669

    
670
								foreach ($interfaces as $iface => $ifacename):
671
							?>
672
								<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
673
									<?=htmlspecialchars($ifacename);?>
674
								</option>
675
							<?php endforeach; ?>
676
							</select>
677
							<br />
678
							<span class="vexpl"><?=gettext("Select the interface for the local endpoint of this phase1 entry"); ?>.</span>
679
						</td>
680
					</tr>
681

    
682
					<?php if (!$pconfig['mobile']): ?>
683

    
684
					<tr>
685
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Remote gateway"); ?></td>
686
						<td width="78%" class="vtable">
687
							<?=$mandfldhtml;?><input name="remotegw" type="text" class="formfld unknown" id="remotegw" size="28" value="<?=htmlspecialchars($pconfig['remotegw']);?>" />
688
							<br />
689
							<?=gettext("Enter the public IP address or host name of the remote gateway"); ?>
690
						</td>
691
					</tr>
692

    
693
					<?php endif; ?>
694

    
695
					<tr>
696
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
697
						<td width="78%" class="vtable">
698
							<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
699
							<br />
700
							<span class="vexpl">
701
								<?=gettext("You may enter a description here " .
702
								"for your reference (not parsed)"); ?>.
703
							</span>
704
						</td>
705
					</tr>
706
					<tr>
707
						<td colspan="2" class="list" height="12"></td>
708
					</tr>
709
					<tr>
710
						<td colspan="2" valign="top" class="listtopic">
711
							<?=gettext("Phase 1 proposal (Authentication)"); ?>
712
						</td>
713
					</tr>
714
					<tr>
715
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication method"); ?></td>
716
						<td width="78%" class="vtable">
717
							<select name="authentication_method" class="formselect" onchange="methodsel_change()">
718
							<?php
719
								foreach ($p1_authentication_methods as $method_type => $method_params):
720
									if (!$pconfig['mobile'] && $method_params['mobile'])
721
										continue;
722
							?>
723
								<option value="<?=$method_type;?>" <?php if ($method_type == $pconfig['authentication_method']) echo "selected=\"selected\""; ?>>
724
									<?=htmlspecialchars($method_params['name']);?>
725
								</option>
726
							<?php endforeach; ?>
727
							</select>
728
							<br />
729
							<span class="vexpl">
730
								<?=gettext("Must match the setting chosen on the remote side"); ?>.
731
							</span>
732
						</td>
733
					</tr>
734
					<tr id='negmode' >
735
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Negotiation mode"); ?></td>
736
						<td width="78%" class="vtable">
737
							<select name="mode" class="formselect">
738
							<?php
739
								$modes = array("main" => "Main", "aggressive" => "Aggressive");
740
								foreach ($modes as $mode => $mdescr):
741
							?>
742
								<option value="<?=$mode;?>" <?php if ($mode == $pconfig['mode']) echo "selected=\"selected\""; ?>>
743
									<?=htmlspecialchars($mdescr);?>
744
								</option>
745
							<?php endforeach; ?>
746
							</select> <br /> <span class="vexpl"><?=gettext("Aggressive is more flexible, but less secure"); ?>.</span>
747
						</td>
748
					</tr>
749
					<tr>
750
						<td width="22%" valign="top" class="vncellreq"><?=gettext("My identifier"); ?></td>
751
						<td width="78%" class="vtable">
752
							<select name="myid_type" class="formselect" onchange="myidsel_change()">
753
							<?php foreach ($my_identifier_list as $id_type => $id_params): ?>
754
								<option value="<?=$id_type;?>" <?php if ($id_type == $pconfig['myid_type']) echo "selected=\"selected\""; ?>>
755
									<?=htmlspecialchars($id_params['desc']);?>
756
								</option>
757
							<?php endforeach; ?>
758
							</select>
759
							<input name="myid_data" type="text" class="formfld unknown" id="myid_data" size="30" value="<?=htmlspecialchars($pconfig['myid_data']);?>" />
760
						</td>
761
					</tr>
762
					<tr id="opt_peerid">
763
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer identifier"); ?></td>
764
						<td width="78%" class="vtable">
765
							<select name="peerid_type" class="formselect" onchange="peeridsel_change()">
766
							<?php
767
								foreach ($peer_identifier_list as $id_type => $id_params):
768
									if ($pconfig['mobile'] && !$id_params['mobile'])
769
										continue;
770
							?>
771
							<option value="<?=$id_type;?>" <?php if ($id_type == $pconfig['peerid_type']) echo "selected=\"selected\""; ?>>
772
								<?=htmlspecialchars($id_params['desc']);?>
773
							</option>
774
							<?php endforeach; ?>
775
							</select>
776
							<input name="peerid_data" type="text" class="formfld unknown" id="peerid_data" size="30" value="<?=htmlspecialchars($pconfig['peerid_data']);?>" />
777
						<?php if ($pconfig['mobile']) { ?>
778
							<br /><br /><?=gettext("NOTE: This is known as the \"group\" setting on some VPN client implementations"); ?>.
779
						<?php } ?>
780
						</td>
781
					</tr>
782
					<tr id="opt_psk">
783
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Pre-Shared Key"); ?></td>
784
						<td width="78%" class="vtable">
785
							<?=$mandfldhtml;?>
786
							<input name="pskey" type="text" class="formfld unknown" id="pskey" size="40" value="<?=htmlspecialchars($pconfig['pskey']);?>" />
787
							<span class="vexpl">
788
							<br />
789
								<?=gettext("Input your Pre-Shared Key string"); ?>.
790
							</span>
791
						</td>
792
					</tr>
793
					<tr id="opt_cert">
794
						<td width="22%" valign="top" class="vncellreq"><?=gettext("My Certificate"); ?></td>
795
						<td width="78%" class="vtable">
796
							<select name="certref" class="formselect">
797
							<?php
798
								foreach ($config['cert'] as $cert):
799
									$selected = "";
800
									if ($pconfig['certref'] == $cert['refid'])
801
										$selected = "selected=\"selected\"";
802
							?>
803
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'];?></option>
804
							<?php endforeach; ?>
805
							</select>
806
							<br />
807
							<span class="vexpl">
808
								<?=gettext("Select a certificate previously configured in the Certificate Manager"); ?>.
809
							</span>
810
						</td>
811
					</tr>
812
					<tr id="opt_ca">
813
						<td width="22%" valign="top" class="vncellreq"><?=gettext("My Certificate Authority"); ?></td>
814
						<td width="78%" class="vtable">
815
							<select name="caref" class="formselect">
816
							<?php
817
								foreach ($config['ca'] as $ca):
818
									$selected = "";
819
									if ($pconfig['caref'] == $ca['refid'])
820
										$selected = "selected=\"selected\"";
821
							?>
822
								<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
823
							<?php endforeach; ?>
824
							</select>
825
							<br />
826
							<span class="vexpl">
827
								<?=gettext("Select a certificate authority previously configured in the Certificate Manager"); ?>.
828
							</span>
829
						</td>
830
					</tr>
831
					<tr>
832
						<td colspan="2" valign="top" class="listtopic">
833
							<?=gettext("Phase 1 proposal (Algorithms)"); ?>
834
						</td>
835
					</tr>
836
					<tr>
837
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
838
						<td width="78%" class="vtable">
839
							<select name="ealgo" class="formselect" onchange="ealgosel_change()">
840
							<?php
841
								foreach ($p1_ealgos as $algo => $algodata):
842
									$selected = "";
843
									if ($algo == $pconfig['ealgo']['name'])
844
										$selected = " selected=\"selected\"";
845
							?>
846
								<option value="<?=$algo;?>"<?=$selected?>>
847
									<?=htmlspecialchars($algodata['name']);?>
848
								</option>
849
							<?php endforeach; ?>
850
							</select>
851
							<select name="ealgo_keylen" width="30" class="formselect">
852
							</select>
853
						</td>
854
					</tr>
855
					<tr>
856
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Hash algorithm"); ?></td>
857
						<td width="78%" class="vtable">
858
							<select name="halgo" class="formselect">
859
							<?php foreach ($p1_halgos as $algo => $algoname): ?>
860
								<option value="<?=$algo;?>" <?php if ($algo == $pconfig['halgo']) echo "selected=\"selected\""; ?>>
861
									<?=htmlspecialchars($algoname);?>
862
								</option>
863
							<?php endforeach; ?>
864
							</select>
865
							<br />
866
							<span class="vexpl">
867
								<?=gettext("Must match the setting chosen on the remote side"); ?>.
868
							</span>
869
						</td>
870
					</tr>
871
					<tr>
872
						<td width="22%" valign="top" class="vncellreq"><?=gettext("DH key group"); ?></td>
873
						<td width="78%" class="vtable">
874
							<select name="dhgroup" class="formselect">
875
							<?php foreach ($p1_dhgroups as $keygroup => $keygroupname): ?>
876
								<option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['dhgroup']) echo "selected=\"selected\""; ?>>
877
									<?=htmlspecialchars($keygroupname);?>
878
								</option>
879
							<?php endforeach; ?>
880
							</select>
881
							<br />
882
							<span class="vexpl">
883
								<?=gettext("Must match the setting chosen on the remote side"); ?>.
884
							</span>
885
						</td>
886
					</tr>
887
					<tr>
888
						<td width="22%" valign="top" class="vncell"><?=gettext("Lifetime"); ?></td>
889
						<td width="78%" class="vtable">
890
							<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="20" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />
891
							<?=gettext("seconds"); ?>
892
						</td>
893
					</tr>
894
					<tr>
895
						<td colspan="2" class="list" height="12"></td>
896
					</tr>
897
					<tr>
898
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced Options"); ?></td>
899
					</tr>
900
					<tr>
901
						<td width="22%" valign="top" class="vncell"><?=gettext("Disable Rekey");?></td>
902
						<td width="78%" class="vtable">
903
							<input name="rekey_enable" type="checkbox" id="rekey_enable" value="yes" <?php if (isset($pconfig['rekey_enable'])) echo "checked=\"checked\""; ?> />
904
							<?=gettext("Whether a connection should be renegotiated when it is about to expire."); ?><br />
905
						</td>
906
					</tr>
907
					<tr id='disablereauth'>
908
						<td width="22%" valign="top" class="vncell"><?=gettext("Disable Reauth");?></td>
909
						<td width="78%" class="vtable">
910
							<input name="reauth_enable" type="checkbox" id="reauth_enable" value="yes" <?php if (isset($pconfig['reauth_enable'])) echo "checked=\"checked\""; ?> />
911
							<?=gettext("Whether rekeying of an IKE_SA should also reauthenticate the peer. In IKEv1, reauthentication is always done."); ?><br />
912
						</td>
913
					</tr>
914
					<tr>
915
						<td width="22%" valign="top" class="vncell"><?=gettext("Responder Only");?></td>
916
						<td width="78%" class="vtable">
917
							<input name="responderonly" type="checkbox" id="responderonly" value="yes" <?php if (isset($pconfig['responderonly'])) echo "checked=\"checked\""; ?> />
918
							<?=gettext("Enable this option to never initiate this connection from this side, only respond to incoming requests."); ?><br />
919
						</td>
920
					</tr>
921
					<tr id='natt'>
922
						<td width="22%" valign="top" class="vncell"><?=gettext("NAT Traversal"); ?></td>
923
						<td width="78%" class="vtable">
924
							<select name="nat_traversal" class="formselect">
925
								<option value="on" <?php if ($pconfig['nat_traversal'] != 'on') echo "selected=\"selected\""; ?>><?=gettext("Auto"); ?></option>
926
								<option value="force" <?php if ($pconfig['nat_traversal'] == 'force') echo "selected=\"selected\""; ?>><?=gettext("Force"); ?></option>
927
							</select>
928
							<br />
929
							<span class="vexpl">
930
								<?=gettext("Set this option to enable the use of NAT-T (i.e. the encapsulation of ESP in UDP packets) if needed, " .
931
								"which can help with clients that are behind restrictive firewalls"); ?>.
932
							</span>
933
						</td>
934
                                        </tr>
935
                                        <tr id='mobike'>
936
                                                <td width="22%" valign="top" class="vncell"><?=gettext("MOBIKE"); ?></td>
937
                                                <td width="78%" class="vtable">
938
							<select name="mobike" class="formselect">
939
								<option value="on" <?php if ($pconfig['mobike'] == 'on') echo "selected=\"selected\""; ?>><?=gettext("Enable"); ?></option>
940
								<option value="off" <?php if ($pconfig['mobike'] != 'on') echo "selected=\"selected\""; ?>><?=gettext("Disable"); ?></option>
941
							</select>
942
							<br />
943
							<span class="vexpl">
944
								<?=gettext("Set this option to control the use of MOBIKE"); ?>.
945
							</span>
946
						</td>
947
					</tr>
948
					<tr>
949
						<td width="22%" valign="top" class="vncell"><?=gettext("Dead Peer Detection"); ?></td>
950
						<td width="78%" class="vtable">
951
							<input name="dpd_enable" type="checkbox" id="dpd_enable" value="yes" <?php if (isset($pconfig['dpd_enable'])) echo "checked=\"checked\""; ?> onclick="dpdchkbox_change()" />
952
							<?=gettext("Enable DPD"); ?><br />
953
							<div id="opt_dpd">
954
								<br />
955
								<input name="dpd_delay" type="text" class="formfld unknown" id="dpd_delay" size="5" value="<?=htmlspecialchars($pconfig['dpd_delay']);?>" />
956
								<?=gettext("seconds"); ?><br />
957
								<span class="vexpl">
958
									<?=gettext("Delay between requesting peer acknowledgement"); ?>.
959
								</span><br />
960
								<br />
961
								<input name="dpd_maxfail" type="text" class="formfld unknown" id="dpd_maxfail" size="5" value="<?=htmlspecialchars($pconfig['dpd_maxfail']);?>" />
962
								<?=gettext("retries"); ?><br />
963
								<span class="vexpl">
964
									<?=gettext("Number of consecutive failures allowed before disconnect"); ?>.
965
								</span>
966
								<br />
967
							</div>
968
						</td>
969
					</tr>
970
					<tr>
971
						<td width="22%" valign="top">&nbsp;</td>
972
						<td width="78%">
973
							<?php if (isset($p1index) && $a_phase1[$p1index]): ?>
974
							<input name="p1index" type="hidden" value="<?=htmlspecialchars($p1index);?>" />
975
							<?php endif; ?>
976
							<?php if ($pconfig['mobile']): ?>
977
							<input name="mobile" type="hidden" value="true" />
978
							<?php endif; ?>
979
							<input name="ikeid" type="hidden" value="<?=htmlspecialchars($pconfig['ikeid']);?>" />
980
							<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
981
						</td>
982
					</tr>
983
				</table>
984
			</div>
985
		</td>
986
	</tr>
987
</table>
988
</form>
989

    
990
<script type="text/javascript">
991
//<![CDATA[
992
<?php
993
	/* determine if we should init the key length */
994
	$keyset = '';
995
	if (isset($pconfig['ealgo']['keylen']))
996
		if (is_numeric($pconfig['ealgo']['keylen']))
997
			$keyset = $pconfig['ealgo']['keylen'];
998
?>
999
myidsel_change();
1000
peeridsel_change();
1001
iketype_change();
1002
methodsel_change();
1003
ealgosel_change(<?=$keyset;?>);
1004
dpdchkbox_change();
1005
//]]>
1006
</script>
1007
<?php include("fend.inc"); ?>
1008
</body>
1009
</html>
(241-241/256)