Project

General

Profile

Download (20.1 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * vpn_ipsec.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2018 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

    
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(gettext("Deleted selected IPsec Phase 1 entries."))) {
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(gettext("Deleted selected IPsec Phase 2 entries."))) {
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(gettext("Saved configuration changes for IPsec tunnels."))) {
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>&nbsp;</th>
249
						<th>&nbsp;</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 DH-Group")?></th>
256
						<th><?=gettext("P1 Description")?></th>
257
						<th><?=gettext("Actions")?></th>
258
					</tr>
259
				</thead>
260
				<tbody class="p1-entries">
261
<?php
262
$iflabels = get_configured_interface_with_descr(false, true);
263
$viplist = get_configured_vip_list();
264
foreach ($viplist as $vip => $address) {
265
	$iflabels[$vip] = $address;
266
	if (get_vip_descr($address)) {
267
		$iflabels[$vip] .= " (". get_vip_descr($address) .")";
268
	}
269
}
270
$grouplist = return_gateway_groups_array();
271
foreach ($grouplist as $name => $group) {
272
	if ($group[0]['vip'] != "") {
273
		$vipif = $group[0]['vip'];
274
	} else {
275
		$vipif = $group[0]['int'];
276
	}
277
	$iflabels[$name] = "GW Group {$name}";
278
}
279

    
280
$i = 0; foreach ($a_phase1 as $ph1ent): 
281

    
282
	$iconfn = "pass";
283

    
284
	$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
285

    
286
	if ($entryStatus == 'disabled') {
287
		$iconfn .= "_d";
288
	}
289
?>
290
					<tr id="fr<?=$i?>" onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
291
						<td>
292
							<input type="checkbox" id="frc<?=$i?>" onclick="fr_toggle(<?=$i?>)" name="p1entry[]" value="<?=$i?>"  />
293
							<a	class="fa fa-anchor icon-pointer" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a>
294
						</td>
295
						<td>
296
							<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>
297
						</td>
298
						<td id="frd<?=$i?>">
299
<?php
300
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1") {
301
				echo "V1";
302
			} elseif ($ph1ent['iketype'] == "ikev2") {
303
				echo "V2";
304
			} elseif ($ph1ent['iketype'] == "auto") {
305
				echo "Auto";
306
			}
307
?>
308
						</td>
309
						<td>
310
<?php
311
			if ($ph1ent['interface']) {
312
				if (isset($iflabels[$ph1ent['interface']])) {
313
					$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
314
				} else {
315
					$if = sprintf("Interface not found: '%s'", $ph1ent['interface']);
316
				}
317
			} else {
318
				$if = "WAN";
319
			}
320

    
321
			if (!isset($ph1ent['mobile'])) {
322
				echo $if."<br />".$ph1ent['remote-gateway'];
323
			} else {
324
				echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
325
			}
326
?>
327
						</td>
328
						<td id="frd<?=$i?>">
329
					<?=$spans?>
330
					<?php
331
					if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1" || $ph1ent['iketype'] == "auto") {
332
						echo "{$ph1ent['mode']}";
333
					}
334
					?>
335
					<?=$spane?>
336
				</td>
337
				<td id="frd<?=$i?>">
338
<?php
339
				$first = true;
340
				if (is_array($ph1ent['encryption']['item'])) {
341
					foreach($ph1ent['encryption']['item'] as $p1algo) {
342
						if (!$first) {
343
							echo "<br/>";
344
						}
345
						echo $p1_ealgos[$p1algo['encryption-algorithm']['name']]['name'];
346
						if ($p1algo['encryption-algorithm']['keylen']) {
347
							echo " ({$p1algo['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
348
						}
349
						$first = false;
350
					}
351
				}
352
?>
353
						</td>
354
						<td>
355
<?php			$first = true;
356
				if (is_array($ph1ent['encryption']['item'])) {
357
					foreach($ph1ent['encryption']['item'] as $p1algo) {
358
						if (!$first) {
359
							echo "<br/>";
360
						}
361
						echo $p1_halgos[$p1algo['hash-algorithm']];
362
						$first = false;
363
					}
364
				}
365
				?>
366
						</td>
367
						<td>
368
<?php			$first = true;
369
				if (is_array($ph1ent['encryption']['item'])) {
370
					foreach($ph1ent['encryption']['item'] as $p1algo) {
371
						if (!$first) {
372
							echo "<br/>";
373
						}
374
						echo str_replace(" ","&nbsp;",$p1_dhgroups[$p1algo['dhgroup']]);
375
						$first = false;
376
					}
377
				}
378
				?>
379
						</td>
380
						<td>
381
							<?=htmlspecialchars($ph1ent['descr'])?>
382
						</td>
383
						<td style="cursor: pointer;">
384
<!--							<a	class="fa fa-anchor" id="Xmove_<?=$i?>" title="<?=gettext("Move checked entries to here")?>"></a> -->
385
							<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>
386
							<a class="fa fa-pencil" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("Edit phase1 entry"); ?>"></a>
387
<?php if (!isset($ph1ent['mobile'])): ?>
388
							<a class="fa fa-clone" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("Copy phase1 entry"); ?>"></a>
389
<?php endif; ?>
390
							<a	class="fa fa-trash no-confirm" id="Xdel_<?=$i?>" title="<?=gettext('Delete phase1 entry'); ?>"></a>
391
							<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>
392

    
393
						</td>
394
					</tr>
395
					<tr class="<?= $entryStatus ?>">
396
						<td colspan="2"></td>
397
						<td colspan="7" class="contains-table">
398
<?php
399
			if (isset($_REQUEST["tdph2-{$i}-visible"])) {
400
				$tdph2_visible = htmlspecialchars($_REQUEST["tdph2-{$i}-visible"]);
401
			} else {
402
				$tdph2_visible = 0;
403
			}
404
?>
405
							<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
406
							<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
407
<?php
408
				$phase2count=0;
409

    
410
				foreach ($a_phase2 as $ph2ent) {
411
					if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
412
						continue;
413
					}
414
					$phase2count++;
415
				}
416
				$fr_prefix = "frp2{$i}";
417
				$fr_header = $fr_prefix . "header";
418
?>
419
								<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>
420
							</div>
421
							<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
422
								<table class="table table-striped table-hover">
423
									<thead>
424
										<tr>
425
											<th>&nbsp;</th>
426
											<th>&nbsp;</th>
427
											<th><?=gettext("Mode"); ?></th>
428
											<th><?=gettext("Local Subnet"); ?></th>
429
											<th><?=gettext("Remote Subnet"); ?></th>
430
											<th><?=gettext("P2 Protocol"); ?></th>
431
											<th><?=gettext("P2 Transforms"); ?></th>
432
											<th><?=gettext("P2 Auth Methods"); ?></th>
433
											<th><?=gettext("P2 actions")?></th>
434
										</tr>
435
									</thead>
436
									<tbody class="p2-entries">
437
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
438
<?php
439
						if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
440
							continue;
441
						}
442

    
443
						$fr_c = $fr_prefix . "c" . $j;
444
						$fr_d = $fr_prefix . "d" . $j;
445

    
446
						$iconfn = "pass";
447
						$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
448

    
449
						if ($entryStatus == 'disabled') {
450
							$iconfn .= "_d";
451
						}
452
?>
453
										<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
454
											<td>
455
												<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
456
												<button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button>
457
											</td>
458
											<td>
459
												<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>
460
											</td>
461
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
462
												<?=$ph2ent['mode']?>
463
											</td>
464
<?php if (($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
465
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
466
												<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
467
											</td>
468
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
469
												<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
470
											</td>
471
		<?php else: ?>
472
											<td colspan="2"></td>
473
<?php endif; ?>
474
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
475
												<?=$p2_protos[$ph2ent['protocol']]; ?>
476
											</td>
477
											<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
478
<?php
479
								foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
480
									if ($k) {
481
										echo ", ";
482
									}
483
									echo $p2_ealgos[$ph2ea['name']]['name'];
484
									if ($ph2ea['keylen']) {
485
										if ($ph2ea['keylen'] == "auto") {
486
											echo " (" . gettext("auto") . ")";
487
										} else {
488
											echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
489
										}
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
										}
501
										echo $p2_halgos[$ph2ha];
502
									}
503
								}
504
?>
505
											</td>
506
											<td style="cursor: pointer;">
507
<!--												<button class="fa fa-anchor button-icon" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>" title="<?=gettext("Move checked P2s here")?>"></button> -->
508
												<a class="fa fa-pencil" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("Edit phase2 entry"); ?>"></a>
509
												<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>
510
												<a	class="fa fa-trash no-confirm" id="Xdelp2_<?=$ph2index?>" title="<?=gettext('Delete phase2 entry'); ?>"></a>
511
												<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>
512
											</td>
513
										</tr>
514
<?php $j++; endforeach; ?>
515
										<tr>
516
											<td></td>
517
											<td>
518
												<a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid']?><?php if (isset($ph1ent['mobile'])) echo "&amp;mobile=true"?>">
519
													<i class="fa fa-plus icon-embed-btn"></i>
520
													<?=gettext("Add P2")?>
521
												</a>
522
											</td>
523
											<td colspan="7"></td>
524
										</tr>
525
									</tbody>
526
								</table>
527
							</div>
528
						</td>
529
					</tr>
530
<?php
531
					$i++;
532
				endforeach;	 // $a_phase1 as $ph1ent
533
?>
534
				</tbody>
535
			</table>
536
		</div>
537
	</div>
538

    
539
	<nav class="action-buttons">
540
<?php
541
/*
542
	if ($i !== 0): ?>
543
	<input type="submit" name="move_<?=$i?>" class="btn btn-default" value="<?=gettext("move selected phase1 entries to end")?>" />
544
<?php endif;
545
*/
546
?>
547
		<a href="vpn_ipsec_phase1.php" class="btn btn-success btn-sm"  usepost>
548
			<i class="fa fa-plus icon-embed-btn"></i>
549
			<?=gettext("Add P1")?>
550
		</a>
551
<?php if ($i !== 0): ?>
552
		<button type="submit" name="del" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected P1s")?>">
553
			<i class="fa fa-trash icon-embed-btn"></i>
554
			<?=gettext("Delete P1s")?>
555
		</button>
556
<?php endif; ?>
557
	</nav>
558
</form>
559

    
560
<div class="infoblock">
561
	<?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 />' .
562
	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 />' .
563
	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); ?>
564
</div>
565

    
566
<script type="text/javascript">
567
//<![CDATA[
568
function show_phase2(id, buttonid) {
569
	document.getElementById(buttonid).innerHTML='';
570
	document.getElementById(id).style.display = "block";
571
	var visible = id + '-visible';
572
	document.getElementById(visible).value = "1";
573
}
574

    
575
events.push(function() {
576
	$('[id^=Xmove_]').click(function (event) {
577
		// ToDo: We POST shift="yes" if the user has the shift key depressed, but that is not yet used
578
		// by the $_POST code. It is intended to allow the user to choose to move stuff to the row before or
579
		// after the clicked anchor icon
580
		if (event.shiftKey) {
581
			$('form').append('<input type="hidden" id="shift" name="shift" value="yes" />');
582
		}
583

    
584
		$('#' + event.target.id.slice(1)).click();
585
	});
586

    
587
	$('[id^=Xdel_]').click(function (event) {
588
		if (confirm("<?=gettext('Confirmation required to delete this P1 entry.')?>")) {
589
			$('#' + event.target.id.slice(1)).click();
590
		}
591
	});
592

    
593
	$('[id^=Xdelp2_]').click(function (event) {
594
		if (confirm("<?=gettext('Confirmation required to delete this P2 entry.')?>")) {
595
			$('#' + event.target.id.slice(1)).click();
596
		}
597
	});
598
});
599
//]]>
600
</script>
601

    
602
<?php
603
include("foot.inc");
(218-218/232)