1
|
<?php
|
2
|
/*
|
3
|
vpn_ipsec.php
|
4
|
part of m0n0wall (http://m0n0.ch/wall)
|
5
|
part of pfSense
|
6
|
|
7
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
8
|
Copyright (C) 2008 Shrew Soft Inc
|
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
|
36
|
##|*NAME=VPN: IPsec page
|
37
|
##|*DESCR=Allow access to the 'VPN: IPsec' page.
|
38
|
##|*MATCH=vpn_ipsec.php*
|
39
|
##|-PRIV
|
40
|
|
41
|
require("guiconfig.inc");
|
42
|
require_once("functions.inc");
|
43
|
require_once("filter.inc");
|
44
|
require_once("shaper.inc");
|
45
|
require_once("ipsec.inc");
|
46
|
require_once("vpn.inc");
|
47
|
|
48
|
if (!is_array($config['ipsec']['phase1']))
|
49
|
$config['ipsec']['phase1'] = array();
|
50
|
|
51
|
if (!is_array($config['ipsec']['phase2']))
|
52
|
$config['ipsec']['phase2'] = array();
|
53
|
|
54
|
$a_phase1 = &$config['ipsec']['phase1'];
|
55
|
$a_phase2 = &$config['ipsec']['phase2'];
|
56
|
|
57
|
$pconfig['enable'] = isset($config['ipsec']['enable']);
|
58
|
|
59
|
if ($_POST) {
|
60
|
if ($_POST['apply']) {
|
61
|
$retval = 0;
|
62
|
$retval = vpn_ipsec_configure();
|
63
|
/* reload the filter in the background */
|
64
|
filter_configure();
|
65
|
$savemsg = get_std_save_message($retval);
|
66
|
if ($retval >= 0) {
|
67
|
if (is_subsystem_dirty('ipsec'))
|
68
|
clear_subsystem_dirty('ipsec');
|
69
|
}
|
70
|
} else if ($_POST['save']) {
|
71
|
$pconfig = $_POST;
|
72
|
|
73
|
$config['ipsec']['enable'] = $_POST['enable'] ? true : false;
|
74
|
|
75
|
write_config();
|
76
|
|
77
|
$retval = vpn_ipsec_configure();
|
78
|
} else if (isset($_POST['del_x'])) {
|
79
|
/* delete selected p1 entries */
|
80
|
if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
81
|
foreach ($_POST['p1entry'] as $p1entrydel) {
|
82
|
unset($a_phase1[$p1entrydel]);
|
83
|
}
|
84
|
if (write_config())
|
85
|
mark_subsystem_dirty('ipsec');
|
86
|
}
|
87
|
} else if (isset($_POST['delp2_x'])) {
|
88
|
/* delete selected p2 entries */
|
89
|
if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
90
|
foreach ($_POST['p2entry'] as $p2entrydel) {
|
91
|
unset($a_phase2[$p2entrydel]);
|
92
|
}
|
93
|
if (write_config())
|
94
|
mark_subsystem_dirty('ipsec');
|
95
|
}
|
96
|
} else {
|
97
|
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
|
98
|
|
99
|
// TODO: this. is. nasty.
|
100
|
unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
|
101
|
foreach ($_POST as $pn => $pd) {
|
102
|
if (preg_match("/del_(\d+)/", $pn, $matches)) {
|
103
|
$delbtn = $matches[1];
|
104
|
} else if (preg_match("/delp2_(\d+)/", $pn, $matches)) {
|
105
|
$delbtnp2 = $matches[1];
|
106
|
} else if (preg_match("/move_(\d+)/", $pn, $matches)) {
|
107
|
$movebtn = $matches[1];
|
108
|
} else if (preg_match("/movep2_(\d+)/", $pn, $matches)) {
|
109
|
$movebtnp2 = $matches[1];
|
110
|
} else if (preg_match("/toggle_(\d+)/", $pn, $matches)) {
|
111
|
$togglebtn = $matches[1];
|
112
|
} else if (preg_match("/togglep2_(\d+)/", $pn, $matches)) {
|
113
|
$togglebtnp2 = $matches[1];
|
114
|
}
|
115
|
}
|
116
|
|
117
|
$save = 1;
|
118
|
|
119
|
/* move selected p1 entries before this */
|
120
|
if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
|
121
|
$a_phase1_new = array();
|
122
|
|
123
|
/* copy all p1 entries < $movebtn and not selected */
|
124
|
for ($i = 0; $i < $movebtn; $i++) {
|
125
|
if (!in_array($i, $_POST['p1entry']))
|
126
|
$a_phase1_new[] = $a_phase1[$i];
|
127
|
}
|
128
|
|
129
|
/* copy all selected p1 entries */
|
130
|
for ($i = 0; $i < count($a_phase1); $i++) {
|
131
|
if ($i == $movebtn)
|
132
|
continue;
|
133
|
if (in_array($i, $_POST['p1entry']))
|
134
|
$a_phase1_new[] = $a_phase1[$i];
|
135
|
}
|
136
|
|
137
|
/* copy $movebtn p1 entry */
|
138
|
if ($movebtn < count($a_phase1))
|
139
|
$a_phase1_new[] = $a_phase1[$movebtn];
|
140
|
|
141
|
/* copy all p1 entries > $movebtn and not selected */
|
142
|
for ($i = $movebtn+1; $i < count($a_phase1); $i++) {
|
143
|
if (!in_array($i, $_POST['p1entry']))
|
144
|
$a_phase1_new[] = $a_phase1[$i];
|
145
|
}
|
146
|
if (count($a_phase1_new) > 0)
|
147
|
$a_phase1 = $a_phase1_new;
|
148
|
|
149
|
} else if (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
|
150
|
/* move selected p2 entries before this */
|
151
|
$a_phase2_new = array();
|
152
|
|
153
|
/* copy all p2 entries < $movebtnp2 and not selected */
|
154
|
for ($i = 0; $i < $movebtnp2; $i++) {
|
155
|
if (!in_array($i, $_POST['p2entry']))
|
156
|
$a_phase2_new[] = $a_phase2[$i];
|
157
|
}
|
158
|
|
159
|
/* copy all selected p2 entries */
|
160
|
for ($i = 0; $i < count($a_phase2); $i++) {
|
161
|
if ($i == $movebtnp2)
|
162
|
continue;
|
163
|
if (in_array($i, $_POST['p2entry']))
|
164
|
$a_phase2_new[] = $a_phase2[$i];
|
165
|
}
|
166
|
|
167
|
/* copy $movebtnp2 p2 entry */
|
168
|
if ($movebtnp2 < count($a_phase2))
|
169
|
$a_phase2_new[] = $a_phase2[$movebtnp2];
|
170
|
|
171
|
/* copy all p2 entries > $movebtnp2 and not selected */
|
172
|
for ($i = $movebtnp2+1; $i < count($a_phase2); $i++) {
|
173
|
if (!in_array($i, $_POST['p2entry']))
|
174
|
$a_phase2_new[] = $a_phase2[$i];
|
175
|
}
|
176
|
if (count($a_phase2_new) > 0)
|
177
|
$a_phase2 = $a_phase2_new;
|
178
|
|
179
|
} else if (isset($togglebtn)) {
|
180
|
if (isset($a_phase1[$togglebtn]['disabled']))
|
181
|
unset($a_phase1[$togglebtn]['disabled']);
|
182
|
else
|
183
|
$a_phase1[$togglebtn]['disabled'] = true;
|
184
|
|
185
|
} else if (isset($togglebtnp2)) {
|
186
|
if (isset($a_phase2[$togglebtnp2]['disabled']))
|
187
|
unset($a_phase2[$togglebtnp2]['disabled']);
|
188
|
else
|
189
|
$a_phase2[$togglebtnp2]['disabled'] = true;
|
190
|
|
191
|
} else if (isset($delbtn)) {
|
192
|
/* remove static route if interface is not WAN */
|
193
|
if ($a_phase1[$delbtn]['interface'] != "wan")
|
194
|
mwexec("/sbin/route delete -host {$a_phase1[$delbtn]['remote-gateway']}");
|
195
|
|
196
|
/* remove all phase2 entries that match the ikeid */
|
197
|
$ikeid = $a_phase1[$delbtn]['ikeid'];
|
198
|
foreach ($a_phase2 as $p2index => $ph2tmp)
|
199
|
if ($ph2tmp['ikeid'] == $ikeid) {
|
200
|
unset($a_phase2[$p2index]);
|
201
|
}
|
202
|
|
203
|
unset($a_phase1[$delbtn]);
|
204
|
|
205
|
} else if (isset($delbtnp2)) {
|
206
|
unset($a_phase2[$delbtnp2]);
|
207
|
|
208
|
} else
|
209
|
$save = 0;
|
210
|
|
211
|
if ($save === 1) {
|
212
|
if (write_config())
|
213
|
mark_subsystem_dirty('ipsec');
|
214
|
}
|
215
|
}
|
216
|
}
|
217
|
|
218
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"));
|
219
|
$shortcut_section = "ipsec";
|
220
|
|
221
|
include("head.inc");
|
222
|
|
223
|
?>
|
224
|
|
225
|
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
|
226
|
|
227
|
<?php
|
228
|
|
229
|
if ($savemsg)
|
230
|
print_info_box($savemsg);
|
231
|
if ($pconfig['enable'] && is_subsystem_dirty('ipsec'))
|
232
|
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."));
|
233
|
|
234
|
$tab_array = array();
|
235
|
$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
|
236
|
$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
237
|
$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
|
238
|
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
|
239
|
display_top_tabs($tab_array);
|
240
|
|
241
|
require('classes/Form.class.php');
|
242
|
$form = new Form;
|
243
|
|
244
|
$section = new Form_Section('Enable IPsec');
|
245
|
$section->addInput(new Form_Checkbox(
|
246
|
'enable',
|
247
|
'Enable',
|
248
|
'Enable IPsec',
|
249
|
$pconfig['enable']
|
250
|
));
|
251
|
|
252
|
$form->add($section);
|
253
|
|
254
|
print $form;
|
255
|
|
256
|
?>
|
257
|
|
258
|
<h2>Rules</h2>
|
259
|
|
260
|
<form method="post">
|
261
|
<div class="table-responsive">
|
262
|
<table class="table table-striped table-hover">
|
263
|
<thead>
|
264
|
<tr>
|
265
|
<th class="list"> </th>
|
266
|
<th class="list"> </th>
|
267
|
<th class="listhdrr"><?=gettext("IKE"); ?></th>
|
268
|
<th class="listhdrr"><?=gettext("Remote Gateway"); ?></th>
|
269
|
<th class="listhdrr"><?=gettext("Mode"); ?></th>
|
270
|
<th class="listhdrr"><?=gettext("P1 Protocol"); ?></th>
|
271
|
<th class="listhdrr"><?=gettext("P1 Transforms"); ?></th>
|
272
|
<th class="listhdrr"><?=gettext("P1 Description"); ?></th>
|
273
|
<th class="list"></th>
|
274
|
</tr>
|
275
|
</thead>
|
276
|
<tbody>
|
277
|
<?php $i = 0; foreach ($a_phase1 as $ph1ent): ?>
|
278
|
<?php
|
279
|
$iconfn = "pass";
|
280
|
|
281
|
$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
282
|
|
283
|
if ($entryStatus == 'disabled') {
|
284
|
$iconfn .= "_d";
|
285
|
}
|
286
|
?>
|
287
|
<tr id="fr<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
|
288
|
<td>
|
289
|
<input type="checkbox" id="frc<?=$i?>" name="p1entry[]" value="<?=$i?>" onclick="fr_bgcolor('<?=$i?>')" />
|
290
|
</td>
|
291
|
<td>
|
292
|
<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>
|
293
|
</td>
|
294
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
295
|
<?php
|
296
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
|
297
|
echo "V1";
|
298
|
else
|
299
|
echo "V2";
|
300
|
?>
|
301
|
</td>
|
302
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
303
|
<?php
|
304
|
if ($ph1ent['interface']) {
|
305
|
$iflabels = get_configured_interface_with_descr();
|
306
|
|
307
|
$carplist = get_configured_carp_interface_list();
|
308
|
foreach ($carplist as $cif => $carpip)
|
309
|
$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
|
310
|
|
311
|
$aliaslist = get_configured_ip_aliases_list();
|
312
|
foreach ($aliaslist as $aliasip => $aliasif)
|
313
|
$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
314
|
|
315
|
$grouplist = return_gateway_groups_array();
|
316
|
foreach ($grouplist as $name => $group) {
|
317
|
if($group[0]['vip'] != "")
|
318
|
$vipif = $group[0]['vip'];
|
319
|
else
|
320
|
$vipif = $group[0]['int'];
|
321
|
$iflabels[$name] = "GW Group {$name}";
|
322
|
}
|
323
|
$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
|
324
|
}
|
325
|
else
|
326
|
$if = "WAN";
|
327
|
|
328
|
if (!isset($ph1ent['mobile']))
|
329
|
echo $if."<br />".$ph1ent['remote-gateway'];
|
330
|
else
|
331
|
echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
|
332
|
?>
|
333
|
</td>
|
334
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
335
|
<?=$spans?>
|
336
|
<?php
|
337
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
|
338
|
echo "{$ph1ent['mode']}";
|
339
|
?>
|
340
|
<?=$spane?>
|
341
|
</td>
|
342
|
<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
|
343
|
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name']?>
|
344
|
<?php
|
345
|
if ($ph1ent['encryption-algorithm']['keylen']) {
|
346
|
if ($ph1ent['encryption-algorithm']['keylen']=="auto")
|
347
|
echo " (" . gettext("auto") . ")";
|
348
|
else
|
349
|
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
|
350
|
}
|
351
|
?>
|
352
|
</td>
|
353
|
<td>
|
354
|
<?=$p1_halgos[$ph1ent['hash-algorithm']]?>
|
355
|
</td>
|
356
|
<td>
|
357
|
<?=htmlspecialchars($ph1ent['descr'])?>
|
358
|
</td>
|
359
|
<td>
|
360
|
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
|
361
|
<button class="btn btn-xs btn-default" type="submit" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("move selected entries before this")?></button>
|
362
|
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("edit phase1 entry"); ?>">edit</a>
|
363
|
<button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>">delete</button>
|
364
|
<?php if (!isset($ph1ent['mobile'])): ?>
|
365
|
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("copy phase1 entry"); ?>">copy</a>
|
366
|
<?php endif; ?>
|
367
|
</td>
|
368
|
</tr>
|
369
|
<tr class="<?= $entryStatus ?>">
|
370
|
<td colspan="2"></td>
|
371
|
<td colspan="7" class="contains-table">
|
372
|
<?php
|
373
|
if (isset($_POST["tdph2-{$i}-visible"]))
|
374
|
$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
|
375
|
else
|
376
|
$tdph2_visible = 0;
|
377
|
?>
|
378
|
<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
|
379
|
<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
|
380
|
<?php
|
381
|
$phase2count=0;
|
382
|
foreach ($a_phase2 as $ph2ent) {
|
383
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
|
384
|
continue;
|
385
|
$phase2count++;
|
386
|
}
|
387
|
$fr_prefix = "frp2{$i}";
|
388
|
$fr_header = $fr_prefix . "header";
|
389
|
?>
|
390
|
<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
|
391
|
</div>
|
392
|
<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
|
393
|
<table class="table table-striped table-hover">
|
394
|
<thead>
|
395
|
<tr>
|
396
|
<th> </th>
|
397
|
<th> </th>
|
398
|
<th><?=gettext("Mode"); ?></th>
|
399
|
<th><?=gettext("Local Subnet"); ?></th>
|
400
|
<th><?=gettext("Remote Subnet"); ?></th>
|
401
|
<th><?=gettext("P2 Protocol"); ?></th>
|
402
|
<th><?=gettext("P2 Transforms"); ?></th>
|
403
|
<th><?=gettext("P2 Auth Methods"); ?></th>
|
404
|
<th> </th>
|
405
|
</tr>
|
406
|
</thead>
|
407
|
<tbody>
|
408
|
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
|
409
|
<?php
|
410
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
|
411
|
continue;
|
412
|
|
413
|
$fr_c = $fr_prefix . "c" . $j;
|
414
|
$fr_d = $fr_prefix . "d" . $j;
|
415
|
|
416
|
$iconfn = "pass";
|
417
|
$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
|
418
|
|
419
|
if ($entryStatus == 'disabled')
|
420
|
$iconfn .= "_d";
|
421
|
|
422
|
?>
|
423
|
<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
|
424
|
<td>
|
425
|
<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
|
426
|
</td>
|
427
|
<td>
|
428
|
<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>
|
429
|
</td>
|
430
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
431
|
<?=$ph2ent['mode']?>
|
432
|
</td>
|
433
|
<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
|
434
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
435
|
<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
|
436
|
</td>
|
437
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
438
|
<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
|
439
|
</td>
|
440
|
<?php else: ?>
|
441
|
<td colspan="2"></td>
|
442
|
<?php endif; ?>
|
443
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
444
|
<?=$p2_protos[$ph2ent['protocol']]; ?>
|
445
|
</td>
|
446
|
<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
|
447
|
<?php
|
448
|
foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
|
449
|
if ($k)
|
450
|
echo ", ";
|
451
|
echo $p2_ealgos[$ph2ea['name']]['name'];
|
452
|
if ($ph2ea['keylen']) {
|
453
|
if ($ph2ea['keylen']=="auto")
|
454
|
echo " (" . gettext("auto") . ")";
|
455
|
else
|
456
|
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
|
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
|
echo $p2_halgos[$ph2ha];
|
468
|
}
|
469
|
}
|
470
|
?>
|
471
|
</td>
|
472
|
<td>
|
473
|
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
|
474
|
<button class="btn btn-xs btn-default" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>"><?=gettext("move selected entries before this")?></button>
|
475
|
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("edit phase2 entry"); ?>">edit</a>
|
476
|
<button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button>
|
477
|
<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>
|
478
|
</td>
|
479
|
</tr>
|
480
|
<?php $j++; endforeach; ?>
|
481
|
<tr>
|
482
|
<td colspan="8"></td>
|
483
|
<td>
|
484
|
<?php
|
485
|
if ($j == 0):
|
486
|
?>
|
487
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected phase2 entries to end")?>" border="0" alt="move" />
|
488
|
<?php
|
489
|
else:
|
490
|
?>
|
491
|
<input onmouseover="fr_insline(<?=$j?>, true, '<?=$fr_prefix?>')" onmouseout="fr_insline(<?=$j?>, false, '<?=$fr_prefix?>')" name="movep2_<?=$j?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17;border:0" title="<?=gettext("move selected phase2 entries to end")?>" />
|
492
|
<?php
|
493
|
endif;
|
494
|
?>
|
495
|
<a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid']?><?php if (isset($ph1ent['mobile'])) echo "&mobile=true"?>">
|
496
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add phase2 entry"); ?>" alt="add" />
|
497
|
</a>
|
498
|
<?php
|
499
|
if ($j == 0):
|
500
|
?>
|
501
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected phase2 entries")?>" border="0" alt="delete" />
|
502
|
<?php
|
503
|
else:
|
504
|
?>
|
505
|
<input name="delp2" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected phase2 entries")?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected phase2 entries?")?>')" />
|
506
|
<?php
|
507
|
endif;
|
508
|
?>
|
509
|
</td>
|
510
|
</tr>
|
511
|
</tbody>
|
512
|
</table>
|
513
|
</div>
|
514
|
</td>
|
515
|
</tr>
|
516
|
<?php
|
517
|
$i++;
|
518
|
endforeach; // $a_phase1 as $ph1ent
|
519
|
?>
|
520
|
<tr valign="top" id="fr<?=$i?>">
|
521
|
<td class="list" colspan="8"></td>
|
522
|
<td class="list nowrap" valign="middle">
|
523
|
<table border="0" cellspacing="0" cellpadding="1" summary="edit">
|
524
|
<tr>
|
525
|
<td>
|
526
|
<?php
|
527
|
if ($i == 0):
|
528
|
?>
|
529
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected phase1 entries to end")?>" border="0" alt="move" />
|
530
|
<?php
|
531
|
else:
|
532
|
?>
|
533
|
<input onmouseover="fr_insline(<?=$i?>, true)" onmouseout="fr_insline(<?=$i?>, false)" name="move_<?=$i?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17;border:0" title="<?=gettext("move selected phase1 entries to end")?>" />
|
534
|
<?php
|
535
|
endif;
|
536
|
?>
|
537
|
</td>
|
538
|
<td>
|
539
|
<a href="vpn_ipsec_phase1.php">
|
540
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new phase1")?>" alt="add" />
|
541
|
</a>
|
542
|
</td>
|
543
|
</tr>
|
544
|
<tr>
|
545
|
<td>
|
546
|
<?php
|
547
|
if ($i == 0):
|
548
|
?>
|
549
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected phase1 entries")?>" border="0" alt="delete" />
|
550
|
<?php
|
551
|
else:
|
552
|
?>
|
553
|
<input name="del" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected phase1 entries")?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected phase1 entries?")?>')" />
|
554
|
<?php
|
555
|
endif;
|
556
|
?>
|
557
|
</td>
|
558
|
</tr>
|
559
|
</table>
|
560
|
</td>
|
561
|
</tr>
|
562
|
</table>
|
563
|
</div>
|
564
|
</td>
|
565
|
</tr>
|
566
|
</table>
|
567
|
|
568
|
</form>
|
569
|
|
570
|
<div class="alert alert-info">
|
571
|
<strong><?=gettext("Note:")?></strong><br />
|
572
|
<?=gettext("You can check your IPsec status at"); ?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br />
|
573
|
<?=gettext("IPsec Debug Mode can be enabled at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.<br />
|
574
|
<?=gettext("IPsec can be set to prefer older SAs at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.
|
575
|
</div>
|
576
|
|
577
|
<?php include("foot.inc"); ?>
|
578
|
<script type="text/javascript">
|
579
|
//<![CDATA[
|
580
|
function show_phase2(id, buttonid) {
|
581
|
document.getElementById(buttonid).innerHTML='';
|
582
|
document.getElementById(id).style.display = "block";
|
583
|
var visible = id + '-visible';
|
584
|
document.getElementById(visible).value = "1";
|
585
|
}
|
586
|
//]]>
|
587
|
</script>
|