Project

General

Profile

Download (24 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/* $Id$ */
4
/*
5
	vpn_ipsec_edit.php
6
	Copyright (C) 2004 Scott Ullrich
7
	All rights reserved.
8

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

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

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

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

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

    
35
require("guiconfig.inc");
36

    
37
if (!is_array($config['ipsec']['tunnel'])) {
38
	$config['ipsec']['tunnel'] = array();
39
}
40
$a_ipsec = &$config['ipsec']['tunnel'];
41

    
42
$specialsrcdst = explode(" ", "lan");
43

    
44
$id = $_GET['id'];
45
if (isset($_POST['id']))
46
	$id = $_POST['id'];
47

    
48
function is_specialnet($net) {
49
	global $specialsrcdst;
50

    
51
	if (in_array($net, $specialsrcdst))
52
		return true;
53
	else
54
		return false;
55
}
56

    
57
function address_to_pconfig($adr, &$padr, &$pmask) {
58

    
59
	if ($adr['network'])
60
		$padr = $adr['network'];
61
	else if ($adr['address']) {
62
		list($padr, $pmask) = explode("/", $adr['address']);
63
		if (is_null($pmask))
64
			$pmask = 32;
65
	}
66
}
67

    
68
function pconfig_to_address(&$adr, $padr, $pmask) {
69

    
70
	$adr = array();
71

    
72
	if (is_specialnet($padr))
73
		$adr['network'] = $padr;
74
	else {
75
		$adr['address'] = $padr;
76
		if ($pmask != 32)
77
			$adr['address'] .= "/" . $pmask;
78
	}
79
}
80

    
81
if (isset($id) && $a_ipsec[$id]) {
82
	$pconfig['disabled'] = isset($a_ipsec[$id]['disabled']);
83
	$pconfig['auto'] = isset($a_ipsec[$id]['auto']);
84
	$pconfig['creategif'] = $a_filter[$id]['creategif'];
85

    
86
	if (!isset($a_ipsec[$id]['local-subnet']))
87
		$pconfig['localnet'] = "lan";
88
	else
89
		address_to_pconfig($a_ipsec[$id]['local-subnet'], $pconfig['localnet'], $pconfig['localnetmask']);
90

    
91
	if ($a_ipsec[$id]['interface'])
92
		$pconfig['interface'] = $a_ipsec[$id]['interface'];
93
	else
94
		$pconfig['interface'] = "wan";
95

    
96
	list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $a_ipsec[$id]['remote-subnet']);
97
	$pconfig['remotegw'] = $a_ipsec[$id]['remote-gateway'];
98
	$pconfig['p1mode'] = $a_ipsec[$id]['p1']['mode'];
99

    
100
	if (isset($a_ipsec[$id]['p1']['myident']['myaddress']))
101
		$pconfig['p1myidentt'] = 'myaddress';
102
	else if (isset($a_ipsec[$id]['p1']['myident']['address'])) {
103
		$pconfig['p1myidentt'] = 'address';
104
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['address'];
105
	} else if (isset($a_ipsec[$id]['p1']['myident']['fqdn'])) {
106
		$pconfig['p1myidentt'] = 'fqdn';
107
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['fqdn'];
108
	} else if (isset($a_ipsec[$id]['p1']['myident']['ufqdn'])) {
109
		$pconfig['p1myidentt'] = 'user_fqdn';
110
		$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['ufqdn'];
111
 	}
112

    
113
	$pconfig['p1ealgo'] = $a_ipsec[$id]['p1']['encryption-algorithm'];
114
	$pconfig['p1halgo'] = $a_ipsec[$id]['p1']['hash-algorithm'];
115
	$pconfig['p1dhgroup'] = $a_ipsec[$id]['p1']['dhgroup'];
116
	$pconfig['p1lifetime'] = $a_ipsec[$id]['p1']['lifetime'];
117
	$pconfig['p1pskey'] = $a_ipsec[$id]['p1']['pre-shared-key'];
118
	$pconfig['p2proto'] = $a_ipsec[$id]['p2']['protocol'];
119
	$pconfig['p2ealgos'] = $a_ipsec[$id]['p2']['encryption-algorithm-option'];
120
	$pconfig['p2halgos'] = $a_ipsec[$id]['p2']['hash-algorithm-option'];
121
	$pconfig['p2pfsgroup'] = $a_ipsec[$id]['p2']['pfsgroup'];
122
	$pconfig['p2lifetime'] = $a_ipsec[$id]['p2']['lifetime'];
123
	$pconfig['descr'] = $a_ipsec[$id]['descr'];
124

    
125
} else {
126
	/* defaults */
127
	$pconfig['interface'] = "wan";
128
	$pconfig['localnet'] = "lan";
129
	$pconfig['p1mode'] = "aggressive";
130
	$pconfig['p1myidentt'] = "myaddress";
131
	$pconfig['p1ealgo'] = "3des";
132
	$pconfig['p1halgo'] = "sha1";
133
	$pconfig['p1dhgroup'] = "2";
134
	$pconfig['p2proto'] = "esp";
135
	$pconfig['p2ealgos'] = explode(",", "3des,blowfish,cast128,rijndael");
136
	$pconfig['p2halgos'] = explode(",", "hmac_sha1,hmac_md5");
137
	$pconfig['p2pfsgroup'] = "0";
138
}
139

    
140
if ($_POST) {
141
	if (is_specialnet($_POST['localnettype'])) {
142
		$_POST['localnet'] = $_POST['localnettype'];
143
		$_POST['localnetmask'] = 0;
144
	} else if ($_POST['localnettype'] == "single") {
145
		$_POST['localnetmask'] = 32;
146
	}
147

    
148
	unset($input_errors);
149
	$pconfig = $_POST;
150

    
151
	/* input validation */
152
	$reqdfields = explode(" ", "localnet remotenet remotebits remotegw p1pskey p2ealgos p2halgos");
153
	$reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,Pre-Shared Key,P2 Encryption Algorithms,P2 Hash Algorithms");
154

    
155
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
156

    
157
	if (!is_specialnet($_POST['localnettype'])) {
158
		if (($_POST['localnet'] && !is_ipaddr($_POST['localnet']))) {
159
			$input_errors[] = "A valid local network IP address must be specified.";
160
		}
161
		if (($_POST['localnetmask'] && !is_numeric($_POST['localnetmask']))) {
162
			$input_errors[] = "A valid local network bit count must be specified.";
163
		}
164
	}
165
	if (($_POST['p1lifetime'] && !is_numeric($_POST['p1lifetime']))) {
166
		$input_errors[] = "The P1 lifetime must be an integer.";
167
	}
168
	if (($_POST['p2lifetime'] && !is_numeric($_POST['p2lifetime']))) {
169
		$input_errors[] = "The P2 lifetime must be an integer.";
170
	}
171
	if ($_POST['remotebits'] && (!is_numeric($_POST['remotebits']) || ($_POST['remotebits'] <= 0) || ($_POST['remotebits'] > 32))) {
172
		$input_errors[] = "The remote network bits are invalid.";
173
	}
174
	if (($_POST['remotenet'] && !is_ipaddr($_POST['remotenet']))) {
175
		$input_errors[] = "A valid remote network address must be specified.";
176
	}
177
	if (($_POST['remotegw'] && !is_ipaddr($_POST['remotegw']))) {
178
		$input_errors[] = "A valid remote gateway address must be specified.";
179
	}
180
	if ((($_POST['p1myidentt'] == "address") && !is_ipaddr($_POST['p1myident']))) {
181
		$input_errors[] = "A valid IP address for 'My identifier' must be specified.";
182
	}
183
	if ((($_POST['p1myidentt'] == "fqdn") && !is_domain($_POST['p1myident']))) {
184
		$input_errors[] = "A valid domain name for 'My identifier' must be specified.";
185
	}
186
	if ($_POST['p1myidentt'] == "user_fqdn") {
187
		$ufqdn = explode("@",$_POST['p1myident']);
188
		if (!is_domain($ufqdn[1]))
189
			$input_errors[] = "A valid User FQDN in the form of user@my.domain.com for 'My identifier' must be specified.";
190
	}
191

    
192
	if ($_POST['p1myidentt'] == "myaddress")
193
		$_POST['p1myident'] = "";
194

    
195
	if (!$input_errors) {
196
		$ipsecent['disabled'] = $_POST['disabled'] ? true : false;
197
		$ipsecent['auto'] = $_POST['auto'] ? true : false;
198
		$ipsecent['interface'] = $pconfig['interface'];
199
		pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
200
		$ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
201
		$ipsecent['remote-gateway'] = $_POST['remotegw'];
202
		$ipsecent['p1']['mode'] = $_POST['p1mode'];
203

    
204
		$ipsecent['p1']['myident'] = array();
205
		switch ($_POST['p1myidentt']) {
206
			case 'myaddress':
207
				$ipsecent['p1']['myident']['myaddress'] = true;
208
				break;
209
			case 'address':
210
				$ipsecent['p1']['myident']['address'] = $_POST['p1myident'];
211
				break;
212
			case 'fqdn':
213
				$ipsecent['p1']['myident']['fqdn'] = $_POST['p1myident'];
214
				break;
215
			case 'user_fqdn':
216
				$ipsecent['p1']['myident']['ufqdn'] = $_POST['p1myident'];
217
				break;
218
		}
219

    
220
		$ipsecent['p1']['encryption-algorithm'] = $_POST['p1ealgo'];
221
		$ipsecent['p1']['hash-algorithm'] = $_POST['p1halgo'];
222
		$ipsecent['p1']['dhgroup'] = $_POST['p1dhgroup'];
223
		$ipsecent['p1']['lifetime'] = $_POST['p1lifetime'];
224
		$ipsecent['p1']['pre-shared-key'] = $_POST['p1pskey'];
225
		$ipsecent['p2']['protocol'] = $_POST['p2proto'];
226
		$ipsecent['p2']['encryption-algorithm-option'] = $_POST['p2ealgos'];
227
		$ipsecent['p2']['hash-algorithm-option'] = $_POST['p2halgos'];
228
		$ipsecent['p2']['pfsgroup'] = $_POST['p2pfsgroup'];
229
		$ipsecent['p2']['lifetime'] = $_POST['p2lifetime'];
230
		$ipsecent['descr'] = $_POST['descr'];
231

    
232
		if (isset($id) && $a_ipsec[$id])
233
			$a_ipsec[$id] = $ipsecent;
234
		else
235
			$a_ipsec[] = $ipsecent;
236

    
237
		write_config();
238
		touch($d_ipsecconfdirty_path);
239

    
240
		header("Location: vpn_ipsec.php");
241
		exit;
242
	}
243
}
244
?>
245
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
246
<html>
247
<head>
248
<title><?=gentitle("VPN: IPsec: Edit tunnel");?></title>
249
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
250
<link href="gui.css" rel="stylesheet" type="text/css">
251
<script language="JavaScript">
252
<!--
253
function typesel_change() {
254
	switch (document.iform.localnettype.selectedIndex) {
255
		case 0:	/* single */
256
			document.iform.localnet.disabled = 0;
257
			document.iform.localnetmask.value = "";
258
			document.iform.localnetmask.disabled = 1;
259
			break;
260
		case 1:	/* network */
261
			document.iform.localnet.disabled = 0;
262
			document.iform.localnetmask.disabled = 0;
263
			break;
264
		default:
265
			document.iform.localnet.value = "";
266
			document.iform.localnet.disabled = 1;
267
			document.iform.localnetmask.value = "";
268
			document.iform.localnetmask.disabled = 1;
269
			break;
270
	}
271
}
272
//-->
273
</script>
274
</head>
275

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

    
515

    
516
                <tr>
517
                  <td colspan="2" class="list" height="12"></td>
518
                </tr>
519
		<tr>
520
                  <td colspan="2" valign="top" class="listtopic">Misc</td>
521
                </tr>
522
                <tr>
523
                  <td width="22%" valign="top" class="vncell">Multi-Tunnel routing</td>
524
                  <td width="78%" class="vtable">
525
                    <input name="creategif" type="checkbox" id="creategif" size="40" value="<? if($pconfig['creategif']) echo " CHECKED"; ?>"><b> Turn on multi-subnet routing.</b>
526
                    <br> <span class="vexpl">If you would like to route multiple subnets across this VPN, check this.</span></td>
527
                </tr>
528

    
529
                <tr>
530
                  <td width="22%" valign="top">&nbsp;</td>
531
                  <td width="78%">
532
                    <input name="Submit" type="submit" class="formbtn" value="Save">
533
                    <?php if (isset($id) && $a_ipsec[$id]): ?>
534
                    <input name="id" type="hidden" value="<?=$id;?>">
535
                    <?php endif; ?>
536
                  </td>
537
                </tr>
538
              </table>
539
</form>
540
<script language="JavaScript">
541
<!--
542
typesel_change();
543
//-->
544
</script>
545
<?php include("fend.inc"); ?>
546
</body>
547
</html>
(97-97/109)