1
|
<?php
|
2
|
/*
|
3
|
vpn_ipsec.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
* Copyright (c) 2004, 2005 Scott Ullrich
|
8
|
Copyright (c) 2003-2005 Manuel Kasper <mk@neon1.net>
|
9
|
*
|
10
|
* Redistribution and use in source and binary forms, with or without modification,
|
11
|
* are permitted provided that the following conditions are met:
|
12
|
*
|
13
|
* 1. Redistributions of source code must retain the above copyright notice,
|
14
|
* this list of conditions and the following disclaimer.
|
15
|
*
|
16
|
* 2. Redistributions in binary form must reproduce the above copyright
|
17
|
* notice, this list of conditions and the following disclaimer in
|
18
|
* the documentation and/or other materials provided with the
|
19
|
* distribution.
|
20
|
*
|
21
|
* 3. All advertising materials mentioning features or use of this software
|
22
|
* must display the following acknowledgment:
|
23
|
* "This product includes software developed by the pfSense Project
|
24
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
25
|
*
|
26
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
27
|
* endorse or promote products derived from this software without
|
28
|
* prior written permission. For written permission, please contact
|
29
|
* coreteam@pfsense.org.
|
30
|
*
|
31
|
* 5. Products derived from this software may not be called "pfSense"
|
32
|
* nor may "pfSense" appear in their names without prior written
|
33
|
* permission of the Electric Sheep Fencing, LLC.
|
34
|
*
|
35
|
* 6. Redistributions of any form whatsoever must retain the following
|
36
|
* acknowledgment:
|
37
|
*
|
38
|
* "This product includes software developed by the pfSense Project
|
39
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
40
|
*
|
41
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
42
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
43
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
44
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
45
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
46
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
47
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
48
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
49
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
50
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
51
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
52
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
53
|
*
|
54
|
* ====================================================================
|
55
|
*
|
56
|
*/
|
57
|
|
58
|
##|+PRIV
|
59
|
##|*IDENT=page-vpn-ipsec
|
60
|
##|*NAME=VPN: IPsec page
|
61
|
##|*DESCR=Allow access to the 'VPN: IPsec' page.
|
62
|
##|*MATCH=vpn_ipsec.php*
|
63
|
##|-PRIV
|
64
|
|
65
|
require("guiconfig.inc");
|
66
|
require_once("functions.inc");
|
67
|
require_once("filter.inc");
|
68
|
require_once("shaper.inc");
|
69
|
require_once("ipsec.inc");
|
70
|
require_once("vpn.inc");
|
71
|
|
72
|
if (!is_array($config['ipsec']['phase1'])) {
|
73
|
$config['ipsec']['phase1'] = array();
|
74
|
}
|
75
|
|
76
|
if (!is_array($config['ipsec']['phase2'])) {
|
77
|
$config['ipsec']['phase2'] = array();
|
78
|
}
|
79
|
|
80
|
$a_phase1 = &$config['ipsec']['phase1'];
|
81
|
$a_phase2 = &$config['ipsec']['phase2'];
|
82
|
|
83
|
$pconfig['enable'] = isset($config['ipsec']['enable']);
|
84
|
|
85
|
if ($_POST) {
|
86
|
if ($_POST['apply']) {
|
87
|
$retval = 0;
|
88
|
$retval = vpn_ipsec_configure();
|
89
|
/* reload the filter in the background */
|
90
|
filter_configure();
|
91
|
$savemsg = get_std_save_message($retval);
|
92
|
if ($retval >= 0) {
|
93
|
if (is_subsystem_dirty('ipsec')) {
|
94
|
clear_subsystem_dirty('ipsec');
|
95
|
}
|
96
|
}
|
97
|
} else if ($_POST['submit'] == 'Save') {
|
98
|
$pconfig = $_POST;
|
99
|
|
100
|
$config['ipsec']['enable'] = $_POST['enable'] ? true : false;
|
101
|
|
102
|
write_config();
|
103
|
|
104
|
$retval = vpn_ipsec_configure();
|
105
|
} else if (isset($_POST['del'])) {
|
106
|
/* delete selected p1 entries */
|
107
|
if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
108
|
foreach ($_POST['p1entry'] as $p1entrydel) {
|
109
|
unset($a_phase1[$p1entrydel]);
|
110
|
}
|
111
|
if (write_config()) {
|
112
|
mark_subsystem_dirty('ipsec');
|
113
|
}
|
114
|
}
|
115
|
} else if (isset($_POST['delp2'])) {
|
116
|
/* delete selected p2 entries */
|
117
|
if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
118
|
foreach ($_POST['p2entry'] as $p2entrydel) {
|
119
|
unset($a_phase2[$p2entrydel]);
|
120
|
}
|
121
|
if (write_config()) {
|
122
|
mark_subsystem_dirty('ipsec');
|
123
|
}
|
124
|
}
|
125
|
} else {
|
126
|
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
|
127
|
|
128
|
// TODO: this. is. nasty.
|
129
|
unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
|
130
|
foreach ($_POST as $pn => $pd) {
|
131
|
if (preg_match("/del_(\d+)/", $pn, $matches)) {
|
132
|
$delbtn = $matches[1];
|
133
|
} else if (preg_match("/delp2_(\d+)/", $pn, $matches)) {
|
134
|
$delbtnp2 = $matches[1];
|
135
|
} else if (preg_match("/move_(\d+)/", $pn, $matches)) {
|
136
|
$movebtn = $matches[1];
|
137
|
} else if (preg_match("/movep2_(\d+)/", $pn, $matches)) {
|
138
|
$movebtnp2 = $matches[1];
|
139
|
} else if (preg_match("/toggle_(\d+)/", $pn, $matches)) {
|
140
|
$togglebtn = $matches[1];
|
141
|
} else if (preg_match("/togglep2_(\d+)/", $pn, $matches)) {
|
142
|
$togglebtnp2 = $matches[1];
|
143
|
}
|
144
|
}
|
145
|
|
146
|
$save = 1;
|
147
|
|
148
|
/* move selected p1 entries before this */
|
149
|
if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
150
|
$a_phase1_new = array();
|
151
|
|
152
|
/* copy all p1 entries < $movebtn and not selected */
|
153
|
for ($i = 0; $i < $movebtn; $i++) {
|
154
|
if (!in_array($i, $_POST['p1entry'])) {
|
155
|
$a_phase1_new[] = $a_phase1[$i];
|
156
|
}
|
157
|
}
|
158
|
|
159
|
/* copy all selected p1 entries */
|
160
|
for ($i = 0; $i < count($a_phase1); $i++) {
|
161
|
if ($i == $movebtn) {
|
162
|
continue;
|
163
|
}
|
164
|
if (in_array($i, $_POST['p1entry'])) {
|
165
|
$a_phase1_new[] = $a_phase1[$i];
|
166
|
}
|
167
|
}
|
168
|
|
169
|
/* copy $movebtn p1 entry */
|
170
|
if ($movebtn < count($a_phase1)) {
|
171
|
$a_phase1_new[] = $a_phase1[$movebtn];
|
172
|
}
|
173
|
|
174
|
/* copy all p1 entries > $movebtn and not selected */
|
175
|
for ($i = $movebtn+1; $i < count($a_phase1); $i++) {
|
176
|
if (!in_array($i, $_POST['p1entry'])) {
|
177
|
$a_phase1_new[] = $a_phase1[$i];
|
178
|
}
|
179
|
}
|
180
|
if (count($a_phase1_new) > 0) {
|
181
|
$a_phase1 = $a_phase1_new;
|
182
|
}
|
183
|
|
184
|
} else if (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
185
|
/* move selected p2 entries before this */
|
186
|
$a_phase2_new = array();
|
187
|
|
188
|
/* copy all p2 entries < $movebtnp2 and not selected */
|
189
|
for ($i = 0; $i < $movebtnp2; $i++) {
|
190
|
if (!in_array($i, $_POST['p2entry'])) {
|
191
|
$a_phase2_new[] = $a_phase2[$i];
|
192
|
}
|
193
|
}
|
194
|
|
195
|
/* copy all selected p2 entries */
|
196
|
for ($i = 0; $i < count($a_phase2); $i++) {
|
197
|
if ($i == $movebtnp2) {
|
198
|
continue;
|
199
|
}
|
200
|
if (in_array($i, $_POST['p2entry'])) {
|
201
|
$a_phase2_new[] = $a_phase2[$i];
|
202
|
}
|
203
|
}
|
204
|
|
205
|
/* copy $movebtnp2 p2 entry */
|
206
|
if ($movebtnp2 < count($a_phase2)) {
|
207
|
$a_phase2_new[] = $a_phase2[$movebtnp2];
|
208
|
}
|
209
|
|
210
|
/* copy all p2 entries > $movebtnp2 and not selected */
|
211
|
for ($i = $movebtnp2+1; $i < count($a_phase2); $i++) {
|
212
|
if (!in_array($i, $_POST['p2entry'])) {
|
213
|
$a_phase2_new[] = $a_phase2[$i];
|
214
|
}
|
215
|
}
|
216
|
if (count($a_phase2_new) > 0) {
|
217
|
$a_phase2 = $a_phase2_new;
|
218
|
}
|
219
|
|
220
|
} else if (isset($togglebtn)) {
|
221
|
if (isset($a_phase1[$togglebtn]['disabled'])) {
|
222
|
unset($a_phase1[$togglebtn]['disabled']);
|
223
|
} else {
|
224
|
$a_phase1[$togglebtn]['disabled'] = true;
|
225
|
}
|
226
|
} else if (isset($togglebtnp2)) {
|
227
|
if (isset($a_phase2[$togglebtnp2]['disabled'])) {
|
228
|
unset($a_phase2[$togglebtnp2]['disabled']);
|
229
|
} else {
|
230
|
$a_phase2[$togglebtnp2]['disabled'] = true;
|
231
|
}
|
232
|
} else if (isset($delbtn)) {
|
233
|
/* remove static route if interface is not WAN */
|
234
|
if ($a_phase1[$delbtn]['interface'] <> "wan") {
|
235
|
mwexec("/sbin/route delete -host {$a_phase1[$delbtn]['remote-gateway']}");
|
236
|
}
|
237
|
|
238
|
/* remove all phase2 entries that match the ikeid */
|
239
|
$ikeid = $a_phase1[$delbtn]['ikeid'];
|
240
|
foreach ($a_phase2 as $p2index => $ph2tmp) {
|
241
|
if ($ph2tmp['ikeid'] == $ikeid) {
|
242
|
unset($a_phase2[$p2index]);
|
243
|
}
|
244
|
}
|
245
|
unset($a_phase1[$delbtn]);
|
246
|
|
247
|
} else if (isset($delbtnp2)) {
|
248
|
unset($a_phase2[$delbtnp2]);
|
249
|
|
250
|
} else {
|
251
|
$save = 0;
|
252
|
}
|
253
|
|
254
|
if ($save === 1) {
|
255
|
if (write_config()) {
|
256
|
mark_subsystem_dirty('ipsec');
|
257
|
}
|
258
|
}
|
259
|
}
|
260
|
}
|
261
|
|
262
|
$pgtitle = array(gettext("VPN"), gettext("IPsec"));
|
263
|
$shortcut_section = "ipsec";
|
264
|
|
265
|
include("head.inc");
|
266
|
|
267
|
$tab_array = array();
|
268
|
$tab_array[] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
|
269
|
$tab_array[] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
270
|
$tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
|
271
|
$tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
|
272
|
display_top_tabs($tab_array);
|
273
|
?>
|
274
|
|
275
|
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
|
276
|
|
277
|
<?php
|
278
|
if ($savemsg) {
|
279
|
print_info_box($savemsg, 'success');
|
280
|
}
|
281
|
|
282
|
if ($pconfig['enable'] && is_subsystem_dirty('ipsec')) {
|
283
|
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
|
284
|
}
|
285
|
?>
|
286
|
|
287
|
<form method="post">
|
288
|
<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\"";?> /> <?=gettext("Enable IPsec")?><br /><br />
|
289
|
<input name="submit" type="submit" class="btn btn-sm btn-primary" value="<?=gettext("Save"); ?>" /><br /><br />
|
290
|
|
291
|
<div class="panel panel-default">
|
292
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('IPSec tunnels')?></h2></div>
|
293
|
<div class="panel-body table-responsive">
|
294
|
<table class="table table-striped table-hover">
|
295
|
<thead>
|
296
|
<tr>
|
297
|
<th> </th>
|
298
|
<th> </th>
|
299
|
<th><?=gettext("IKE"); ?></th>
|
300
|
<th><?=gettext("Remote Gateway"); ?></th>
|
301
|
<th><?=gettext("Mode"); ?></th>
|
302
|
<th><?=gettext("P1 Protocol"); ?></th>
|
303
|
<th><?=gettext("P1 Transforms"); ?></th>
|
304
|
<th><?=gettext("P1 Description"); ?></th>
|
305
|
<th></th>
|
306
|
</tr>
|
307
|
</thead>
|
308
|
<tbody>
|
309
|
<?php $i = 0; foreach ($a_phase1 as $ph1ent): ?>
|
310
|
<?php
|
311
|
$iconfn = "pass";
|
312
|
|
313
|
$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
314
|
|
315
|
if ($entryStatus == 'disabled') {
|
316
|
$iconfn .= "_d";
|
317
|
}
|
318
|
?>
|
319
|
<tr id="fr<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
|
320
|
<td>
|
321
|
<input type="checkbox" id="frc<?=$i?>" name="p1entry[]" value="<?=$i?>" onclick="fr_bgcolor('<?=$i?>')" />
|
322
|
</td>
|
323
|
<td>
|
324
|
<button value="toggle_<?=$i?>" name="toggle_<?=$i?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-default" type="submit"><?= ($entryStatus == 'disabled' ? 'enable' : 'disable') ?></button>
|
325
|
</td>
|
326
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
327
|
<?php
|
328
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
|
329
|
echo "V1";
|
330
|
else
|
331
|
echo "V2";
|
332
|
?>
|
333
|
</td>
|
334
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
335
|
<?php
|
336
|
if ($ph1ent['interface']) {
|
337
|
$iflabels = get_configured_interface_with_descr();
|
338
|
|
339
|
$carplist = get_configured_carp_interface_list();
|
340
|
foreach ($carplist as $cif => $carpip)
|
341
|
$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
|
342
|
|
343
|
$aliaslist = get_configured_ip_aliases_list();
|
344
|
foreach ($aliaslist as $aliasip => $aliasif)
|
345
|
$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
346
|
|
347
|
$grouplist = return_gateway_groups_array();
|
348
|
foreach ($grouplist as $name => $group) {
|
349
|
if($group[0]['vip'] != "")
|
350
|
$vipif = $group[0]['vip'];
|
351
|
else
|
352
|
$vipif = $group[0]['int'];
|
353
|
$iflabels[$name] = "GW Group {$name}";
|
354
|
}
|
355
|
$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
|
356
|
}
|
357
|
else
|
358
|
$if = "WAN";
|
359
|
|
360
|
if (!isset($ph1ent['mobile']))
|
361
|
echo $if."<br />".$ph1ent['remote-gateway'];
|
362
|
else
|
363
|
echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
|
364
|
?>
|
365
|
</td>
|
366
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
367
|
<?=$spans?>
|
368
|
<?php
|
369
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
|
370
|
echo "{$ph1ent['mode']}";
|
371
|
?>
|
372
|
<?=$spane?>
|
373
|
</td>
|
374
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
375
|
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name']?>
|
376
|
<?php
|
377
|
if ($ph1ent['encryption-algorithm']['keylen']) {
|
378
|
if ($ph1ent['encryption-algorithm']['keylen']=="auto")
|
379
|
echo " (" . gettext("auto") . ")";
|
380
|
else
|
381
|
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
|
382
|
}
|
383
|
?>
|
384
|
</td>
|
385
|
<td>
|
386
|
<?=$p1_halgos[$ph1ent['hash-algorithm']]?>
|
387
|
</td>
|
388
|
<td>
|
389
|
<?=htmlspecialchars($ph1ent['descr'])?>
|
390
|
</td>
|
391
|
<td>
|
392
|
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
|
393
|
<button class="btn btn-xs btn-default" type="submit" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("move selected entries before this")?></button>
|
394
|
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("edit phase1 entry"); ?>">edit</a>
|
395
|
<button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>">delete</button>
|
396
|
<?php if (!isset($ph1ent['mobile'])): ?>
|
397
|
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("copy phase1 entry"); ?>">copy</a>
|
398
|
<?php endif; ?>
|
399
|
</td>
|
400
|
</tr>
|
401
|
<tr class="<?= $entryStatus ?>">
|
402
|
<td colspan="2"></td>
|
403
|
<td colspan="7" class="contains-table">
|
404
|
<?php
|
405
|
if (isset($_POST["tdph2-{$i}-visible"]))
|
406
|
$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
|
407
|
else
|
408
|
$tdph2_visible = 0;
|
409
|
?>
|
410
|
<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
|
411
|
<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
|
412
|
<?php
|
413
|
$phase2count=0;
|
414
|
|
415
|
foreach ($a_phase2 as $ph2ent) {
|
416
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
|
417
|
continue;
|
418
|
$phase2count++;
|
419
|
}
|
420
|
$fr_prefix = "frp2{$i}";
|
421
|
$fr_header = $fr_prefix . "header";
|
422
|
?>
|
423
|
<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
|
424
|
</div>
|
425
|
<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
|
426
|
<table class="table table-striped table-hover">
|
427
|
<thead>
|
428
|
<tr>
|
429
|
<th> </th>
|
430
|
<th> </th>
|
431
|
<th><?=gettext("Mode"); ?></th>
|
432
|
<th><?=gettext("Local Subnet"); ?></th>
|
433
|
<th><?=gettext("Remote Subnet"); ?></th>
|
434
|
<th><?=gettext("P2 Protocol"); ?></th>
|
435
|
<th><?=gettext("P2 Transforms"); ?></th>
|
436
|
<th><?=gettext("P2 Auth Methods"); ?></th>
|
437
|
<th> </th>
|
438
|
</tr>
|
439
|
</thead>
|
440
|
<tbody>
|
441
|
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
|
442
|
<?php
|
443
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
|
444
|
continue;
|
445
|
|
446
|
$fr_c = $fr_prefix . "c" . $j;
|
447
|
$fr_d = $fr_prefix . "d" . $j;
|
448
|
|
449
|
$iconfn = "pass";
|
450
|
$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
451
|
|
452
|
if ($entryStatus == 'disabled')
|
453
|
$iconfn .= "_d";
|
454
|
|
455
|
?>
|
456
|
<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
|
457
|
<td>
|
458
|
<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
|
459
|
</td>
|
460
|
<td>
|
461
|
<button value="togglep2_<?=$ph2index?>" name="togglep2_<?=$ph2index?>" title="<?=gettext("click to toggle enabled/disabled status")?>" class="btn btn-xs btn-default" type="submit"><?= ($entryStatus == 'disabled'? 'enable' : 'disable') ?></button>
|
462
|
</td>
|
463
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
464
|
<?=$ph2ent['mode']?>
|
465
|
</td>
|
466
|
<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
|
467
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
468
|
<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
|
469
|
</td>
|
470
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
471
|
<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
|
472
|
</td>
|
473
|
<?php else: ?>
|
474
|
<td colspan="2"></td>
|
475
|
<?php endif; ?>
|
476
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
477
|
<?=$p2_protos[$ph2ent['protocol']]; ?>
|
478
|
</td>
|
479
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
480
|
<?php
|
481
|
foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
|
482
|
if ($k)
|
483
|
echo ", ";
|
484
|
echo $p2_ealgos[$ph2ea['name']]['name'];
|
485
|
if ($ph2ea['keylen']) {
|
486
|
if ($ph2ea['keylen']=="auto")
|
487
|
echo " (" . gettext("auto") . ")";
|
488
|
else
|
489
|
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
|
490
|
}
|
491
|
}
|
492
|
?>
|
493
|
</td>
|
494
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
495
|
<?php
|
496
|
if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
|
497
|
foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
|
498
|
if ($k)
|
499
|
echo ", ";
|
500
|
echo $p2_halgos[$ph2ha];
|
501
|
}
|
502
|
}
|
503
|
?>
|
504
|
</td>
|
505
|
<td>
|
506
|
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
|
507
|
<button class="btn btn-xs btn-default" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>"><?=gettext("move selected entries before this")?></button>
|
508
|
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("edit phase2 entry"); ?>">edit</a>
|
509
|
<button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button>
|
510
|
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']?>" title="<?=gettext("add a new Phase 2 based on this one"); ?>">copy</a>
|
511
|
</td>
|
512
|
</tr>
|
513
|
<?php $j++; endforeach; ?>
|
514
|
<tr>
|
515
|
<td colspan="8"></td>
|
516
|
<td>
|
517
|
<?php
|
518
|
if ($j == 0):
|
519
|
?>
|
520
|
<i class="icon icon-arrow-down" title="<?=gettext("move selected phase2 entries to end")?>" alt="move"></i>
|
521
|
<?php
|
522
|
else:
|
523
|
?>
|
524
|
<i class="icon icon-arrow-down" name="movep2_<?=$j?>" onmouseover="fr_insline(<?=$j?>, true, '<?=$fr_prefix?>')" onmouseout="fr_insline(<?=$j?>, false, '<?=$fr_prefix?>')" title="<?=gettext("move selected phase2 entries to end")?>" alt="move"></i>
|
525
|
<?php
|
526
|
endif;
|
527
|
?>
|
528
|
<a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid']?><?php if (isset($ph1ent['mobile'])) echo "&mobile=true"?>">
|
529
|
<i class="icon icon-plus-sign" title="<?=gettext("add phase2 entry"); ?>" alt="add"></i>
|
530
|
</a>
|
531
|
<?php
|
532
|
if ($j == 0):
|
533
|
?>
|
534
|
<i class="icon icon-remove-sign" title="<?=gettext("delete selected phase2 entries")?>" alt="delete"></i>
|
535
|
<?php
|
536
|
else:
|
537
|
?>
|
538
|
<i name="delp2" class="icon icon-remove-sign" title="<?=gettext("delete selected phase2 entries")?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected phase2 entries?")?>')"></i>
|
539
|
<?php
|
540
|
endif;
|
541
|
?>
|
542
|
</td>
|
543
|
</tr>
|
544
|
</tbody>
|
545
|
</table>
|
546
|
</div>
|
547
|
</td>
|
548
|
</tr>
|
549
|
<?php
|
550
|
$i++;
|
551
|
endforeach; // $a_phase1 as $ph1ent
|
552
|
?>
|
553
|
</tbody>
|
554
|
</table>
|
555
|
</div>
|
556
|
</div>
|
557
|
|
558
|
<nav class="action-buttons">
|
559
|
<?php if ($i !== 0): ?>
|
560
|
<input type="submit" name="move_<?=$i?>" class="btn btn-default" value="<?=gettext("move selected phase1 entries to end")?>" />
|
561
|
<?php endif; ?>
|
562
|
<a href="vpn_ipsec_phase1.php" class="btn btn-success"><?=gettext("add new phase1")?></a>
|
563
|
<?php if ($i !== 0): ?>
|
564
|
<input type="submit" name="del" class="btn btn-danger" value="<?=gettext("delete selected phase1 entries")?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected phase1 entries?")?>')" />
|
565
|
<?php endif; ?>
|
566
|
</nav>
|
567
|
</form>
|
568
|
|
569
|
<div class="alert alert-info">
|
570
|
<strong><?=gettext("Note:")?></strong><br />
|
571
|
<?=gettext("You can check your IPsec status at"); ?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br />
|
572
|
<?=gettext("IPsec Debug Mode can be enabled at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.<br />
|
573
|
<?=gettext("IPsec can be set to prefer older SAs at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.
|
574
|
</div>
|
575
|
|
576
|
<?php include("foot.inc"); ?>
|
577
|
<script type="text/javascript">
|
578
|
//<![CDATA[
|
579
|
function show_phase2(id, buttonid) {
|
580
|
document.getElementById(buttonid).innerHTML='';
|
581
|
document.getElementById(id).style.display = "block";
|
582
|
var visible = id + '-visible';
|
583
|
document.getElementById(visible).value = "1";
|
584
|
}
|
585
|
//]]>
|
586
|
</script>
|