1
|
<?php
|
2
|
/*
|
3
|
* vpn_ipsec.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
* All rights reserved.
|
12
|
*
|
13
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
* you may not use this file except in compliance with the License.
|
15
|
* You may obtain a copy of the License at
|
16
|
*
|
17
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
*
|
19
|
* Unless required by applicable law or agreed to in writing, software
|
20
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
* See the License for the specific language governing permissions and
|
23
|
* limitations under the License.
|
24
|
*/
|
25
|
|
26
|
##|+PRIV
|
27
|
##|*IDENT=page-vpn-ipsec
|
28
|
##|*NAME=VPN: IPsec
|
29
|
##|*DESCR=Allow access to the 'VPN: IPsec' page.
|
30
|
##|*MATCH=vpn_ipsec.php*
|
31
|
##|-PRIV
|
32
|
|
33
|
require_once("guiconfig.inc");
|
34
|
require_once("functions.inc");
|
35
|
require_once("filter.inc");
|
36
|
require_once("shaper.inc");
|
37
|
require_once("ipsec.inc");
|
38
|
require_once("vpn.inc");
|
39
|
|
40
|
if (!is_array($config['ipsec']['phase1'])) {
|
41
|
$config['ipsec']['phase1'] = array();
|
42
|
}
|
43
|
|
44
|
if (!is_array($config['ipsec']['phase2'])) {
|
45
|
$config['ipsec']['phase2'] = array();
|
46
|
}
|
47
|
|
48
|
$a_phase1 = &$config['ipsec']['phase1'];
|
49
|
$a_phase2 = &$config['ipsec']['phase2'];
|
50
|
|
51
|
if ($_POST) {
|
52
|
if ($_POST['apply']) {
|
53
|
$ipsec_dynamic_hosts = vpn_ipsec_configure();
|
54
|
/* reload the filter in the background */
|
55
|
$retval = 0;
|
56
|
$retval |= filter_configure();
|
57
|
if ($ipsec_dynamic_hosts >= 0) {
|
58
|
if (is_subsystem_dirty('ipsec')) {
|
59
|
clear_subsystem_dirty('ipsec');
|
60
|
}
|
61
|
}
|
62
|
} else if (isset($_POST['del'])) {
|
63
|
/* delete selected p1 entries */
|
64
|
if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
65
|
foreach ($_POST['p1entry'] as $p1entrydel) {
|
66
|
unset($a_phase1[$p1entrydel]);
|
67
|
}
|
68
|
if (write_config()) {
|
69
|
mark_subsystem_dirty('ipsec');
|
70
|
}
|
71
|
}
|
72
|
} else if (isset($_POST['delp2'])) {
|
73
|
/* delete selected p2 entries */
|
74
|
if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
75
|
foreach ($_POST['p2entry'] as $p2entrydel) {
|
76
|
unset($a_phase2[$p2entrydel]);
|
77
|
}
|
78
|
if (write_config()) {
|
79
|
mark_subsystem_dirty('ipsec');
|
80
|
}
|
81
|
}
|
82
|
} else {
|
83
|
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
|
84
|
|
85
|
// TODO: this. is. nasty.
|
86
|
unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
|
87
|
foreach ($_POST as $pn => $pd) {
|
88
|
if (preg_match("/del_(\d+)/", $pn, $matches)) {
|
89
|
$delbtn = $matches[1];
|
90
|
} else if (preg_match("/delp2_(\d+)/", $pn, $matches)) {
|
91
|
$delbtnp2 = $matches[1];
|
92
|
} else if (preg_match("/move_(\d+)/", $pn, $matches)) {
|
93
|
$movebtn = $matches[1];
|
94
|
} else if (preg_match("/movep2_(\d+)/", $pn, $matches)) {
|
95
|
$movebtnp2 = $matches[1];
|
96
|
} else if (preg_match("/toggle_(\d+)/", $pn, $matches)) {
|
97
|
$togglebtn = $matches[1];
|
98
|
} else if (preg_match("/togglep2_(\d+)/", $pn, $matches)) {
|
99
|
$togglebtnp2 = $matches[1];
|
100
|
}
|
101
|
}
|
102
|
|
103
|
$save = 1;
|
104
|
|
105
|
/* move selected p1 entries before this */
|
106
|
if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
107
|
$a_phase1_new = array();
|
108
|
|
109
|
/* copy all p1 entries < $movebtn and not selected */
|
110
|
for ($i = 0; $i < $movebtn; $i++) {
|
111
|
if (!in_array($i, $_POST['p1entry'])) {
|
112
|
$a_phase1_new[] = $a_phase1[$i];
|
113
|
}
|
114
|
}
|
115
|
|
116
|
/* copy all selected p1 entries */
|
117
|
for ($i = 0; $i < count($a_phase1); $i++) {
|
118
|
if ($i == $movebtn) {
|
119
|
continue;
|
120
|
}
|
121
|
if (in_array($i, $_POST['p1entry'])) {
|
122
|
$a_phase1_new[] = $a_phase1[$i];
|
123
|
}
|
124
|
}
|
125
|
|
126
|
/* copy $movebtn p1 entry */
|
127
|
if ($movebtn < count($a_phase1)) {
|
128
|
$a_phase1_new[] = $a_phase1[$movebtn];
|
129
|
}
|
130
|
|
131
|
/* copy all p1 entries > $movebtn and not selected */
|
132
|
for ($i = $movebtn+1; $i < count($a_phase1); $i++) {
|
133
|
if (!in_array($i, $_POST['p1entry'])) {
|
134
|
$a_phase1_new[] = $a_phase1[$i];
|
135
|
}
|
136
|
}
|
137
|
if (count($a_phase1_new) > 0) {
|
138
|
$a_phase1 = $a_phase1_new;
|
139
|
}
|
140
|
|
141
|
} else if (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
142
|
/* move selected p2 entries before this */
|
143
|
$a_phase2_new = array();
|
144
|
|
145
|
/* copy all p2 entries < $movebtnp2 and not selected */
|
146
|
for ($i = 0; $i < $movebtnp2; $i++) {
|
147
|
if (!in_array($i, $_POST['p2entry'])) {
|
148
|
$a_phase2_new[] = $a_phase2[$i];
|
149
|
}
|
150
|
}
|
151
|
|
152
|
/* copy all selected p2 entries */
|
153
|
for ($i = 0; $i < count($a_phase2); $i++) {
|
154
|
if ($i == $movebtnp2) {
|
155
|
continue;
|
156
|
}
|
157
|
if (in_array($i, $_POST['p2entry'])) {
|
158
|
$a_phase2_new[] = $a_phase2[$i];
|
159
|
}
|
160
|
}
|
161
|
|
162
|
/* copy $movebtnp2 p2 entry */
|
163
|
if ($movebtnp2 < count($a_phase2)) {
|
164
|
$a_phase2_new[] = $a_phase2[$movebtnp2];
|
165
|
}
|
166
|
|
167
|
/* copy all p2 entries > $movebtnp2 and not selected */
|
168
|
for ($i = $movebtnp2+1; $i < count($a_phase2); $i++) {
|
169
|
if (!in_array($i, $_POST['p2entry'])) {
|
170
|
$a_phase2_new[] = $a_phase2[$i];
|
171
|
}
|
172
|
}
|
173
|
if (count($a_phase2_new) > 0) {
|
174
|
$a_phase2 = $a_phase2_new;
|
175
|
}
|
176
|
|
177
|
} else if (isset($togglebtn)) {
|
178
|
if (isset($a_phase1[$togglebtn]['disabled'])) {
|
179
|
unset($a_phase1[$togglebtn]['disabled']);
|
180
|
} else {
|
181
|
$a_phase1[$togglebtn]['disabled'] = true;
|
182
|
}
|
183
|
} else if (isset($togglebtnp2)) {
|
184
|
if (isset($a_phase2[$togglebtnp2]['disabled'])) {
|
185
|
unset($a_phase2[$togglebtnp2]['disabled']);
|
186
|
} else {
|
187
|
$a_phase2[$togglebtnp2]['disabled'] = true;
|
188
|
}
|
189
|
} else if (isset($delbtn)) {
|
190
|
/* remove static route if interface is not WAN */
|
191
|
if ($a_phase1[$delbtn]['interface'] <> "wan") {
|
192
|
mwexec("/sbin/route delete -host {$a_phase1[$delbtn]['remote-gateway']}");
|
193
|
}
|
194
|
|
195
|
/* remove all phase2 entries that match the ikeid */
|
196
|
$ikeid = $a_phase1[$delbtn]['ikeid'];
|
197
|
foreach ($a_phase2 as $p2index => $ph2tmp) {
|
198
|
if ($ph2tmp['ikeid'] == $ikeid) {
|
199
|
unset($a_phase2[$p2index]);
|
200
|
}
|
201
|
}
|
202
|
unset($a_phase1[$delbtn]);
|
203
|
|
204
|
} else if (isset($delbtnp2)) {
|
205
|
unset($a_phase2[$delbtnp2]);
|
206
|
|
207
|
} else {
|
208
|
$save = 0;
|
209
|
}
|
210
|
|
211
|
if ($save === 1) {
|
212
|
if (write_config()) {
|
213
|
mark_subsystem_dirty('ipsec');
|
214
|
}
|
215
|
}
|
216
|
}
|
217
|
}
|
218
|
|
219
|
$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Tunnels"));
|
220
|
$pglinks = array("", "@self", "@self");
|
221
|
$shortcut_section = "ipsec";
|
222
|
|
223
|
include("head.inc");
|
224
|
|
225
|
$tab_array = array();
|
226
|
$tab_array[] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
|
227
|
$tab_array[] = array(gettext("Mobile Clients"), false, "vpn_ipsec_mobile.php");
|
228
|
$tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
|
229
|
$tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
|
230
|
display_top_tabs($tab_array);
|
231
|
|
232
|
if ($_POST['apply']) {
|
233
|
print_apply_result_box($retval);
|
234
|
}
|
235
|
|
236
|
if (is_subsystem_dirty('ipsec')) {
|
237
|
print_apply_box(gettext("The IPsec tunnel configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
|
238
|
}
|
239
|
?>
|
240
|
|
241
|
<form name="mainform" method="post">
|
242
|
<div class="panel panel-default">
|
243
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('IPsec Tunnels')?></h2></div>
|
244
|
<div class="panel-body table-responsive">
|
245
|
<table class="table table-striped table-hover">
|
246
|
<thead>
|
247
|
<tr>
|
248
|
<th> </th>
|
249
|
<th> </th>
|
250
|
<th><?=gettext("IKE")?></th>
|
251
|
<th><?=gettext("Remote Gateway")?></th>
|
252
|
<th><?=gettext("Mode")?></th>
|
253
|
<th><?=gettext("P1 Protocol")?></th>
|
254
|
<th><?=gettext("P1 Transforms")?></th>
|
255
|
<th><?=gettext("P1 Description")?></th>
|
256
|
<th><?=gettext("Actions")?></th>
|
257
|
</tr>
|
258
|
</thead>
|
259
|
<tbody class="p1-entries">
|
260
|
<?php $i = 0; foreach ($a_phase1 as $ph1ent): ?>
|
261
|
<?php
|
262
|
$iconfn = "pass";
|
263
|
|
264
|
$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
265
|
|
266
|
if ($entryStatus == 'disabled') {
|
267
|
$iconfn .= "_d";
|
268
|
}
|
269
|
?>
|
270
|
<tr id="fr<?=$i?>" onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
|
271
|
<td>
|
272
|
<input type="checkbox" id="frc<?=$i?>" onclick="fr_toggle(<?=$i?>)" name="p1entry[]" value="<?=$i?>" />
|
273
|
<a class="fa fa-anchor icon-pointer" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a>
|
274
|
</td>
|
275
|
<td>
|
276
|
<button value="toggle_<?=$i?>" name="toggle_<?=$i?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-<?= ($entryStatus == 'disabled' ? 'success' : 'warning') ?>" type="submit"><?= ($entryStatus == 'disabled' ? 'Enable' : 'Disable') ?></button>
|
277
|
</td>
|
278
|
<td id="frd<?=$i?>">
|
279
|
<?php
|
280
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1") {
|
281
|
echo "V1";
|
282
|
} elseif ($ph1ent['iketype'] == "ikev2") {
|
283
|
echo "V2";
|
284
|
} elseif ($ph1ent['iketype'] == "auto") {
|
285
|
echo "Auto";
|
286
|
}
|
287
|
?>
|
288
|
</td>
|
289
|
<td>
|
290
|
<?php
|
291
|
if ($ph1ent['interface']) {
|
292
|
$iflabels = get_configured_interface_with_descr();
|
293
|
|
294
|
$viplist = get_configured_vip_list();
|
295
|
foreach ($viplist as $vip => $address) {
|
296
|
$iflabels[$vip] = $address;
|
297
|
if (get_vip_descr($address)) {
|
298
|
$iflabels[$vip] .= " (". get_vip_descr($address) .")";
|
299
|
}
|
300
|
}
|
301
|
|
302
|
$grouplist = return_gateway_groups_array();
|
303
|
foreach ($grouplist as $name => $group) {
|
304
|
if ($group[0]['vip'] != "") {
|
305
|
$vipif = $group[0]['vip'];
|
306
|
} else {
|
307
|
$vipif = $group[0]['int'];
|
308
|
}
|
309
|
$iflabels[$name] = "GW Group {$name}";
|
310
|
}
|
311
|
$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
|
312
|
} else {
|
313
|
$if = "WAN";
|
314
|
}
|
315
|
|
316
|
if (!isset($ph1ent['mobile'])) {
|
317
|
echo $if."<br />".$ph1ent['remote-gateway'];
|
318
|
} else {
|
319
|
echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
|
320
|
}
|
321
|
?>
|
322
|
</td>
|
323
|
<td id="frd<?=$i?>">
|
324
|
<?=$spans?>
|
325
|
<?php
|
326
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1" || $ph1ent['iketype'] == "auto") {
|
327
|
echo "{$ph1ent['mode']}";
|
328
|
}
|
329
|
?>
|
330
|
<?=$spane?>
|
331
|
</td>
|
332
|
<td id="frd<?=$i?>">
|
333
|
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name']?>
|
334
|
<?php
|
335
|
if ($ph1ent['encryption-algorithm']['keylen']) {
|
336
|
if ($ph1ent['encryption-algorithm']['keylen'] == "auto") {
|
337
|
echo " (" . gettext("auto") . ")";
|
338
|
} else {
|
339
|
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
|
340
|
}
|
341
|
}
|
342
|
?>
|
343
|
</td>
|
344
|
<td>
|
345
|
<?=$p1_halgos[$ph1ent['hash-algorithm']]?>
|
346
|
</td>
|
347
|
<td>
|
348
|
<?=htmlspecialchars($ph1ent['descr'])?>
|
349
|
</td>
|
350
|
<td style="cursor: pointer;">
|
351
|
<!-- <a class="fa fa-anchor" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a> -->
|
352
|
<button style="display: none;" class="btn btn-default btn-xs" type="submit" id="move_<?=$i?>" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("Move checked entries to here")?></button>
|
353
|
<a class="fa fa-pencil" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("Edit phase1 entry"); ?>"></a>
|
354
|
<?php if (!isset($ph1ent['mobile'])): ?>
|
355
|
<a class="fa fa-clone" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("Copy phase1 entry"); ?>"></a>
|
356
|
<?php endif; ?>
|
357
|
<a class="fa fa-trash no-confirm" id="Xdel_<?=$i?>" title="<?=gettext('Delete phase1 entry'); ?>"></a>
|
358
|
<button style="display: none;" class="btn btn-xs btn-warning" type="submit" id="del_<?=$i?>" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('Delete phase1 entry'); ?>">delete</button>
|
359
|
|
360
|
</td>
|
361
|
</tr>
|
362
|
<tr class="<?= $entryStatus ?>">
|
363
|
<td colspan="2"></td>
|
364
|
<td colspan="7" class="contains-table">
|
365
|
<?php
|
366
|
if (isset($_POST["tdph2-{$i}-visible"])) {
|
367
|
$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
|
368
|
} else {
|
369
|
$tdph2_visible = 0;
|
370
|
}
|
371
|
?>
|
372
|
<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
|
373
|
<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
|
374
|
<?php
|
375
|
$phase2count=0;
|
376
|
|
377
|
foreach ($a_phase2 as $ph2ent) {
|
378
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
|
379
|
continue;
|
380
|
}
|
381
|
$phase2count++;
|
382
|
}
|
383
|
$fr_prefix = "frp2{$i}";
|
384
|
$fr_header = $fr_prefix . "header";
|
385
|
?>
|
386
|
<button class="btn btn-info" type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+"><i class="fa fa-plus-circle"></i> <?php printf(gettext("Show Phase 2 Entries (%s)"), $phase2count); ?></button>
|
387
|
</div>
|
388
|
<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
|
389
|
<table class="table table-striped table-hover">
|
390
|
<thead>
|
391
|
<tr>
|
392
|
<th> </th>
|
393
|
<th> </th>
|
394
|
<th><?=gettext("Mode"); ?></th>
|
395
|
<th><?=gettext("Local Subnet"); ?></th>
|
396
|
<th><?=gettext("Remote Subnet"); ?></th>
|
397
|
<th><?=gettext("P2 Protocol"); ?></th>
|
398
|
<th><?=gettext("P2 Transforms"); ?></th>
|
399
|
<th><?=gettext("P2 Auth Methods"); ?></th>
|
400
|
<th><?=gettext("P2 actions")?></th>
|
401
|
</tr>
|
402
|
</thead>
|
403
|
<tbody class="p2-entries">
|
404
|
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
|
405
|
<?php
|
406
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
|
407
|
continue;
|
408
|
}
|
409
|
|
410
|
$fr_c = $fr_prefix . "c" . $j;
|
411
|
$fr_d = $fr_prefix . "d" . $j;
|
412
|
|
413
|
$iconfn = "pass";
|
414
|
$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
415
|
|
416
|
if ($entryStatus == 'disabled') {
|
417
|
$iconfn .= "_d";
|
418
|
}
|
419
|
?>
|
420
|
<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
|
421
|
<td>
|
422
|
<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
|
423
|
<button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button>
|
424
|
</td>
|
425
|
<td>
|
426
|
<button value="togglep2_<?=$ph2index?>" name="togglep2_<?=$ph2index?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-<?= ($entryStatus == 'disabled'? 'success' : 'warning') ?>" type="submit"><?= ($entryStatus == 'disabled'? 'Enable' : 'Disable') ?></button>
|
427
|
</td>
|
428
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
429
|
<?=$ph2ent['mode']?>
|
430
|
</td>
|
431
|
<?php if (($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
|
432
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
433
|
<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
|
434
|
</td>
|
435
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
436
|
<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
|
437
|
</td>
|
438
|
<?php else: ?>
|
439
|
<td colspan="2"></td>
|
440
|
<?php endif; ?>
|
441
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
442
|
<?=$p2_protos[$ph2ent['protocol']]; ?>
|
443
|
</td>
|
444
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
445
|
<?php
|
446
|
foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
|
447
|
if ($k) {
|
448
|
echo ", ";
|
449
|
}
|
450
|
echo $p2_ealgos[$ph2ea['name']]['name'];
|
451
|
if ($ph2ea['keylen']) {
|
452
|
if ($ph2ea['keylen'] == "auto") {
|
453
|
echo " (" . gettext("auto") . ")";
|
454
|
} else {
|
455
|
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
|
456
|
}
|
457
|
}
|
458
|
}
|
459
|
?>
|
460
|
</td>
|
461
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
462
|
<?php
|
463
|
if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
|
464
|
foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
|
465
|
if ($k) {
|
466
|
echo ", ";
|
467
|
}
|
468
|
echo $p2_halgos[$ph2ha];
|
469
|
}
|
470
|
}
|
471
|
?>
|
472
|
</td>
|
473
|
<td style="cursor: pointer;">
|
474
|
<!-- <button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button> -->
|
475
|
<a class="fa fa-pencil" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("Edit phase2 entry"); ?>"></a>
|
476
|
<a class="fa fa-clone" href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']?>" title="<?=gettext("Add a new Phase 2 based on this one"); ?>"></a>
|
477
|
<a class="fa fa-trash no-confirm" id="Xdelp2_<?=$ph2index?>" title="<?=gettext('Delete phase2 entry'); ?>"></a>
|
478
|
<button style="display: none;" class="btn btn-xs btn-warning" type="submit" id="delp2_<?=$ph2index?>" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button>
|
479
|
</td>
|
480
|
</tr>
|
481
|
<?php $j++; endforeach; ?>
|
482
|
<tr>
|
483
|
<td></td>
|
484
|
<td>
|
485
|
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid']?><?php if (isset($ph1ent['mobile'])) echo "&mobile=true"?>">
|
486
|
<i class="fa fa-plus icon-embed-btn"></i>
|
487
|
<?=gettext("Add P2")?>
|
488
|
</a>
|
489
|
</td>
|
490
|
<td colspan="7"></td>
|
491
|
</tr>
|
492
|
</tbody>
|
493
|
</table>
|
494
|
</div>
|
495
|
</td>
|
496
|
</tr>
|
497
|
<?php
|
498
|
$i++;
|
499
|
endforeach; // $a_phase1 as $ph1ent
|
500
|
?>
|
501
|
</tbody>
|
502
|
</table>
|
503
|
</div>
|
504
|
</div>
|
505
|
|
506
|
<nav class="action-buttons">
|
507
|
<?php
|
508
|
/*
|
509
|
if ($i !== 0): ?>
|
510
|
<input type="submit" name="move_<?=$i?>" class="btn btn-default" value="<?=gettext("move selected phase1 entries to end")?>" />
|
511
|
<?php endif;
|
512
|
*/
|
513
|
?>
|
514
|
<a href="vpn_ipsec_phase1.php" class="btn btn-success btn-sm">
|
515
|
<i class="fa fa-plus icon-embed-btn"></i>
|
516
|
<?=gettext("Add P1")?>
|
517
|
</a>
|
518
|
<?php if ($i !== 0): ?>
|
519
|
<button type="submit" name="del" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected P1s")?>">
|
520
|
<i class="fa fa-trash icon-embed-btn"></i>
|
521
|
<?=gettext("Delete P1s")?>
|
522
|
</button>
|
523
|
<?php endif; ?>
|
524
|
</nav>
|
525
|
</form>
|
526
|
|
527
|
<div class="infoblock">
|
528
|
<?php print_info_box(sprintf(gettext('The IPsec status can be checked at %1$s%2$s%3$s.'), '<a href="status_ipsec.php">', gettext("Status:IPsec"), '</a>') . '<br />' .
|
529
|
sprintf(gettext('IPsec debug mode can be enabled at %1$s%2$s%3$s.'), '<a href="vpn_ipsec_settings.php">', gettext("VPN:IPsec:Advanced Settings"), '</a>') . '<br />' .
|
530
|
sprintf(gettext('IPsec can be set to prefer older SAs at %1$s%2$s%3$s.'), '<a href="vpn_ipsec_settings.php">', gettext("VPN:IPsec:Advanced Settings"), '</a>'), 'info', false); ?>
|
531
|
</div>
|
532
|
|
533
|
<script type="text/javascript">
|
534
|
//<![CDATA[
|
535
|
function show_phase2(id, buttonid) {
|
536
|
document.getElementById(buttonid).innerHTML='';
|
537
|
document.getElementById(id).style.display = "block";
|
538
|
var visible = id + '-visible';
|
539
|
document.getElementById(visible).value = "1";
|
540
|
}
|
541
|
|
542
|
events.push(function() {
|
543
|
$('[id^=Xmove_]').click(function (event) {
|
544
|
// ToDo: We POST shift="yes" if the user has the shift key depressed, but that is not yet used
|
545
|
// by the $_POST code. It is intended to allow the user to choose to move stuff to the row before or
|
546
|
// after the clicked anchor icon
|
547
|
if (event.shiftKey) {
|
548
|
$('form').append('<input type="hidden" id="shift" name="shift" value="yes" />');
|
549
|
}
|
550
|
|
551
|
$('#' + event.target.id.slice(1)).click();
|
552
|
});
|
553
|
|
554
|
$('[id^=Xdel_]').click(function (event) {
|
555
|
if (confirm("<?=gettext('Confirmation required to delete this P1 entry.')?>")) {
|
556
|
$('#' + event.target.id.slice(1)).click();
|
557
|
}
|
558
|
});
|
559
|
|
560
|
$('[id^=Xdelp2_]').click(function (event) {
|
561
|
if (confirm("<?=gettext('Confirmation required to delete this P2 entry.')?>")) {
|
562
|
$('#' + event.target.id.slice(1)).click();
|
563
|
}
|
564
|
});
|
565
|
});
|
566
|
//]]>
|
567
|
</script>
|
568
|
|
569
|
<?php
|
570
|
include("foot.inc");
|