Project

General

Profile

Download (23.3 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	vpn_ipsec_edit.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6
	
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9
	
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
	
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
	
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
	
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31

    
32
require("guiconfig.inc");
33

    
34
if (!is_array($config['ipsec']['tunnel'])) {
35
	$config['ipsec']['tunnel'] = array();
36
}
37
$a_ipsec = &$config['ipsec']['tunnel'];
38

    
39
$specialsrcdst = explode(" ", "lan");
40

    
41
$id = $_GET['id'];
42
if (isset($_POST['id']))
43
	$id = $_POST['id'];
44
	
45
function is_specialnet($net) {
46
	global $specialsrcdst;
47
	
48
	if (in_array($net, $specialsrcdst))
49
		return true;
50
	else
51
		return false;
52
}
53

    
54
function address_to_pconfig($adr, &$padr, &$pmask) {
55
		
56
	if ($adr['network'])
57
		$padr = $adr['network'];
58
	else if ($adr['address']) {
59
		list($padr, $pmask) = explode("/", $adr['address']);
60
		if (is_null($pmask))
61
			$pmask = 32;
62
	}
63
}
64

    
65
function pconfig_to_address(&$adr, $padr, $pmask) {
66
	
67
	$adr = array();
68
	
69
	if (is_specialnet($padr))
70
		$adr['network'] = $padr;
71
	else {
72
		$adr['address'] = $padr;
73
		if ($pmask != 32)
74
			$adr['address'] .= "/" . $pmask;
75
	}
76
}
77

    
78
if (isset($id) && $a_ipsec[$id]) {
79
	$pconfig['disabled'] = isset($a_ipsec[$id]['disabled']);
80
	$pconfig['auto'] = isset($a_ipsec[$id]['auto']);
81

    
82
	if (!isset($a_ipsec[$id]['local-subnet']))
83
		$pconfig['localnet'] = "lan";
84
	else
85
		address_to_pconfig($a_ipsec[$id]['local-subnet'], $pconfig['localnet'], $pconfig['localnetmask']);
86
		
87
	if ($a_ipsec[$id]['interface'])
88
		$pconfig['interface'] = $a_ipsec[$id]['interface'];
89
	else
90
		$pconfig['interface'] = "wan";
91
		
92
	list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $a_ipsec[$id]['remote-subnet']);
93
	$pconfig['remotegw'] = $a_ipsec[$id]['remote-gateway'];
94
	$pconfig['p1mode'] = $a_ipsec[$id]['p1']['mode'];
95
	
96
	if (isset($a_ipsec[$id]['p1']['myident']['myaddress']))
97
		$pconfig['p1myidentt'] = 'myaddress';
98
	else if (isset($a_ipsec[$id]['p1']['myident']['address'])) {
99
		$pconfig['p1myidentt'] = 'address';
100
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['address'];
101
	} else if (isset($a_ipsec[$id]['p1']['myident']['fqdn'])) {
102
		$pconfig['p1myidentt'] = 'fqdn';
103
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['fqdn'];
104
	} else if (isset($a_ipsec[$id]['p1']['myident']['ufqdn'])) {
105
		$pconfig['p1myidentt'] = 'user_fqdn';
106
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['ufqdn'];
107
 	}
108
	
109
	$pconfig['p1ealgo'] = $a_ipsec[$id]['p1']['encryption-algorithm'];
110
	$pconfig['p1halgo'] = $a_ipsec[$id]['p1']['hash-algorithm'];
111
	$pconfig['p1dhgroup'] = $a_ipsec[$id]['p1']['dhgroup'];
112
	$pconfig['p1lifetime'] = $a_ipsec[$id]['p1']['lifetime'];
113
	$pconfig['p1pskey'] = $a_ipsec[$id]['p1']['pre-shared-key'];
114
	$pconfig['p2proto'] = $a_ipsec[$id]['p2']['protocol'];
115
	$pconfig['p2ealgos'] = $a_ipsec[$id]['p2']['encryption-algorithm-option'];
116
	$pconfig['p2halgos'] = $a_ipsec[$id]['p2']['hash-algorithm-option'];
117
	$pconfig['p2pfsgroup'] = $a_ipsec[$id]['p2']['pfsgroup'];
118
	$pconfig['p2lifetime'] = $a_ipsec[$id]['p2']['lifetime'];
119
	$pconfig['descr'] = $a_ipsec[$id]['descr'];
120
	
121
} else {
122
	/* defaults */
123
	$pconfig['interface'] = "wan";
124
	$pconfig['localnet'] = "lan";
125
	$pconfig['p1mode'] = "aggressive";
126
	$pconfig['p1myidentt'] = "myaddress";
127
	$pconfig['p1ealgo'] = "3des";
128
	$pconfig['p1halgo'] = "sha1";
129
	$pconfig['p1dhgroup'] = "2";
130
	$pconfig['p2proto'] = "esp";
131
	$pconfig['p2ealgos'] = explode(",", "3des,blowfish,cast128,rijndael");
132
	$pconfig['p2halgos'] = explode(",", "hmac_sha1,hmac_md5");
133
	$pconfig['p2pfsgroup'] = "0";
134
}
135

    
136
if ($_POST) {
137
	if (is_specialnet($_POST['localnettype'])) {
138
		$_POST['localnet'] = $_POST['localnettype'];
139
		$_POST['localnetmask'] = 0;
140
	} else if ($_POST['localnettype'] == "single") {
141
		$_POST['localnetmask'] = 32;
142
	}
143
	
144
	unset($input_errors);
145
	$pconfig = $_POST;
146

    
147
	/* input validation */
148
	$reqdfields = explode(" ", "localnet remotenet remotebits remotegw p1pskey p2ealgos p2halgos");
149
	$reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,Pre-Shared Key,P2 Encryption Algorithms,P2 Hash Algorithms");
150
	
151
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
152
	
153
	if (!is_specialnet($_POST['localnettype'])) {
154
		if (($_POST['localnet'] && !is_ipaddr($_POST['localnet']))) {
155
			$input_errors[] = "A valid local network IP address must be specified.";
156
		}
157
		if (($_POST['localnetmask'] && !is_numeric($_POST['localnetmask']))) {
158
			$input_errors[] = "A valid local network bit count must be specified.";
159
		}
160
	}
161
	if (($_POST['p1lifetime'] && !is_numeric($_POST['p1lifetime']))) {
162
		$input_errors[] = "The P1 lifetime must be an integer.";
163
	}
164
	if (($_POST['p2lifetime'] && !is_numeric($_POST['p2lifetime']))) {
165
		$input_errors[] = "The P2 lifetime must be an integer.";
166
	}
167
	if ($_POST['remotebits'] && (!is_numeric($_POST['remotebits']) || ($_POST['remotebits'] <= 0) || ($_POST['remotebits'] > 32))) {
168
		$input_errors[] = "The remote network bits are invalid.";
169
	}
170
	if (($_POST['remotenet'] && !is_ipaddr($_POST['remotenet']))) {
171
		$input_errors[] = "A valid remote network address must be specified.";
172
	}
173
	if (($_POST['remotegw'] && !is_ipaddr($_POST['remotegw']))) {
174
		$input_errors[] = "A valid remote gateway address must be specified.";
175
	}
176
	if ((($_POST['p1myidentt'] == "address") && !is_ipaddr($_POST['p1myident']))) {
177
		$input_errors[] = "A valid IP address for 'My identifier' must be specified.";
178
	}
179
	if ((($_POST['p1myidentt'] == "fqdn") && !is_domain($_POST['p1myident']))) {
180
		$input_errors[] = "A valid domain name for 'My identifier' must be specified.";
181
	}
182
	if ($_POST['p1myidentt'] == "user_fqdn") {
183
		$ufqdn = explode("@",$_POST['p1myident']);
184
		if (!is_domain($ufqdn[1])) 
185
			$input_errors[] = "A valid User FQDN in the form of user@my.domain.com for 'My identifier' must be specified.";
186
	}
187
	
188
	if ($_POST['p1myidentt'] == "myaddress")
189
		$_POST['p1myident'] = "";
190

    
191
	if (!$input_errors) {
192
		$ipsecent['disabled'] = $_POST['disabled'] ? true : false;
193
		$ipsecent['auto'] = $_POST['auto'] ? true : false;
194
		$ipsecent['interface'] = $pconfig['interface'];
195
		pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
196
		$ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
197
		$ipsecent['remote-gateway'] = $_POST['remotegw'];
198
		$ipsecent['p1']['mode'] = $_POST['p1mode'];
199
		
200
		$ipsecent['p1']['myident'] = array();
201
		switch ($_POST['p1myidentt']) {
202
			case 'myaddress':
203
				$ipsecent['p1']['myident']['myaddress'] = true;
204
				break;
205
			case 'address':
206
				$ipsecent['p1']['myident']['address'] = $_POST['p1myident'];
207
				break;
208
			case 'fqdn':
209
				$ipsecent['p1']['myident']['fqdn'] = $_POST['p1myident'];
210
				break;
211
			case 'user_fqdn':
212
				$ipsecent['p1']['myident']['ufqdn'] = $_POST['p1myident'];
213
				break;
214
		}
215
		
216
		$ipsecent['p1']['encryption-algorithm'] = $_POST['p1ealgo'];
217
		$ipsecent['p1']['hash-algorithm'] = $_POST['p1halgo'];
218
		$ipsecent['p1']['dhgroup'] = $_POST['p1dhgroup'];
219
		$ipsecent['p1']['lifetime'] = $_POST['p1lifetime'];
220
		$ipsecent['p1']['pre-shared-key'] = $_POST['p1pskey'];
221
		$ipsecent['p2']['protocol'] = $_POST['p2proto'];
222
		$ipsecent['p2']['encryption-algorithm-option'] = $_POST['p2ealgos'];
223
		$ipsecent['p2']['hash-algorithm-option'] = $_POST['p2halgos'];
224
		$ipsecent['p2']['pfsgroup'] = $_POST['p2pfsgroup'];
225
		$ipsecent['p2']['lifetime'] = $_POST['p2lifetime'];
226
		$ipsecent['descr'] = $_POST['descr'];
227
		
228
		if (isset($id) && $a_ipsec[$id])
229
			$a_ipsec[$id] = $ipsecent;
230
		else
231
			$a_ipsec[] = $ipsecent;
232
		
233
		write_config();
234
		touch($d_ipsecconfdirty_path);
235
		
236
		header("Location: vpn_ipsec.php");
237
		exit;
238
	}
239
}
240
?>
241
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
242
<html>
243
<head>
244
<title><?=gentitle("VPN: IPsec: Edit tunnel");?></title>
245
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
246
<link href="gui.css" rel="stylesheet" type="text/css">
247
<script language="JavaScript">
248
<!--
249
function typesel_change() {
250
	switch (document.iform.localnettype.selectedIndex) {
251
		case 0:	/* single */
252
			document.iform.localnet.disabled = 0;
253
			document.iform.localnetmask.value = "";
254
			document.iform.localnetmask.disabled = 1;
255
			break;
256
		case 1:	/* network */
257
			document.iform.localnet.disabled = 0;
258
			document.iform.localnetmask.disabled = 0;
259
			break;
260
		default:
261
			document.iform.localnet.value = "";
262
			document.iform.localnet.disabled = 1;
263
			document.iform.localnetmask.value = "";
264
			document.iform.localnetmask.disabled = 1;
265
			break;
266
	}
267
}
268
//-->
269
</script>
270
</head>
271

    
272
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
273
<?php include("fbegin.inc"); ?>
274
<p class="pgtitle">VPN: IPsec: Edit tunnel</p>
275
<?php if ($input_errors) print_input_errors($input_errors); ?>
276
            <form action="vpn_ipsec_edit.php" method="post" name="iform" id="iform">
277
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
278
                <tr> 
279
                  <td width="22%" valign="top" class="vncellreq">Mode</td>
280
                  <td width="78%" class="vtable"> Tunnel</td>
281
                </tr>
282
				<tr> 
283
                  <td width="22%" valign="top" class="vncellreq">Disabled</td>
284
                  <td width="78%" class="vtable"> 
285
                    <input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked"; ?>>
286
                    <strong>Disable this tunnel</strong><br>
287
                    <span class="vexpl">Set this option to disable this tunnel without
288
					removing it from the list.</span></td>
289
                </tr>
290
				<tr> 
291
				  <td width="22%" valign="top" class="vncellreq">Auto-establish</td>
292
				  <td width="78%" class="vtable"> 
293
					<input name="auto" type="checkbox" id="auto" value="yes" <?php if ($pconfig['auto']) echo "checked"; ?>>
294
					<strong>Automatically establish this tunnel</strong><br>
295
					<span class="vexpl">Set this option to automatically re-establish this tunnel after reboots/reconfigures. If this is not set, the tunnel is established on demand.</span></td>
296
				</tr>
297
				<tr> 
298
                  <td width="22%" valign="top" class="vncellreq">Interface</td>
299
                  <td width="78%" class="vtable"> <select name="interface" class="formfld">
300
                      <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
301
					  for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
302
					  	$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
303
					  }
304
					  foreach ($interfaces as $iface => $ifacename): ?>
305
                      <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>> 
306
                      <?=htmlspecialchars($ifacename);?>
307
                      </option>
308
                      <?php endforeach; ?>
309
                    </select> <br>
310
                    <span class="vexpl">Select the interface for the local endpoint of this tunnel.</span></td>
311
                </tr>
312
                <tr> 
313
                  <td width="22%" valign="top" class="vncellreq">Local subnet</td>
314
                  <td width="78%" class="vtable"> 
315
                    <table border="0" cellspacing="0" cellpadding="0">
316
                      <tr> 
317
                        <td>Type:&nbsp;&nbsp;</td>
318
                        <td><select name="localnettype" class="formfld" onChange="typesel_change()">
319
                            <?php $sel = is_specialnet($pconfig['localnet']); ?>
320
                            <option value="single" <?php if (($pconfig['localnetmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>> 
321
                            Single host</option>
322
                            <option value="network" <?php if (!$sel) echo "selected"; ?>> 
323
                            Network</option>
324
                            <option value="lan" <?php if ($pconfig['localnet'] == "lan") { echo "selected"; } ?>> 
325
                            LAN subnet</option>
326
                          </select></td>
327
                      </tr>
328
                      <tr> 
329
                        <td>Address:&nbsp;&nbsp;</td>
330
                        <td><input name="localnet" type="text" class="formfld" id="localnet" size="20" value="<?php if (!is_specialnet($pconfig['localnet'])) echo htmlspecialchars($pconfig['localnet']);?>">
331
                          / 
332
                          <select name="localnetmask" class="formfld" id="localnetmask">
333
                            <?php for ($i = 31; $i >= 0; $i--): ?>
334
                            <option value="<?=$i;?>" <?php if ($i == $pconfig['localnetmask']) echo "selected"; ?>>
335
                            <?=$i;?>
336
                            </option>
337
                            <?php endfor; ?>
338
                          </select> </td>
339
                      </tr>
340
                    </table></td>
341
                </tr>
342
                <tr> 
343
                  <td width="22%" valign="top" class="vncellreq">Remote subnet</td>
344
                  <td width="78%" class="vtable"> 
345
                    <input name="remotenet" type="text" class="formfld" id="remotenet" size="20" value="<?=$pconfig['remotenet'];?>">
346
                    / 
347
                    <select name="remotebits" class="formfld" id="remotebits">
348
                      <?php for ($i = 32; $i > 0; $i--): ?>
349
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['remotebits']) echo "selected"; ?>> 
350
                      <?=$i;?>
351
                      </option>
352
                      <?php endfor; ?>
353
                    </select></td>
354
                </tr>
355
                <tr> 
356
                  <td width="22%" valign="top" class="vncellreq">Remote gateway</td>
357
                  <td width="78%" class="vtable"> 
358
                    <input name="remotegw" type="text" class="formfld" id="remotegw" size="20" value="<?=$pconfig['remotegw'];?>"> 
359
                    <br>
360
                    Enter the public IP address of the remote gateway</td>
361
                </tr>
362
                <tr> 
363
                  <td width="22%" valign="top" class="vncell">Description</td>
364
                  <td width="78%" class="vtable"> 
365
                    <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> 
366
                    <br> <span class="vexpl">You may enter a description here 
367
                    for your reference (not parsed).</span></td>
368
                </tr>
369
                <tr> 
370
                  <td colspan="2" class="list" height="12"></td>
371
                </tr>
372
                <tr> 
373
                  <td colspan="2" valign="top" class="listtopic">Phase 1 proposal 
374
                    (Authentication)</td>
375
                </tr>
376
                <tr> 
377
                  <td width="22%" valign="top" class="vncellreq">Negotiation mode</td>
378
                  <td width="78%" class="vtable">
379
<select name="p1mode" class="formfld">
380
                      <?php $modes = explode(" ", "main aggressive"); foreach ($modes as $mode): ?>
381
                      <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1mode']) echo "selected"; ?>> 
382
                      <?=htmlspecialchars($mode);?>
383
                      </option>
384
                      <?php endforeach; ?>
385
                    </select> <br> <span class="vexpl">Aggressive is faster, but 
386
                    less secure.</span></td>
387
                </tr>
388
                <tr> 
389
                  <td width="22%" valign="top" class="vncellreq">My identifier</td>
390
                  <td width="78%" class="vtable">
391
<select name="p1myidentt" class="formfld">
392
                      <?php foreach ($my_identifier_list as $mode => $modename): ?>
393
                      <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1myidentt']) echo "selected"; ?>> 
394
                      <?=htmlspecialchars($modename);?>
395
                      </option>
396
                      <?php endforeach; ?>
397
                    </select> <input name="p1myident" type="text" class="formfld" id="p1myident" size="30" value="<?=$pconfig['p1myident'];?>"> 
398
                  </td>
399
                </tr>
400
                <tr> 
401
                  <td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
402
                  <td width="78%" class="vtable">
403
<select name="p1ealgo" class="formfld">
404
                      <?php foreach ($p1_ealgos as $algo => $algoname): ?>
405
                      <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1ealgo']) echo "selected"; ?>> 
406
                      <?=htmlspecialchars($algoname);?>
407
                      </option>
408
                      <?php endforeach; ?>
409
                    </select> <br> <span class="vexpl">Must match the setting 
410
                    chosen on the remote side. </span></td>
411
                </tr>
412
                <tr> 
413
                  <td width="22%" valign="top" class="vncellreq">Hash algorithm</td>
414
                  <td width="78%" class="vtable">
415
<select name="p1halgo" class="formfld">
416
                      <?php foreach ($p1_halgos as $algo => $algoname): ?>
417
                      <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1halgo']) echo "selected"; ?>> 
418
                      <?=htmlspecialchars($algoname);?>
419
                      </option>
420
                      <?php endforeach; ?>
421
                    </select> <br> <span class="vexpl">Must match the setting 
422
                    chosen on the remote side. </span></td>
423
                </tr>
424
                <tr> 
425
                  <td width="22%" valign="top" class="vncellreq">DH key group</td>
426
                  <td width="78%" class="vtable">
427
<select name="p1dhgroup" class="formfld">
428
                      <?php $keygroups = explode(" ", "1 2 5"); foreach ($keygroups as $keygroup): ?>
429
                      <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p1dhgroup']) echo "selected"; ?>> 
430
                      <?=htmlspecialchars($keygroup);?>
431
                      </option>
432
                      <?php endforeach; ?>
433
                    </select> <br> <span class="vexpl"><em>1 = 768 bit, 2 = 1024 
434
                    bit, 5 = 1536 bit</em><br>
435
                    Must match the setting chosen on the remote side. </span></td>
436
                </tr>
437
                <tr> 
438
                  <td width="22%" valign="top" class="vncell">Lifetime</td>
439
                  <td width="78%" class="vtable"> 
440
                    <input name="p1lifetime" type="text" class="formfld" id="p1lifetime" size="20" value="<?=$pconfig['p1lifetime'];?>">
441
                    seconds</td>
442
                </tr>
443
                <tr> 
444
                  <td width="22%" valign="top" class="vncellreq">Pre-Shared Key</td>
445
                  <td width="78%" class="vtable"> 
446
                    <input name="p1pskey" type="text" class="formfld" id="p1pskey" size="40" value="<?=htmlspecialchars($pconfig['p1pskey']);?>"> 
447
                  </td>
448
                </tr>
449
                <tr> 
450
                  <td colspan="2" class="list" height="12"></td>
451
                </tr>
452
                <tr> 
453
                  <td colspan="2" valign="top" class="listtopic">Phase 2 proposal 
454
                    (SA/Key Exchange)</td>
455
                </tr>
456
                <tr> 
457
                  <td width="22%" valign="top" class="vncellreq">Protocol</td>
458
                  <td width="78%" class="vtable">
459
<select name="p2proto" class="formfld">
460
                      <?php foreach ($p2_protos as $proto => $protoname): ?>
461
                      <option value="<?=$proto;?>" <?php if ($proto == $pconfig['p2proto']) echo "selected"; ?>> 
462
                      <?=htmlspecialchars($protoname);?>
463
                      </option>
464
                      <?php endforeach; ?>
465
                    </select> <br> <span class="vexpl">ESP is encryption, AH is 
466
                    authentication only </span></td>
467
                </tr>
468
                <tr> 
469
                  <td width="22%" valign="top" class="vncellreq">Encryption algorithms</td>
470
                  <td width="78%" class="vtable"> 
471
                    <?php foreach ($p2_ealgos as $algo => $algoname): ?>
472
                    <input type="checkbox" name="p2ealgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2ealgos'])) echo "checked"; ?>> 
473
                    <?=htmlspecialchars($algoname);?>
474
                    <br> 
475
                    <?php endforeach; ?>
476
                    <br>
477
                    Hint: use 3DES for best compatibility or if you have a hardware 
478
                    crypto accelerator card. Blowfish is usually the fastest in 
479
                    software encryption. </td>
480
                </tr>
481
                <tr> 
482
                  <td width="22%" valign="top" class="vncellreq">Hash algorithms</td>
483
                  <td width="78%" class="vtable"> 
484
                    <?php foreach ($p2_halgos as $algo => $algoname): ?>
485
                    <input type="checkbox" name="p2halgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2halgos'])) echo "checked"; ?>> 
486
                    <?=htmlspecialchars($algoname);?>
487
                    <br> 
488
                    <?php endforeach; ?>
489
				  </td>
490
                </tr>
491
                <tr> 
492
                  <td width="22%" valign="top" class="vncellreq">PFS key group</td>
493
                  <td width="78%" class="vtable">
494
<select name="p2pfsgroup" class="formfld">
495
                      <?php foreach ($p2_pfskeygroups as $keygroup => $keygroupname): ?>
496
                      <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p2pfsgroup']) echo "selected"; ?>> 
497
                      <?=htmlspecialchars($keygroupname);?>
498
                      </option>
499
                      <?php endforeach; ?>
500
                    </select> <br> <span class="vexpl"><em>1 = 768 bit, 2 = 1024 
501
                    bit, 5 = 1536 bit</em></span></td>
502
                </tr>
503
                <tr> 
504
                  <td width="22%" valign="top" class="vncell">Lifetime</td>
505
                  <td width="78%" class="vtable"> 
506
                    <input name="p2lifetime" type="text" class="formfld" id="p2lifetime" size="20" value="<?=$pconfig['p2lifetime'];?>">
507
                    seconds</td>
508
                </tr>
509
                <tr> 
510
                  <td width="22%" valign="top">&nbsp;</td>
511
                  <td width="78%"> 
512
                    <input name="Submit" type="submit" class="formbtn" value="Save"> 
513
                    <?php if (isset($id) && $a_ipsec[$id]): ?>
514
                    <input name="id" type="hidden" value="<?=$id;?>"> 
515
                    <?php endif; ?>
516
                  </td>
517
                </tr>
518
              </table>
519
</form>
520
<script language="JavaScript">
521
<!--
522
typesel_change();
523
//-->
524
</script>
525
<?php include("fend.inc"); ?>
526
</body>
527
</html>
(77-77/86)