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
|
if (isset($id) && $a_ipsec[$id]) {
|
49
|
$pconfig['disabled'] = isset($a_ipsec[$id]['disabled']);
|
50
|
$pconfig['auto'] = isset($a_ipsec[$id]['auto']);
|
51
|
$pconfig['creategif'] = $a_filter[$id]['creategif'];
|
52
|
|
53
|
if (!isset($a_ipsec[$id]['local-subnet']))
|
54
|
$pconfig['localnet'] = "lan";
|
55
|
else
|
56
|
address_to_pconfig($a_ipsec[$id]['local-subnet'], $pconfig['localnet'], $pconfig['localnetmask'], $none, $none, $none);
|
57
|
|
58
|
if ($a_ipsec[$id]['interface'])
|
59
|
$pconfig['interface'] = $a_ipsec[$id]['interface'];
|
60
|
else
|
61
|
$pconfig['interface'] = "wan";
|
62
|
|
63
|
list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $a_ipsec[$id]['remote-subnet']);
|
64
|
$pconfig['remotegw'] = $a_ipsec[$id]['remote-gateway'];
|
65
|
$pconfig['p1mode'] = $a_ipsec[$id]['p1']['mode'];
|
66
|
|
67
|
if (isset($a_ipsec[$id]['p1']['myident']['myaddress']))
|
68
|
$pconfig['p1myidentt'] = 'myaddress';
|
69
|
else if (isset($a_ipsec[$id]['p1']['myident']['address'])) {
|
70
|
$pconfig['p1myidentt'] = 'address';
|
71
|
$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['address'];
|
72
|
} else if (isset($a_ipsec[$id]['p1']['myident']['fqdn'])) {
|
73
|
$pconfig['p1myidentt'] = 'fqdn';
|
74
|
$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['fqdn'];
|
75
|
} else if (isset($a_ipsec[$id]['p1']['myident']['ufqdn'])) {
|
76
|
$pconfig['p1myidentt'] = 'user_fqdn';
|
77
|
$pconfig['p1myident'] = $a_ipsec[$id]['p1']['myident']['ufqdn'];
|
78
|
}
|
79
|
|
80
|
$pconfig['p1ealgo'] = $a_ipsec[$id]['p1']['encryption-algorithm'];
|
81
|
$pconfig['p1halgo'] = $a_ipsec[$id]['p1']['hash-algorithm'];
|
82
|
$pconfig['p1dhgroup'] = $a_ipsec[$id]['p1']['dhgroup'];
|
83
|
$pconfig['p1lifetime'] = $a_ipsec[$id]['p1']['lifetime'];
|
84
|
$pconfig['p1pskey'] = $a_ipsec[$id]['p1']['pre-shared-key'];
|
85
|
$pconfig['p2proto'] = $a_ipsec[$id]['p2']['protocol'];
|
86
|
$pconfig['p2ealgos'] = $a_ipsec[$id]['p2']['encryption-algorithm-option'];
|
87
|
$pconfig['p2halgos'] = $a_ipsec[$id]['p2']['hash-algorithm-option'];
|
88
|
$pconfig['p2pfsgroup'] = $a_ipsec[$id]['p2']['pfsgroup'];
|
89
|
$pconfig['p2lifetime'] = $a_ipsec[$id]['p2']['lifetime'];
|
90
|
$pconfig['descr'] = $a_ipsec[$id]['descr'];
|
91
|
|
92
|
} else {
|
93
|
/* defaults */
|
94
|
$pconfig['interface'] = "wan";
|
95
|
$pconfig['localnet'] = "lan";
|
96
|
$pconfig['p1mode'] = "aggressive";
|
97
|
$pconfig['p1myidentt'] = "myaddress";
|
98
|
$pconfig['p1ealgo'] = "3des";
|
99
|
$pconfig['p1halgo'] = "sha1";
|
100
|
$pconfig['p1dhgroup'] = "2";
|
101
|
$pconfig['p2proto'] = "esp";
|
102
|
$pconfig['p2ealgos'] = explode(",", "3des,blowfish,cast128,rijndael");
|
103
|
$pconfig['p2halgos'] = explode(",", "hmac_sha1,hmac_md5");
|
104
|
$pconfig['p2pfsgroup'] = "0";
|
105
|
}
|
106
|
|
107
|
if ($_POST) {
|
108
|
if (is_specialnet($_POST['localnettype'])) {
|
109
|
$_POST['localnet'] = $_POST['localnettype'];
|
110
|
$_POST['localnetmask'] = 0;
|
111
|
} else if ($_POST['localnettype'] == "single") {
|
112
|
$_POST['localnetmask'] = 32;
|
113
|
}
|
114
|
|
115
|
unset($input_errors);
|
116
|
$pconfig = $_POST;
|
117
|
|
118
|
/* input validation */
|
119
|
$reqdfields = explode(" ", "localnet remotenet remotebits remotegw p1pskey p2ealgos p2halgos");
|
120
|
$reqdfieldsn = explode(",", "Local network,Remote network,Remote network bits,Remote gateway,Pre-Shared Key,P2 Encryption Algorithms,P2 Hash Algorithms");
|
121
|
|
122
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
123
|
|
124
|
if (!is_specialnet($_POST['localnettype'])) {
|
125
|
if (($_POST['localnet'] && !is_ipaddr($_POST['localnet']))) {
|
126
|
$input_errors[] = "A valid local network IP address must be specified.";
|
127
|
}
|
128
|
if (($_POST['localnetmask'] && !is_numeric($_POST['localnetmask']))) {
|
129
|
$input_errors[] = "A valid local network bit count must be specified.";
|
130
|
}
|
131
|
}
|
132
|
if (($_POST['p1lifetime'] && !is_numeric($_POST['p1lifetime']))) {
|
133
|
$input_errors[] = "The P1 lifetime must be an integer.";
|
134
|
}
|
135
|
if (($_POST['p2lifetime'] && !is_numeric($_POST['p2lifetime']))) {
|
136
|
$input_errors[] = "The P2 lifetime must be an integer.";
|
137
|
}
|
138
|
if ($_POST['remotebits'] && (!is_numeric($_POST['remotebits']) || ($_POST['remotebits'] <= 0) || ($_POST['remotebits'] > 32))) {
|
139
|
$input_errors[] = "The remote network bits are invalid.";
|
140
|
}
|
141
|
if (($_POST['remotenet'] && !is_ipaddr($_POST['remotenet']))) {
|
142
|
$input_errors[] = "A valid remote network address must be specified.";
|
143
|
}
|
144
|
if (($_POST['remotegw'] && !is_ipaddr($_POST['remotegw']))) {
|
145
|
$input_errors[] = "A valid remote gateway address must be specified.";
|
146
|
}
|
147
|
if ((($_POST['p1myidentt'] == "address") && !is_ipaddr($_POST['p1myident']))) {
|
148
|
$input_errors[] = "A valid IP address for 'My identifier' must be specified.";
|
149
|
}
|
150
|
if ((($_POST['p1myidentt'] == "fqdn") && !is_domain($_POST['p1myident']))) {
|
151
|
$input_errors[] = "A valid domain name for 'My identifier' must be specified.";
|
152
|
}
|
153
|
if ($_POST['p1myidentt'] == "user_fqdn") {
|
154
|
$ufqdn = explode("@",$_POST['p1myident']);
|
155
|
if (!is_domain($ufqdn[1]))
|
156
|
$input_errors[] = "A valid User FQDN in the form of user@my.domain.com for 'My identifier' must be specified.";
|
157
|
}
|
158
|
|
159
|
if ($_POST['p1myidentt'] == "myaddress")
|
160
|
$_POST['p1myident'] = "";
|
161
|
|
162
|
if (!$input_errors) {
|
163
|
$ipsecent['disabled'] = $_POST['disabled'] ? true : false;
|
164
|
$ipsecent['creategif'] = $_POST['creategif'] ? true : false;
|
165
|
$ipsecent['auto'] = $_POST['auto'] ? true : false;
|
166
|
$ipsecent['interface'] = $pconfig['interface'];
|
167
|
pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
|
168
|
$ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
|
169
|
$ipsecent['remote-gateway'] = $_POST['remotegw'];
|
170
|
$ipsecent['p1']['mode'] = $_POST['p1mode'];
|
171
|
|
172
|
$ipsecent['p1']['myident'] = array();
|
173
|
switch ($_POST['p1myidentt']) {
|
174
|
case 'myaddress':
|
175
|
$ipsecent['p1']['myident']['myaddress'] = true;
|
176
|
break;
|
177
|
case 'address':
|
178
|
$ipsecent['p1']['myident']['address'] = $_POST['p1myident'];
|
179
|
break;
|
180
|
case 'fqdn':
|
181
|
$ipsecent['p1']['myident']['fqdn'] = $_POST['p1myident'];
|
182
|
break;
|
183
|
case 'user_fqdn':
|
184
|
$ipsecent['p1']['myident']['ufqdn'] = $_POST['p1myident'];
|
185
|
break;
|
186
|
}
|
187
|
|
188
|
$ipsecent['p1']['encryption-algorithm'] = $_POST['p1ealgo'];
|
189
|
$ipsecent['p1']['hash-algorithm'] = $_POST['p1halgo'];
|
190
|
$ipsecent['p1']['dhgroup'] = $_POST['p1dhgroup'];
|
191
|
$ipsecent['p1']['lifetime'] = $_POST['p1lifetime'];
|
192
|
$ipsecent['p1']['pre-shared-key'] = $_POST['p1pskey'];
|
193
|
$ipsecent['p2']['protocol'] = $_POST['p2proto'];
|
194
|
$ipsecent['p2']['encryption-algorithm-option'] = $_POST['p2ealgos'];
|
195
|
$ipsecent['p2']['hash-algorithm-option'] = $_POST['p2halgos'];
|
196
|
$ipsecent['p2']['pfsgroup'] = $_POST['p2pfsgroup'];
|
197
|
$ipsecent['p2']['lifetime'] = $_POST['p2lifetime'];
|
198
|
$ipsecent['descr'] = $_POST['descr'];
|
199
|
|
200
|
if (isset($id) && $a_ipsec[$id])
|
201
|
$a_ipsec[$id] = $ipsecent;
|
202
|
else
|
203
|
$a_ipsec[] = $ipsecent;
|
204
|
|
205
|
write_config();
|
206
|
touch($d_ipsecconfdirty_path);
|
207
|
|
208
|
header("Location: vpn_ipsec.php");
|
209
|
exit;
|
210
|
}
|
211
|
}
|
212
|
?>
|
213
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
214
|
<html>
|
215
|
<head>
|
216
|
<title><?=gentitle("VPN: IPsec: Edit tunnel");?></title>
|
217
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
218
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
219
|
<script language="JavaScript">
|
220
|
<!--
|
221
|
function typesel_change() {
|
222
|
switch (document.iform.localnettype.selectedIndex) {
|
223
|
case 0: /* single */
|
224
|
document.iform.localnet.disabled = 0;
|
225
|
document.iform.localnetmask.value = "";
|
226
|
document.iform.localnetmask.disabled = 1;
|
227
|
break;
|
228
|
case 1: /* network */
|
229
|
document.iform.localnet.disabled = 0;
|
230
|
document.iform.localnetmask.disabled = 0;
|
231
|
break;
|
232
|
default:
|
233
|
document.iform.localnet.value = "";
|
234
|
document.iform.localnet.disabled = 1;
|
235
|
document.iform.localnetmask.value = "";
|
236
|
document.iform.localnetmask.disabled = 1;
|
237
|
break;
|
238
|
}
|
239
|
}
|
240
|
//-->
|
241
|
</script>
|
242
|
</head>
|
243
|
|
244
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
245
|
<?php include("fbegin.inc"); ?>
|
246
|
<p class="pgtitle">VPN: IPsec: Edit tunnel</p>
|
247
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
248
|
<form action="vpn_ipsec_edit.php" method="post" name="iform" id="iform">
|
249
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
250
|
<tr>
|
251
|
<td width="22%" valign="top" class="vncellreq">Mode</td>
|
252
|
<td width="78%" class="vtable"> Tunnel</td>
|
253
|
</tr>
|
254
|
<tr>
|
255
|
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
256
|
<td width="78%" class="vtable">
|
257
|
<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked"; ?>>
|
258
|
<strong>Disable this tunnel</strong><br>
|
259
|
<span class="vexpl">Set this option to disable this tunnel without
|
260
|
removing it from the list.</span></td>
|
261
|
</tr>
|
262
|
<tr>
|
263
|
<td width="22%" valign="top" class="vncellreq">Auto-establish</td>
|
264
|
<td width="78%" class="vtable">
|
265
|
<input name="auto" type="checkbox" id="auto" value="yes" <?php if ($pconfig['auto']) echo "checked"; ?>>
|
266
|
<strong>Automatically establish this tunnel</strong><br>
|
267
|
<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>
|
268
|
</tr>
|
269
|
<tr>
|
270
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
271
|
<td width="78%" class="vtable"> <select name="interface" class="formfld">
|
272
|
<?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
|
273
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
274
|
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
|
275
|
}
|
276
|
foreach ($interfaces as $iface => $ifacename): ?>
|
277
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
|
278
|
<?=htmlspecialchars($ifacename);?>
|
279
|
</option>
|
280
|
<?php endforeach; ?>
|
281
|
</select> <br>
|
282
|
<span class="vexpl">Select the interface for the local endpoint of this tunnel.</span></td>
|
283
|
</tr>
|
284
|
<tr>
|
285
|
<td width="22%" valign="top" class="vncellreq">Local subnet</td>
|
286
|
<td width="78%" class="vtable">
|
287
|
<table border="0" cellspacing="0" cellpadding="0">
|
288
|
<tr>
|
289
|
<td>Type: </td>
|
290
|
<td><select name="localnettype" class="formfld" onChange="typesel_change()">
|
291
|
<?php $sel = is_specialnet($pconfig['localnet']); ?>
|
292
|
<option value="single" <?php if (($pconfig['localnetmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>
|
293
|
Single host</option>
|
294
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>
|
295
|
Network</option>
|
296
|
<option value="lan" <?php if ($pconfig['localnet'] == "lan") { echo "selected"; } ?>>
|
297
|
LAN subnet</option>
|
298
|
</select></td>
|
299
|
</tr>
|
300
|
<tr>
|
301
|
<td>Address: </td>
|
302
|
<td><input name="localnet" type="text" class="formfld" id="localnet" size="20" value="<?php if (!is_specialnet($pconfig['localnet'])) echo htmlspecialchars($pconfig['localnet']);?>">
|
303
|
/
|
304
|
<select name="localnetmask" class="formfld" id="localnetmask">
|
305
|
<?php for ($i = 32; $i >= 0; $i--): ?>
|
306
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['localnetmask']) echo "selected"; ?>>
|
307
|
<?=$i;?>
|
308
|
</option>
|
309
|
<?php endfor; ?>
|
310
|
</select> </td>
|
311
|
</tr>
|
312
|
</table></td>
|
313
|
</tr>
|
314
|
<tr>
|
315
|
<td width="22%" valign="top" class="vncellreq">Remote subnet</td>
|
316
|
<td width="78%" class="vtable">
|
317
|
<input name="remotenet" type="text" class="formfld" id="remotenet" size="20" value="<?=$pconfig['remotenet'];?>">
|
318
|
/
|
319
|
<select name="remotebits" class="formfld" id="remotebits">
|
320
|
<?php for ($i = 32; $i > 0; $i--): ?>
|
321
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['remotebits']) echo "selected"; ?>>
|
322
|
<?=$i;?>
|
323
|
</option>
|
324
|
<?php endfor; ?>
|
325
|
</select></td>
|
326
|
</tr>
|
327
|
<tr>
|
328
|
<td width="22%" valign="top" class="vncellreq">Remote gateway</td>
|
329
|
<td width="78%" class="vtable">
|
330
|
<input name="remotegw" type="text" class="formfld" id="remotegw" size="20" value="<?=$pconfig['remotegw'];?>">
|
331
|
<br>
|
332
|
Enter the public IP address of the remote gateway</td>
|
333
|
</tr>
|
334
|
<tr>
|
335
|
<td width="22%" valign="top" class="vncell">Description</td>
|
336
|
<td width="78%" class="vtable">
|
337
|
<input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
338
|
<br> <span class="vexpl">You may enter a description here
|
339
|
for your reference (not parsed).</span></td>
|
340
|
</tr>
|
341
|
<tr>
|
342
|
<td colspan="2" class="list" height="12"></td>
|
343
|
</tr>
|
344
|
<tr>
|
345
|
<td colspan="2" valign="top" class="listtopic">Phase 1 proposal
|
346
|
(Authentication)</td>
|
347
|
</tr>
|
348
|
<tr>
|
349
|
<td width="22%" valign="top" class="vncellreq">Negotiation mode</td>
|
350
|
<td width="78%" class="vtable">
|
351
|
<select name="p1mode" class="formfld">
|
352
|
<?php $modes = explode(" ", "main aggressive"); foreach ($modes as $mode): ?>
|
353
|
<option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1mode']) echo "selected"; ?>>
|
354
|
<?=htmlspecialchars($mode);?>
|
355
|
</option>
|
356
|
<?php endforeach; ?>
|
357
|
</select> <br> <span class="vexpl">Aggressive is faster, but
|
358
|
less secure.</span></td>
|
359
|
</tr>
|
360
|
<tr>
|
361
|
<td width="22%" valign="top" class="vncellreq">My identifier</td>
|
362
|
<td width="78%" class="vtable">
|
363
|
<select name="p1myidentt" class="formfld">
|
364
|
<?php foreach ($my_identifier_list as $mode => $modename): ?>
|
365
|
<option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1myidentt']) echo "selected"; ?>>
|
366
|
<?=htmlspecialchars($modename);?>
|
367
|
</option>
|
368
|
<?php endforeach; ?>
|
369
|
</select> <input name="p1myident" type="text" class="formfld" id="p1myident" size="30" value="<?=$pconfig['p1myident'];?>">
|
370
|
</td>
|
371
|
</tr>
|
372
|
<tr>
|
373
|
<td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
|
374
|
<td width="78%" class="vtable">
|
375
|
<select name="p1ealgo" class="formfld">
|
376
|
<?php foreach ($p1_ealgos as $algo => $algoname): ?>
|
377
|
<option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1ealgo']) echo "selected"; ?>>
|
378
|
<?=htmlspecialchars($algoname);?>
|
379
|
</option>
|
380
|
<?php endforeach; ?>
|
381
|
</select> <br> <span class="vexpl">Must match the setting
|
382
|
chosen on the remote side. </span></td>
|
383
|
</tr>
|
384
|
<tr>
|
385
|
<td width="22%" valign="top" class="vncellreq">Hash algorithm</td>
|
386
|
<td width="78%" class="vtable">
|
387
|
<select name="p1halgo" class="formfld">
|
388
|
<?php foreach ($p1_halgos as $algo => $algoname): ?>
|
389
|
<option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1halgo']) echo "selected"; ?>>
|
390
|
<?=htmlspecialchars($algoname);?>
|
391
|
</option>
|
392
|
<?php endforeach; ?>
|
393
|
</select> <br> <span class="vexpl">Must match the setting
|
394
|
chosen on the remote side. </span></td>
|
395
|
</tr>
|
396
|
<tr>
|
397
|
<td width="22%" valign="top" class="vncellreq">DH key group</td>
|
398
|
<td width="78%" class="vtable">
|
399
|
<select name="p1dhgroup" class="formfld">
|
400
|
<?php $keygroups = explode(" ", "1 2 5"); foreach ($keygroups as $keygroup): ?>
|
401
|
<option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p1dhgroup']) echo "selected"; ?>>
|
402
|
<?=htmlspecialchars($keygroup);?>
|
403
|
</option>
|
404
|
<?php endforeach; ?>
|
405
|
</select> <br> <span class="vexpl"><em>1 = 768 bit, 2 = 1024
|
406
|
bit, 5 = 1536 bit</em><br>
|
407
|
Must match the setting chosen on the remote side. </span></td>
|
408
|
</tr>
|
409
|
<tr>
|
410
|
<td width="22%" valign="top" class="vncell">Lifetime</td>
|
411
|
<td width="78%" class="vtable">
|
412
|
<input name="p1lifetime" type="text" class="formfld" id="p1lifetime" size="20" value="<?=$pconfig['p1lifetime'];?>">
|
413
|
seconds</td>
|
414
|
</tr>
|
415
|
<tr>
|
416
|
<td width="22%" valign="top" class="vncellreq">Pre-Shared Key</td>
|
417
|
<td width="78%" class="vtable">
|
418
|
<input name="p1pskey" type="text" class="formfld" id="p1pskey" size="40" value="<?=htmlspecialchars($pconfig['p1pskey']);?>">
|
419
|
<br>ASCII characters only!
|
420
|
</td>
|
421
|
</tr>
|
422
|
<tr>
|
423
|
<td colspan="2" class="list" height="12"></td>
|
424
|
</tr>
|
425
|
<tr>
|
426
|
<td colspan="2" valign="top" class="listtopic">Phase 2 proposal
|
427
|
(SA/Key Exchange)</td>
|
428
|
</tr>
|
429
|
<tr>
|
430
|
<td width="22%" valign="top" class="vncellreq">Protocol</td>
|
431
|
<td width="78%" class="vtable">
|
432
|
<select name="p2proto" class="formfld">
|
433
|
<?php foreach ($p2_protos as $proto => $protoname): ?>
|
434
|
<option value="<?=$proto;?>" <?php if ($proto == $pconfig['p2proto']) echo "selected"; ?>>
|
435
|
<?=htmlspecialchars($protoname);?>
|
436
|
</option>
|
437
|
<?php endforeach; ?>
|
438
|
</select> <br> <span class="vexpl">ESP is encryption, AH is
|
439
|
authentication only </span></td>
|
440
|
</tr>
|
441
|
<tr>
|
442
|
<td width="22%" valign="top" class="vncellreq">Encryption algorithms</td>
|
443
|
<td width="78%" class="vtable">
|
444
|
<?php foreach ($p2_ealgos as $algo => $algoname): ?>
|
445
|
<input type="checkbox" name="p2ealgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2ealgos'])) echo "checked"; ?>>
|
446
|
<?=htmlspecialchars($algoname);?>
|
447
|
<br>
|
448
|
<?php endforeach; ?>
|
449
|
<br>
|
450
|
Hint: use 3DES for best compatibility or if you have a hardware
|
451
|
crypto accelerator card. Blowfish is usually the fastest in
|
452
|
software encryption. </td>
|
453
|
</tr>
|
454
|
<tr>
|
455
|
<td width="22%" valign="top" class="vncellreq">Hash algorithms</td>
|
456
|
<td width="78%" class="vtable">
|
457
|
<?php foreach ($p2_halgos as $algo => $algoname): ?>
|
458
|
<input type="checkbox" name="p2halgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2halgos'])) echo "checked"; ?>>
|
459
|
<?=htmlspecialchars($algoname);?>
|
460
|
<br>
|
461
|
<?php endforeach; ?>
|
462
|
</td>
|
463
|
</tr>
|
464
|
<tr>
|
465
|
<td width="22%" valign="top" class="vncellreq">PFS key group</td>
|
466
|
<td width="78%" class="vtable">
|
467
|
<select name="p2pfsgroup" class="formfld">
|
468
|
<?php foreach ($p2_pfskeygroups as $keygroup => $keygroupname): ?>
|
469
|
<option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p2pfsgroup']) echo "selected"; ?>>
|
470
|
<?=htmlspecialchars($keygroupname);?>
|
471
|
</option>
|
472
|
<?php endforeach; ?>
|
473
|
</select> <br> <span class="vexpl"><em>1 = 768 bit, 2 = 1024
|
474
|
bit, 5 = 1536 bit</em></span></td>
|
475
|
</tr>
|
476
|
<tr>
|
477
|
<td width="22%" valign="top" class="vncell">Lifetime</td>
|
478
|
<td width="78%" class="vtable">
|
479
|
<input name="p2lifetime" type="text" class="formfld" id="p2lifetime" size="20" value="<?=$pconfig['p2lifetime'];?>">
|
480
|
seconds</td>
|
481
|
</tr>
|
482
|
|
483
|
|
484
|
<tr>
|
485
|
<td colspan="2" class="list" height="12"></td>
|
486
|
</tr>
|
487
|
<tr>
|
488
|
<td colspan="2" valign="top" class="listtopic">Misc</td>
|
489
|
</tr>
|
490
|
<tr>
|
491
|
<td width="22%" valign="top" class="vncell">Multi-Tunnel routing</td>
|
492
|
<td width="78%" class="vtable">
|
493
|
<input name="creategif" type="checkbox" id="creategif" size="40" value="<? if($pconfig['creategif']) echo " CHECKED"; ?>"><b> Turn on multi-subnet routing.</b>
|
494
|
<br> <span class="vexpl">If you would like to route multiple subnets across this VPN, check this.</span></td>
|
495
|
</tr>
|
496
|
|
497
|
<tr>
|
498
|
<td width="22%" valign="top"> </td>
|
499
|
<td width="78%">
|
500
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
501
|
<?php if (isset($id) && $a_ipsec[$id]): ?>
|
502
|
<input name="id" type="hidden" value="<?=$id;?>">
|
503
|
<?php endif; ?>
|
504
|
</td>
|
505
|
</tr>
|
506
|
</table>
|
507
|
</form>
|
508
|
<script language="JavaScript">
|
509
|
<!--
|
510
|
typesel_change();
|
511
|
//-->
|
512
|
</script>
|
513
|
<?php include("fend.inc"); ?>
|
514
|
</body>
|
515
|
</html>
|