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 "eap-radius":
|
179
|
if ($pconfig['iketype'] != 'ikev2')
|
180
|
$input_errors[] = gettext("EAP-RADIUS can only be used with IKEv2 type VPNs.");
|
181
|
break;
|
182
|
case "pre_shared_key":
|
183
|
// If this is a mobile PSK tunnel the user PSKs go on
|
184
|
// the PSK tab, not here, so skip the check.
|
185
|
if ($pconfig['mobile'])
|
186
|
break;
|
187
|
case "xauth_psk_server":
|
188
|
$reqdfields = explode(" ", "pskey");
|
189
|
$reqdfieldsn = array(gettext("Pre-Shared Key"));
|
190
|
$validate_pskey = true;
|
191
|
break;
|
192
|
case "hybrid_rsa_server":
|
193
|
case "xauth_rsa_server":
|
194
|
case "rsasig":
|
195
|
$reqdfields = explode(" ", "caref certref");
|
196
|
$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
|
197
|
break;
|
198
|
}
|
199
|
if (!$pconfig['mobile']) {
|
200
|
$reqdfields[] = "remotegw";
|
201
|
$reqdfieldsn[] = gettext("Remote gateway");
|
202
|
}
|
203
|
|
204
|
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
|
205
|
|
206
|
if (isset($validate_pskey) && isset($pconfig['pskey']) && !preg_match('/^[[:ascii:]]*$/', $pconfig['pskey'])) {
|
207
|
unset($validate_pskey);
|
208
|
$input_errors[] = gettext("Pre-Shared Key contains invalid characters.");
|
209
|
}
|
210
|
|
211
|
if (($pconfig['lifetime'] && !is_numeric($pconfig['lifetime'])))
|
212
|
$input_errors[] = gettext("The P1 lifetime must be an integer.");
|
213
|
|
214
|
if ($pconfig['remotegw']) {
|
215
|
if (!is_ipaddr($pconfig['remotegw']) && !is_domain($pconfig['remotegw']))
|
216
|
$input_errors[] = gettext("A valid remote gateway address or host name must be specified.");
|
217
|
elseif (is_ipaddrv4($pconfig['remotegw']) && ($pconfig['protocol'] != "inet"))
|
218
|
$input_errors[] = gettext("A valid remote gateway IPv4 address must be specified or you need to change protocol to IPv6");
|
219
|
elseif (is_ipaddrv6($pconfig['remotegw']) && ($pconfig['protocol'] != "inet6"))
|
220
|
$input_errors[] = gettext("A valid remote gateway IPv6 address must be specified or you need to change protocol to IPv4");
|
221
|
}
|
222
|
|
223
|
if (($pconfig['remotegw'] && is_ipaddr($pconfig['remotegw']) && !isset($pconfig['disabled']) )) {
|
224
|
$t = 0;
|
225
|
foreach ($a_phase1 as $ph1tmp) {
|
226
|
if ($p1index <> $t) {
|
227
|
$tremotegw = $pconfig['remotegw'];
|
228
|
if (($ph1tmp['remote-gateway'] == $tremotegw) && !isset($ph1tmp['disabled'])) {
|
229
|
$input_errors[] = sprintf(gettext('The remote gateway "%1$s" is already used by phase1 "%2$s".'), $tremotegw, $ph1tmp['descr']);
|
230
|
}
|
231
|
}
|
232
|
$t++;
|
233
|
}
|
234
|
}
|
235
|
|
236
|
if (is_array($a_phase2) && (count($a_phase2))) {
|
237
|
foreach ($a_phase2 as $phase2) {
|
238
|
if($phase2['ikeid'] == $pconfig['ikeid']) {
|
239
|
if (($pconfig['protocol'] == "inet") && ($phase2['mode'] == "tunnel6")) {
|
240
|
$input_errors[] = gettext("There is a Phase 2 using IPv6, you cannot use IPv4.");
|
241
|
break;
|
242
|
}
|
243
|
if (($pconfig['protocol'] == "inet6") && ($phase2['mode'] == "tunnel")) {
|
244
|
$input_errors[] = gettext("There is a Phase 2 using IPv4, you cannot use IPv6.");
|
245
|
break;
|
246
|
}
|
247
|
}
|
248
|
}
|
249
|
}
|
250
|
|
251
|
/* My identity */
|
252
|
|
253
|
if ($pconfig['myid_type'] == "myaddress")
|
254
|
$pconfig['myid_data'] = "";
|
255
|
|
256
|
if ($pconfig['myid_type'] == "address" and $pconfig['myid_data'] == "")
|
257
|
$input_errors[] = gettext("Please enter an address for 'My Identifier'");
|
258
|
|
259
|
if ($pconfig['myid_type'] == "keyid tag" and $pconfig['myid_data'] == "")
|
260
|
$input_errors[] = gettext("Please enter a keyid tag for 'My Identifier'");
|
261
|
|
262
|
if ($pconfig['myid_type'] == "fqdn" and $pconfig['myid_data'] == "")
|
263
|
$input_errors[] = gettext("Please enter a fully qualified domain name for 'My Identifier'");
|
264
|
|
265
|
if ($pconfig['myid_type'] == "user_fqdn" and $pconfig['myid_data'] == "")
|
266
|
$input_errors[] = gettext("Please enter a user and fully qualified domain name for 'My Identifier'");
|
267
|
|
268
|
if ($pconfig['myid_type'] == "dyn_dns" and $pconfig['myid_data'] == "")
|
269
|
$input_errors[] = gettext("Please enter a dynamic domain name for 'My Identifier'");
|
270
|
|
271
|
if ((($pconfig['myid_type'] == "address") && !is_ipaddr($pconfig['myid_data'])))
|
272
|
$input_errors[] = gettext("A valid IP address for 'My identifier' must be specified.");
|
273
|
|
274
|
if ((($pconfig['myid_type'] == "fqdn") && !is_domain($pconfig['myid_data'])))
|
275
|
$input_errors[] = gettext("A valid domain name for 'My identifier' must be specified.");
|
276
|
|
277
|
if ($pconfig['myid_type'] == "fqdn")
|
278
|
if (is_domain($pconfig['myid_data']) == false)
|
279
|
$input_errors[] = gettext("A valid FQDN for 'My identifier' must be specified.");
|
280
|
|
281
|
if ($pconfig['myid_type'] == "user_fqdn") {
|
282
|
$user_fqdn = explode("@",$pconfig['myid_data']);
|
283
|
if (is_domain($user_fqdn[1]) == false)
|
284
|
$input_errors[] = gettext("A valid User FQDN in the form of user@my.domain.com for 'My identifier' must be specified.");
|
285
|
}
|
286
|
|
287
|
if ($pconfig['myid_type'] == "dyn_dns")
|
288
|
if (is_domain($pconfig['myid_data']) == false)
|
289
|
$input_errors[] = gettext("A valid Dynamic DNS address for 'My identifier' must be specified.");
|
290
|
|
291
|
/* Peer identity */
|
292
|
|
293
|
if ($pconfig['myid_type'] == "peeraddress")
|
294
|
$pconfig['peerid_data'] = "";
|
295
|
|
296
|
// Only enforce peer ID if we are not dealing with a pure-psk mobile config.
|
297
|
if (!(($pconfig['authentication_method'] == "pre_shared_key") && ($pconfig['mobile']))) {
|
298
|
if ($pconfig['peerid_type'] == "address" and $pconfig['peerid_data'] == "")
|
299
|
$input_errors[] = gettext("Please enter an address for 'Peer Identifier'");
|
300
|
|
301
|
if ($pconfig['peerid_type'] == "keyid tag" and $pconfig['peerid_data'] == "")
|
302
|
$input_errors[] = gettext("Please enter a keyid tag for 'Peer Identifier'");
|
303
|
|
304
|
if ($pconfig['peerid_type'] == "fqdn" and $pconfig['peerid_data'] == "")
|
305
|
$input_errors[] = gettext("Please enter a fully qualified domain name for 'Peer Identifier'");
|
306
|
|
307
|
if ($pconfig['peerid_type'] == "user_fqdn" and $pconfig['peerid_data'] == "")
|
308
|
$input_errors[] = gettext("Please enter a user and fully qualified domain name for 'Peer Identifier'");
|
309
|
|
310
|
if ((($pconfig['peerid_type'] == "address") && !is_ipaddr($pconfig['peerid_data'])))
|
311
|
$input_errors[] = gettext("A valid IP address for 'Peer identifier' must be specified.");
|
312
|
|
313
|
if ((($pconfig['peerid_type'] == "fqdn") && !is_domain($pconfig['peerid_data'])))
|
314
|
$input_errors[] = gettext("A valid domain name for 'Peer identifier' must be specified.");
|
315
|
|
316
|
if ($pconfig['peerid_type'] == "fqdn")
|
317
|
if (is_domain($pconfig['peerid_data']) == false)
|
318
|
$input_errors[] = gettext("A valid FQDN for 'Peer identifier' must be specified.");
|
319
|
|
320
|
if ($pconfig['peerid_type'] == "user_fqdn") {
|
321
|
$user_fqdn = explode("@",$pconfig['peerid_data']);
|
322
|
if (is_domain($user_fqdn[1]) == false)
|
323
|
$input_errors[] = gettext("A valid User FQDN in the form of user@my.domain.com for 'Peer identifier' must be specified.");
|
324
|
}
|
325
|
}
|
326
|
|
327
|
if ($pconfig['dpd_enable']) {
|
328
|
if (!is_numeric($pconfig['dpd_delay']))
|
329
|
$input_errors[] = gettext("A numeric value must be specified for DPD delay.");
|
330
|
|
331
|
if (!is_numeric($pconfig['dpd_maxfail']))
|
332
|
$input_errors[] = gettext("A numeric value must be specified for DPD retries.");
|
333
|
}
|
334
|
|
335
|
if (!empty($pconfig['iketype']) && $pconfig['iketype'] != "ikev1" && $pconfig['iketype'] != "ikev2" && $pconfig['iketype'] != "auto")
|
336
|
$input_errors[] = gettext("Valid arguments for IKE type is v1 or v2 or auto");
|
337
|
|
338
|
if (!empty($_POST['ealgo']) && isset($config['system']['crypto_hardware'])) {
|
339
|
if ($config['system']['crypto_hardware'] == "glxsb") {
|
340
|
if ($_POST['ealgo'] == "aes" && $_POST['ealgo_keylen'] != "128")
|
341
|
$input_errors[] = gettext("Only 128 bit AES can be used where the glxsb crypto accelerator is enabled.");
|
342
|
}
|
343
|
}
|
344
|
|
345
|
/* build our encryption algorithms array */
|
346
|
$pconfig['ealgo'] = array();
|
347
|
$pconfig['ealgo']['name'] = $_POST['ealgo'];
|
348
|
if($pconfig['ealgo_keylen'])
|
349
|
$pconfig['ealgo']['keylen'] = $_POST['ealgo_keylen'];
|
350
|
|
351
|
if (!$input_errors) {
|
352
|
$ph1ent['ikeid'] = $pconfig['ikeid'];
|
353
|
$ph1ent['iketype'] = $pconfig['iketype'];
|
354
|
if ($pconfig['iketype'] != 'ikev1')
|
355
|
unset($ph1ent['mode']);
|
356
|
else
|
357
|
$ph1ent['mode'] = $pconfig['mode'];
|
358
|
$ph1ent['disabled'] = $pconfig['disabled'] ? true : false;
|
359
|
$ph1ent['interface'] = $pconfig['interface'];
|
360
|
/* if the remote gateway changed and the interface is not WAN then remove route */
|
361
|
/* the vpn_ipsec_configure() handles adding the route */
|
362
|
if ($pconfig['interface'] <> "wan") {
|
363
|
if($old_ph1ent['remote-gateway'] <> $pconfig['remotegw']) {
|
364
|
mwexec("/sbin/route delete -host {$old_ph1ent['remote-gateway']}");
|
365
|
}
|
366
|
}
|
367
|
|
368
|
if ($pconfig['mobile'])
|
369
|
$ph1ent['mobile'] = true;
|
370
|
else
|
371
|
$ph1ent['remote-gateway'] = $pconfig['remotegw'];
|
372
|
|
373
|
$ph1ent['protocol'] = $pconfig['protocol'];
|
374
|
|
375
|
$ph1ent['myid_type'] = $pconfig['myid_type'];
|
376
|
$ph1ent['myid_data'] = $pconfig['myid_data'];
|
377
|
$ph1ent['peerid_type'] = $pconfig['peerid_type'];
|
378
|
$ph1ent['peerid_data'] = $pconfig['peerid_data'];
|
379
|
|
380
|
$ph1ent['encryption-algorithm'] = $pconfig['ealgo'];
|
381
|
$ph1ent['hash-algorithm'] = $pconfig['halgo'];
|
382
|
$ph1ent['dhgroup'] = $pconfig['dhgroup'];
|
383
|
$ph1ent['lifetime'] = $pconfig['lifetime'];
|
384
|
$ph1ent['pre-shared-key'] = $pconfig['pskey'];
|
385
|
$ph1ent['private-key'] = base64_encode($pconfig['privatekey']);
|
386
|
$ph1ent['certref'] = $pconfig['certref'];
|
387
|
$ph1ent['caref'] = $pconfig['caref'];
|
388
|
$ph1ent['authentication_method'] = $pconfig['authentication_method'];
|
389
|
$ph1ent['descr'] = $pconfig['descr'];
|
390
|
$ph1ent['nat_traversal'] = $pconfig['nat_traversal'];
|
391
|
$ph1ent['mobike'] = $pconfig['mobike'];
|
392
|
|
393
|
if (isset($pconfig['reauth_enable']))
|
394
|
$ph1ent['reauth_enable'] = true;
|
395
|
else
|
396
|
unset($ph1ent['reauth_enable']);
|
397
|
if (isset($pconfig['rekey_enable']))
|
398
|
$ph1ent['rekey_enable'] = true;
|
399
|
else
|
400
|
unset($ph1ent['rekey_enable']);
|
401
|
|
402
|
if (isset($pconfig['responderonly']))
|
403
|
$ph1ent['responderonly'] = true;
|
404
|
else
|
405
|
unset($ph1ent['responderonly']);
|
406
|
|
407
|
if (isset($pconfig['dpd_enable'])) {
|
408
|
$ph1ent['dpd_delay'] = $pconfig['dpd_delay'];
|
409
|
$ph1ent['dpd_maxfail'] = $pconfig['dpd_maxfail'];
|
410
|
}
|
411
|
|
412
|
/* generate unique phase1 ikeid */
|
413
|
if ($ph1ent['ikeid'] == 0)
|
414
|
$ph1ent['ikeid'] = ipsec_ikeid_next();
|
415
|
|
416
|
if (isset($p1index) && $a_phase1[$p1index])
|
417
|
$a_phase1[$p1index] = $ph1ent;
|
418
|
else
|
419
|
$a_phase1[] = $ph1ent;
|
420
|
|
421
|
write_config();
|
422
|
mark_subsystem_dirty('ipsec');
|
423
|
|
424
|
header("Location: vpn_ipsec.php");
|
425
|
exit;
|
426
|
}
|
427
|
}
|
428
|
|
429
|
if ($pconfig['mobile'])
|
430
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Edit Phase 1"), gettext("Mobile Client"));
|
431
|
else
|
432
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Edit Phase 1"));
|
433
|
$shortcut_section = "ipsec";
|
434
|
|
435
|
|
436
|
include("head.inc");
|
437
|
|
438
|
?>
|
439
|
|
440
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
441
|
<?php include("fbegin.inc"); ?>
|
442
|
<script type="text/javascript">
|
443
|
//<![CDATA[
|
444
|
|
445
|
function myidsel_change() {
|
446
|
index = document.iform.myid_type.selectedIndex;
|
447
|
value = document.iform.myid_type.options[index].value;
|
448
|
if (value == 'myaddress')
|
449
|
document.getElementById('myid_data').style.visibility = 'hidden';
|
450
|
else
|
451
|
document.getElementById('myid_data').style.visibility = 'visible';
|
452
|
}
|
453
|
|
454
|
function iketype_change() {
|
455
|
index = document.iform.iketype.selectedIndex;
|
456
|
value = document.iform.iketype.options[index].value;
|
457
|
if (value == 'ikev2') {
|
458
|
document.getElementById('negmode').style.display= 'none';
|
459
|
document.getElementById('mobike').style.display= '';
|
460
|
document.getElementById('natt').style.display= 'none';
|
461
|
document.getElementById('disablereauth').style.display= '';
|
462
|
} else {
|
463
|
document.getElementById('negmode').style.display = '';
|
464
|
document.getElementById('mobike').style.display = 'none';
|
465
|
document.getElementById('natt').style.display= '';
|
466
|
document.getElementById('disablereauth').style.display= 'none';
|
467
|
}
|
468
|
}
|
469
|
|
470
|
function peeridsel_change() {
|
471
|
index = document.iform.peerid_type.selectedIndex;
|
472
|
value = document.iform.peerid_type.options[index].value;
|
473
|
if (value == 'peeraddress')
|
474
|
document.getElementById('peerid_data').style.visibility = 'hidden';
|
475
|
else
|
476
|
document.getElementById('peerid_data').style.visibility = 'visible';
|
477
|
}
|
478
|
|
479
|
function methodsel_change() {
|
480
|
index = document.iform.authentication_method.selectedIndex;
|
481
|
value = document.iform.authentication_method.options[index].value;
|
482
|
|
483
|
switch (value) {
|
484
|
case 'eap-mschapv2':
|
485
|
case 'eap-tls':
|
486
|
case 'eap-radius':
|
487
|
document.getElementById('opt_psk').style.display = 'none';
|
488
|
document.getElementById('opt_peerid').style.display = '';
|
489
|
document.getElementById('opt_cert').style.display = '';
|
490
|
document.getElementById('opt_ca').style.display = '';
|
491
|
document.getElementById('opt_cert').disabled = false;
|
492
|
document.getElementById('opt_ca').disabled = false;
|
493
|
break;
|
494
|
case 'hybrid_rsa_server':
|
495
|
document.getElementById('opt_psk').style.display = 'none';
|
496
|
document.getElementById('opt_peerid').style.display = '';
|
497
|
document.getElementById('opt_cert').style.display = '';
|
498
|
document.getElementById('opt_ca').style.display = '';
|
499
|
document.getElementById('opt_cert').disabled = false;
|
500
|
document.getElementById('opt_ca').disabled = false;
|
501
|
break;
|
502
|
case 'xauth_rsa_server':
|
503
|
case 'rsasig':
|
504
|
document.getElementById('opt_psk').style.display = 'none';
|
505
|
document.getElementById('opt_peerid').style.display = '';
|
506
|
document.getElementById('opt_cert').style.display = '';
|
507
|
document.getElementById('opt_ca').style.display = '';
|
508
|
document.getElementById('opt_cert').disabled = false;
|
509
|
document.getElementById('opt_ca').disabled = false;
|
510
|
break;
|
511
|
<?php if ($pconfig['mobile']) { ?>
|
512
|
case 'pre_shared_key':
|
513
|
document.getElementById('opt_psk').style.display = 'none';
|
514
|
document.getElementById('opt_peerid').style.display = 'none';
|
515
|
document.getElementById('opt_cert').style.display = 'none';
|
516
|
document.getElementById('opt_ca').style.display = 'none';
|
517
|
document.getElementById('opt_cert').disabled = true;
|
518
|
document.getElementById('opt_ca').disabled = true;
|
519
|
break;
|
520
|
<?php } ?>
|
521
|
default: /* psk modes*/
|
522
|
document.getElementById('opt_psk').style.display = '';
|
523
|
document.getElementById('opt_peerid').style.display = '';
|
524
|
document.getElementById('opt_cert').style.display = 'none';
|
525
|
document.getElementById('opt_ca').style.display = 'none';
|
526
|
document.getElementById('opt_cert').disabled = true;
|
527
|
document.getElementById('opt_ca').disabled = true;
|
528
|
break;
|
529
|
}
|
530
|
}
|
531
|
|
532
|
/* PHP generated java script for variable length keys */
|
533
|
function ealgosel_change(bits) {
|
534
|
switch (document.iform.ealgo.selectedIndex) {
|
535
|
<?php
|
536
|
$i = 0;
|
537
|
foreach ($p1_ealgos as $algo => $algodata) {
|
538
|
if (is_array($algodata['keysel'])) {
|
539
|
echo " case {$i}:\n";
|
540
|
echo " document.iform.ealgo_keylen.style.visibility = 'visible';\n";
|
541
|
echo " document.iform.ealgo_keylen.options.length = 0;\n";
|
542
|
// echo " document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( 'auto', 'auto' );\n";
|
543
|
|
544
|
$key_hi = $algodata['keysel']['hi'];
|
545
|
$key_lo = $algodata['keysel']['lo'];
|
546
|
$key_step = $algodata['keysel']['step'];
|
547
|
|
548
|
for ($keylen = $key_hi; $keylen >= $key_lo; $keylen -= $key_step)
|
549
|
echo " document.iform.ealgo_keylen.options[document.iform.ealgo_keylen.options.length] = new Option( '{$keylen} bits', '{$keylen}' );\n";
|
550
|
echo " break;\n";
|
551
|
} else {
|
552
|
echo " case {$i}:\n";
|
553
|
echo " document.iform.ealgo_keylen.style.visibility = 'hidden';\n";
|
554
|
echo " document.iform.ealgo_keylen.options.length = 0;\n";
|
555
|
echo " break;\n";
|
556
|
}
|
557
|
$i++;
|
558
|
}
|
559
|
?>
|
560
|
}
|
561
|
|
562
|
if( bits )
|
563
|
document.iform.ealgo_keylen.value = bits;
|
564
|
}
|
565
|
|
566
|
function dpdchkbox_change() {
|
567
|
if( document.iform.dpd_enable.checked )
|
568
|
document.getElementById('opt_dpd').style.display = '';
|
569
|
else
|
570
|
document.getElementById('opt_dpd').style.display = 'none';
|
571
|
|
572
|
if (!document.iform.dpd_delay.value)
|
573
|
document.iform.dpd_delay.value = "10";
|
574
|
|
575
|
if (!document.iform.dpd_maxfail.value)
|
576
|
document.iform.dpd_maxfail.value = "5";
|
577
|
}
|
578
|
|
579
|
//]]>
|
580
|
</script>
|
581
|
|
582
|
<form action="vpn_ipsec_phase1.php" method="post" name="iform" id="iform">
|
583
|
|
584
|
<?php
|
585
|
if ($input_errors)
|
586
|
print_input_errors($input_errors);
|
587
|
?>
|
588
|
|
589
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec phase-1">
|
590
|
<tr class="tabnavtbl">
|
591
|
<td id="tabnav">
|
592
|
<?php
|
593
|
$tab_array = array();
|
594
|
$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
|
595
|
$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
596
|
$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
|
597
|
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
|
598
|
display_top_tabs($tab_array);
|
599
|
?>
|
600
|
</td>
|
601
|
</tr>
|
602
|
<tr>
|
603
|
<td id="mainarea">
|
604
|
<div class="tabcont">
|
605
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
606
|
<tr>
|
607
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
|
608
|
</tr>
|
609
|
<tr>
|
610
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
|
611
|
<td width="78%" class="vtable">
|
612
|
<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked=\"checked\""; ?> />
|
613
|
<strong><?=gettext("Disable this phase1 entry"); ?></strong><br />
|
614
|
<span class="vexpl">
|
615
|
<?=gettext("Set this option to disable this phase1 without " .
|
616
|
"removing it from the list"); ?>.
|
617
|
</span>
|
618
|
</td>
|
619
|
</tr>
|
620
|
<tr>
|
621
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Key Exchange version"); ?></td>
|
622
|
<td width="78%" class="vtable">
|
623
|
<select name="iketype" class="formselect" onchange='iketype_change()'>
|
624
|
<?php
|
625
|
$keyexchange = array("ikev1" => "V1", "ikev2" => "V2", "auto" => "Auto");
|
626
|
foreach ($keyexchange as $kidx => $name):
|
627
|
?>
|
628
|
<option value="<?=$kidx;?>" <?php if ($kidx == $pconfig['iketype']) echo "selected=\"selected\""; ?>>
|
629
|
<?=htmlspecialchars($name);?>
|
630
|
</option>
|
631
|
<?php endforeach; ?>
|
632
|
</select> <br /> <span class="vexpl"><?=gettext("Select the Internet Key Exchange protocol version to be used, IKEv1 or IKEv2"); ?>.</span>
|
633
|
</td>
|
634
|
</tr>
|
635
|
<tr>
|
636
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Internet Protocol"); ?></td>
|
637
|
<td width="78%" class="vtable">
|
638
|
<select name="protocol" class="formselect">
|
639
|
<?php
|
640
|
$protocols = array("inet" => "IPv4", "inet6" => "IPv6");
|
641
|
foreach ($protocols as $protocol => $name):
|
642
|
?>
|
643
|
<option value="<?=$protocol;?>" <?php if ($protocol == $pconfig['protocol']) echo "selected=\"selected\""; ?>>
|
644
|
<?=htmlspecialchars($name);?>
|
645
|
</option>
|
646
|
<?php endforeach; ?>
|
647
|
</select> <br /> <span class="vexpl"><?=gettext("Select the Internet Protocol family from this dropdown"); ?>.</span>
|
648
|
</td>
|
649
|
</tr>
|
650
|
<tr>
|
651
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
|
652
|
<td width="78%" class="vtable">
|
653
|
<select name="interface" class="formselect">
|
654
|
<?php
|
655
|
$interfaces = get_configured_interface_with_descr();
|
656
|
|
657
|
$carplist = get_configured_carp_interface_list();
|
658
|
foreach ($carplist as $cif => $carpip)
|
659
|
$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
|
660
|
|
661
|
$aliaslist = get_configured_ip_aliases_list();
|
662
|
foreach ($aliaslist as $aliasip => $aliasif)
|
663
|
$interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
664
|
|
665
|
$grouplist = return_gateway_groups_array();
|
666
|
foreach ($grouplist as $name => $group) {
|
667
|
if($group[0]['vip'] <> "")
|
668
|
$vipif = $group[0]['vip'];
|
669
|
else
|
670
|
$vipif = $group[0]['int'];
|
671
|
$interfaces[$name] = "GW Group {$name}";
|
672
|
}
|
673
|
|
674
|
|
675
|
foreach ($interfaces as $iface => $ifacename):
|
676
|
?>
|
677
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""; ?>>
|
678
|
<?=htmlspecialchars($ifacename);?>
|
679
|
</option>
|
680
|
<?php endforeach; ?>
|
681
|
</select>
|
682
|
<br />
|
683
|
<span class="vexpl"><?=gettext("Select the interface for the local endpoint of this phase1 entry"); ?>.</span>
|
684
|
</td>
|
685
|
</tr>
|
686
|
|
687
|
<?php if (!$pconfig['mobile']): ?>
|
688
|
|
689
|
<tr>
|
690
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Remote gateway"); ?></td>
|
691
|
<td width="78%" class="vtable">
|
692
|
<?=$mandfldhtml;?><input name="remotegw" type="text" class="formfld unknown" id="remotegw" size="28" value="<?=htmlspecialchars($pconfig['remotegw']);?>" />
|
693
|
<br />
|
694
|
<?=gettext("Enter the public IP address or host name of the remote gateway"); ?>
|
695
|
</td>
|
696
|
</tr>
|
697
|
|
698
|
<?php endif; ?>
|
699
|
|
700
|
<tr>
|
701
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
702
|
<td width="78%" class="vtable">
|
703
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
|
704
|
<br />
|
705
|
<span class="vexpl">
|
706
|
<?=gettext("You may enter a description here " .
|
707
|
"for your reference (not parsed)"); ?>.
|
708
|
</span>
|
709
|
</td>
|
710
|
</tr>
|
711
|
<tr>
|
712
|
<td colspan="2" class="list" height="12"></td>
|
713
|
</tr>
|
714
|
<tr>
|
715
|
<td colspan="2" valign="top" class="listtopic">
|
716
|
<?=gettext("Phase 1 proposal (Authentication)"); ?>
|
717
|
</td>
|
718
|
</tr>
|
719
|
<tr>
|
720
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication method"); ?></td>
|
721
|
<td width="78%" class="vtable">
|
722
|
<select name="authentication_method" class="formselect" onchange="methodsel_change()">
|
723
|
<?php
|
724
|
foreach ($p1_authentication_methods as $method_type => $method_params):
|
725
|
if (!$pconfig['mobile'] && $method_params['mobile'])
|
726
|
continue;
|
727
|
?>
|
728
|
<option value="<?=$method_type;?>" <?php if ($method_type == $pconfig['authentication_method']) echo "selected=\"selected\""; ?>>
|
729
|
<?=htmlspecialchars($method_params['name']);?>
|
730
|
</option>
|
731
|
<?php endforeach; ?>
|
732
|
</select>
|
733
|
<br />
|
734
|
<span class="vexpl">
|
735
|
<?=gettext("Must match the setting chosen on the remote side"); ?>.
|
736
|
</span>
|
737
|
</td>
|
738
|
</tr>
|
739
|
<tr id='negmode' >
|
740
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Negotiation mode"); ?></td>
|
741
|
<td width="78%" class="vtable">
|
742
|
<select name="mode" class="formselect">
|
743
|
<?php
|
744
|
$modes = array("main" => "Main", "aggressive" => "Aggressive");
|
745
|
foreach ($modes as $mode => $mdescr):
|
746
|
?>
|
747
|
<option value="<?=$mode;?>" <?php if ($mode == $pconfig['mode']) echo "selected=\"selected\""; ?>>
|
748
|
<?=htmlspecialchars($mdescr);?>
|
749
|
</option>
|
750
|
<?php endforeach; ?>
|
751
|
</select> <br /> <span class="vexpl"><?=gettext("Aggressive is more flexible, but less secure"); ?>.</span>
|
752
|
</td>
|
753
|
</tr>
|
754
|
<tr>
|
755
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("My identifier"); ?></td>
|
756
|
<td width="78%" class="vtable">
|
757
|
<select name="myid_type" class="formselect" onchange="myidsel_change()">
|
758
|
<?php foreach ($my_identifier_list as $id_type => $id_params): ?>
|
759
|
<option value="<?=$id_type;?>" <?php if ($id_type == $pconfig['myid_type']) echo "selected=\"selected\""; ?>>
|
760
|
<?=htmlspecialchars($id_params['desc']);?>
|
761
|
</option>
|
762
|
<?php endforeach; ?>
|
763
|
</select>
|
764
|
<input name="myid_data" type="text" class="formfld unknown" id="myid_data" size="30" value="<?=htmlspecialchars($pconfig['myid_data']);?>" />
|
765
|
</td>
|
766
|
</tr>
|
767
|
<tr id="opt_peerid">
|
768
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer identifier"); ?></td>
|
769
|
<td width="78%" class="vtable">
|
770
|
<select name="peerid_type" class="formselect" onchange="peeridsel_change()">
|
771
|
<?php
|
772
|
foreach ($peer_identifier_list as $id_type => $id_params):
|
773
|
if ($pconfig['mobile'] && !$id_params['mobile'])
|
774
|
continue;
|
775
|
?>
|
776
|
<option value="<?=$id_type;?>" <?php if ($id_type == $pconfig['peerid_type']) echo "selected=\"selected\""; ?>>
|
777
|
<?=htmlspecialchars($id_params['desc']);?>
|
778
|
</option>
|
779
|
<?php endforeach; ?>
|
780
|
</select>
|
781
|
<input name="peerid_data" type="text" class="formfld unknown" id="peerid_data" size="30" value="<?=htmlspecialchars($pconfig['peerid_data']);?>" />
|
782
|
<?php if ($pconfig['mobile']) { ?>
|
783
|
<br /><br /><?=gettext("NOTE: This is known as the \"group\" setting on some VPN client implementations"); ?>.
|
784
|
<?php } ?>
|
785
|
</td>
|
786
|
</tr>
|
787
|
<tr id="opt_psk">
|
788
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Pre-Shared Key"); ?></td>
|
789
|
<td width="78%" class="vtable">
|
790
|
<?=$mandfldhtml;?>
|
791
|
<input name="pskey" type="text" class="formfld unknown" id="pskey" size="40" value="<?=htmlspecialchars($pconfig['pskey']);?>" />
|
792
|
<span class="vexpl">
|
793
|
<br />
|
794
|
<?=gettext("Input your Pre-Shared Key string"); ?>.
|
795
|
</span>
|
796
|
</td>
|
797
|
</tr>
|
798
|
<tr id="opt_cert">
|
799
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("My Certificate"); ?></td>
|
800
|
<td width="78%" class="vtable">
|
801
|
<select name="certref" class="formselect">
|
802
|
<?php
|
803
|
foreach ($config['cert'] as $cert):
|
804
|
$selected = "";
|
805
|
if ($pconfig['certref'] == $cert['refid'])
|
806
|
$selected = "selected=\"selected\"";
|
807
|
?>
|
808
|
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'];?></option>
|
809
|
<?php endforeach; ?>
|
810
|
</select>
|
811
|
<br />
|
812
|
<span class="vexpl">
|
813
|
<?=gettext("Select a certificate previously configured in the Certificate Manager"); ?>.
|
814
|
</span>
|
815
|
</td>
|
816
|
</tr>
|
817
|
<tr id="opt_ca">
|
818
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("My Certificate Authority"); ?></td>
|
819
|
<td width="78%" class="vtable">
|
820
|
<select name="caref" class="formselect">
|
821
|
<?php
|
822
|
foreach ($config['ca'] as $ca):
|
823
|
$selected = "";
|
824
|
if ($pconfig['caref'] == $ca['refid'])
|
825
|
$selected = "selected=\"selected\"";
|
826
|
?>
|
827
|
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
|
828
|
<?php endforeach; ?>
|
829
|
</select>
|
830
|
<br />
|
831
|
<span class="vexpl">
|
832
|
<?=gettext("Select a certificate authority previously configured in the Certificate Manager"); ?>.
|
833
|
</span>
|
834
|
</td>
|
835
|
</tr>
|
836
|
<tr>
|
837
|
<td colspan="2" valign="top" class="listtopic">
|
838
|
<?=gettext("Phase 1 proposal (Algorithms)"); ?>
|
839
|
</td>
|
840
|
</tr>
|
841
|
<tr>
|
842
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
|
843
|
<td width="78%" class="vtable">
|
844
|
<select name="ealgo" class="formselect" onchange="ealgosel_change()">
|
845
|
<?php
|
846
|
foreach ($p1_ealgos as $algo => $algodata):
|
847
|
$selected = "";
|
848
|
if ($algo == $pconfig['ealgo']['name'])
|
849
|
$selected = " selected=\"selected\"";
|
850
|
?>
|
851
|
<option value="<?=$algo;?>"<?=$selected?>>
|
852
|
<?=htmlspecialchars($algodata['name']);?>
|
853
|
</option>
|
854
|
<?php endforeach; ?>
|
855
|
</select>
|
856
|
<select name="ealgo_keylen" width="30" class="formselect">
|
857
|
</select>
|
858
|
</td>
|
859
|
</tr>
|
860
|
<tr>
|
861
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hash algorithm"); ?></td>
|
862
|
<td width="78%" class="vtable">
|
863
|
<select name="halgo" class="formselect">
|
864
|
<?php foreach ($p1_halgos as $algo => $algoname): ?>
|
865
|
<option value="<?=$algo;?>" <?php if ($algo == $pconfig['halgo']) echo "selected=\"selected\""; ?>>
|
866
|
<?=htmlspecialchars($algoname);?>
|
867
|
</option>
|
868
|
<?php endforeach; ?>
|
869
|
</select>
|
870
|
<br />
|
871
|
<span class="vexpl">
|
872
|
<?=gettext("Must match the setting chosen on the remote side"); ?>.
|
873
|
</span>
|
874
|
</td>
|
875
|
</tr>
|
876
|
<tr>
|
877
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("DH key group"); ?></td>
|
878
|
<td width="78%" class="vtable">
|
879
|
<select name="dhgroup" class="formselect">
|
880
|
<?php foreach ($p1_dhgroups as $keygroup => $keygroupname): ?>
|
881
|
<option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['dhgroup']) echo "selected=\"selected\""; ?>>
|
882
|
<?=htmlspecialchars($keygroupname);?>
|
883
|
</option>
|
884
|
<?php endforeach; ?>
|
885
|
</select>
|
886
|
<br />
|
887
|
<span class="vexpl">
|
888
|
<?=gettext("Must match the setting chosen on the remote side"); ?>.
|
889
|
</span>
|
890
|
</td>
|
891
|
</tr>
|
892
|
<tr>
|
893
|
<td width="22%" valign="top" class="vncell"><?=gettext("Lifetime"); ?></td>
|
894
|
<td width="78%" class="vtable">
|
895
|
<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="20" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />
|
896
|
<?=gettext("seconds"); ?>
|
897
|
</td>
|
898
|
</tr>
|
899
|
<tr>
|
900
|
<td colspan="2" class="list" height="12"></td>
|
901
|
</tr>
|
902
|
<tr>
|
903
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced Options"); ?></td>
|
904
|
</tr>
|
905
|
<tr>
|
906
|
<td width="22%" valign="top" class="vncell"><?=gettext("Disable Rekey");?></td>
|
907
|
<td width="78%" class="vtable">
|
908
|
<input name="rekey_enable" type="checkbox" id="rekey_enable" value="yes" <?php if (isset($pconfig['rekey_enable'])) echo "checked=\"checked\""; ?> />
|
909
|
<?=gettext("Whether a connection should be renegotiated when it is about to expire."); ?><br />
|
910
|
</td>
|
911
|
</tr>
|
912
|
<tr id='disablereauth'>
|
913
|
<td width="22%" valign="top" class="vncell"><?=gettext("Disable Reauth");?></td>
|
914
|
<td width="78%" class="vtable">
|
915
|
<input name="reauth_enable" type="checkbox" id="reauth_enable" value="yes" <?php if (isset($pconfig['reauth_enable'])) echo "checked=\"checked\""; ?> />
|
916
|
<?=gettext("Whether rekeying of an IKE_SA should also reauthenticate the peer. In IKEv1, reauthentication is always done."); ?><br />
|
917
|
</td>
|
918
|
</tr>
|
919
|
<tr>
|
920
|
<td width="22%" valign="top" class="vncell"><?=gettext("Responder Only");?></td>
|
921
|
<td width="78%" class="vtable">
|
922
|
<input name="responderonly" type="checkbox" id="responderonly" value="yes" <?php if (isset($pconfig['responderonly'])) echo "checked=\"checked\""; ?> />
|
923
|
<?=gettext("Enable this option to never initiate this connection from this side, only respond to incoming requests."); ?><br />
|
924
|
</td>
|
925
|
</tr>
|
926
|
<tr id='natt'>
|
927
|
<td width="22%" valign="top" class="vncell"><?=gettext("NAT Traversal"); ?></td>
|
928
|
<td width="78%" class="vtable">
|
929
|
<select name="nat_traversal" class="formselect">
|
930
|
<option value="on" <?php if ($pconfig['nat_traversal'] != 'on') echo "selected=\"selected\""; ?>><?=gettext("Auto"); ?></option>
|
931
|
<option value="force" <?php if ($pconfig['nat_traversal'] == 'force') echo "selected=\"selected\""; ?>><?=gettext("Force"); ?></option>
|
932
|
</select>
|
933
|
<br />
|
934
|
<span class="vexpl">
|
935
|
<?=gettext("Set this option to enable the use of NAT-T (i.e. the encapsulation of ESP in UDP packets) if needed, " .
|
936
|
"which can help with clients that are behind restrictive firewalls"); ?>.
|
937
|
</span>
|
938
|
</td>
|
939
|
</tr>
|
940
|
<tr id='mobike'>
|
941
|
<td width="22%" valign="top" class="vncell"><?=gettext("MOBIKE"); ?></td>
|
942
|
<td width="78%" class="vtable">
|
943
|
<select name="mobike" class="formselect">
|
944
|
<option value="on" <?php if ($pconfig['mobike'] == 'on') echo "selected=\"selected\""; ?>><?=gettext("Enable"); ?></option>
|
945
|
<option value="off" <?php if ($pconfig['mobike'] != 'on') echo "selected=\"selected\""; ?>><?=gettext("Disable"); ?></option>
|
946
|
</select>
|
947
|
<br />
|
948
|
<span class="vexpl">
|
949
|
<?=gettext("Set this option to control the use of MOBIKE"); ?>.
|
950
|
</span>
|
951
|
</td>
|
952
|
</tr>
|
953
|
<tr>
|
954
|
<td width="22%" valign="top" class="vncell"><?=gettext("Dead Peer Detection"); ?></td>
|
955
|
<td width="78%" class="vtable">
|
956
|
<input name="dpd_enable" type="checkbox" id="dpd_enable" value="yes" <?php if (isset($pconfig['dpd_enable'])) echo "checked=\"checked\""; ?> onclick="dpdchkbox_change()" />
|
957
|
<?=gettext("Enable DPD"); ?><br />
|
958
|
<div id="opt_dpd">
|
959
|
<br />
|
960
|
<input name="dpd_delay" type="text" class="formfld unknown" id="dpd_delay" size="5" value="<?=htmlspecialchars($pconfig['dpd_delay']);?>" />
|
961
|
<?=gettext("seconds"); ?><br />
|
962
|
<span class="vexpl">
|
963
|
<?=gettext("Delay between requesting peer acknowledgement"); ?>.
|
964
|
</span><br />
|
965
|
<br />
|
966
|
<input name="dpd_maxfail" type="text" class="formfld unknown" id="dpd_maxfail" size="5" value="<?=htmlspecialchars($pconfig['dpd_maxfail']);?>" />
|
967
|
<?=gettext("retries"); ?><br />
|
968
|
<span class="vexpl">
|
969
|
<?=gettext("Number of consecutive failures allowed before disconnect"); ?>.
|
970
|
</span>
|
971
|
<br />
|
972
|
</div>
|
973
|
</td>
|
974
|
</tr>
|
975
|
<tr>
|
976
|
<td width="22%" valign="top"> </td>
|
977
|
<td width="78%">
|
978
|
<?php if (isset($p1index) && $a_phase1[$p1index]): ?>
|
979
|
<input name="p1index" type="hidden" value="<?=htmlspecialchars($p1index);?>" />
|
980
|
<?php endif; ?>
|
981
|
<?php if ($pconfig['mobile']): ?>
|
982
|
<input name="mobile" type="hidden" value="true" />
|
983
|
<?php endif; ?>
|
984
|
<input name="ikeid" type="hidden" value="<?=htmlspecialchars($pconfig['ikeid']);?>" />
|
985
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
|
986
|
</td>
|
987
|
</tr>
|
988
|
</table>
|
989
|
</div>
|
990
|
</td>
|
991
|
</tr>
|
992
|
</table>
|
993
|
</form>
|
994
|
|
995
|
<script type="text/javascript">
|
996
|
//<![CDATA[
|
997
|
<?php
|
998
|
/* determine if we should init the key length */
|
999
|
$keyset = '';
|
1000
|
if (isset($pconfig['ealgo']['keylen']))
|
1001
|
if (is_numeric($pconfig['ealgo']['keylen']))
|
1002
|
$keyset = $pconfig['ealgo']['keylen'];
|
1003
|
?>
|
1004
|
myidsel_change();
|
1005
|
peeridsel_change();
|
1006
|
iketype_change();
|
1007
|
methodsel_change();
|
1008
|
ealgosel_change(<?=$keyset;?>);
|
1009
|
dpdchkbox_change();
|
1010
|
//]]>
|
1011
|
</script>
|
1012
|
<?php include("fend.inc"); ?>
|
1013
|
</body>
|
1014
|
</html>
|