Project

General

Profile

Download (20.5 KB) Statistics
| Branch: | Tag: | Revision:
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, false, 'pills');
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
<form method="post">
259
<div class="table-responsive">
260
	<table class="table table-striped table-hover">
261
		<thead>
262
			<tr>
263
				<th class="list">&nbsp;</th>
264
				<th class="list">&nbsp;</th>
265
				<th class="listhdrr"><?=gettext("IKE"); ?></th>
266
				<th class="listhdrr"><?=gettext("Remote Gateway"); ?></th>
267
				<th class="listhdrr"><?=gettext("Mode"); ?></th>
268
				<th class="listhdrr"><?=gettext("P1 Protocol"); ?></th>
269
				<th class="listhdrr"><?=gettext("P1 Transforms"); ?></th>
270
				<th class="listhdrr"><?=gettext("P1 Description"); ?></th>
271
				<th class="list"></th>
272
			</tr>
273
		</thead>
274
		<tbody>
275
<?php $i = 0; foreach ($a_phase1 as $ph1ent): ?>
276
<?php
277
	$iconfn = "pass";
278

    
279
	$entryStatus = (isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
280

    
281
	if ($entryStatus == 'disabled') {
282
		$iconfn .= "_d";
283
	}
284
?>
285
	<tr id="fr<?=$i?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i?>'" class="<?= $entryStatus ?>">
286
		<td>
287
			<input type="checkbox" id="frc<?=$i?>" name="p1entry[]" value="<?=$i?>" onclick="fr_bgcolor('<?=$i?>')" />
288
		</td>
289
		<td>
290
			<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>
291
		</td>
292
		<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
293
<?php
294
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
295
				echo "V1";
296
			else
297
				echo "V2";
298
?>
299
		</td>
300
		<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
301
<?php
302
			if ($ph1ent['interface']) {
303
				$iflabels = get_configured_interface_with_descr();
304

    
305
				$carplist = get_configured_carp_interface_list();
306
				foreach ($carplist as $cif => $carpip)
307
					$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
308

    
309
				$aliaslist = get_configured_ip_aliases_list();
310
				foreach ($aliaslist as $aliasip => $aliasif)
311
					$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
312

    
313
				$grouplist = return_gateway_groups_array();
314
				foreach ($grouplist as $name => $group) {
315
					if($group[0]['vip'] != "")
316
						$vipif = $group[0]['vip'];
317
					else
318
						$vipif = $group[0]['int'];
319
					$iflabels[$name] = "GW Group {$name}";
320
				}
321
				$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
322
			}
323
			else
324
				$if = "WAN";
325

    
326
			if (!isset($ph1ent['mobile']))
327
				echo $if."<br />".$ph1ent['remote-gateway'];
328
			else
329
				echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
330
?>
331
		</td>
332
		<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
333
			<?=$spans?>
334
			<?php
335
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
336
				echo "{$ph1ent['mode']}";
337
			?>
338
			<?=$spane?>
339
		</td>
340
		<td onclick="fr_toggle(<?=$i?>)" id="frd<?=$i?>">
341
			<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name']?>
342
<?php
343
			if ($ph1ent['encryption-algorithm']['keylen']) {
344
				if ($ph1ent['encryption-algorithm']['keylen']=="auto")
345
					echo " (" . gettext("auto") . ")";
346
				else
347
					echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
348
			}
349
?>
350
		</td>
351
		<td>
352
			<?=$p1_halgos[$ph1ent['hash-algorithm']]?>
353
		</td>
354
		<td>
355
			<?=htmlspecialchars($ph1ent['descr'])?>
356
		</td>
357
		<td>
358
			<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
359
			<button class="btn btn-xs btn-default" type="submit" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("move selected entries before this")?></button>
360
			<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("edit phase1 entry"); ?>">edit</a>
361
			<button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>"
362
					onclick="return confirm('<?=gettext("Do you really want to delete this phase1 and all associated phase2 entries?"); ?>')">delete</button>
363
<?php if (!isset($ph1ent['mobile'])): ?>
364
			<a class="btn btn-xs btn-success" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("copy phase1 entry"); ?>">copy</a>
365
<?php endif; ?>
366
		</td>
367
	</tr>
368
	<tr class="<?= $entryStatus ?>">
369
		<td colspan="2"></td>
370
		<td colspan="7" class="contains-table">
371
<?php
372
			if (isset($_POST["tdph2-{$i}-visible"]))
373
				$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
374
			else
375
				$tdph2_visible = 0;
376
?>
377
			<input type="hidden" name="tdph2-<?=$i?>-visible" id="tdph2-<?=$i?>-visible" value="<?=$tdph2_visible?>" />
378
			<div id="shph2but-<?=$i?>" <?=($tdph2_visible == '1' ? 'style="display:none"' : '')?>>
379
<?php
380
				$phase2count=0;
381
				foreach ($a_phase2 as $ph2ent) {
382
					if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
383
						continue;
384
					$phase2count++;
385
				}
386
				$fr_prefix = "frp2{$i}";
387
				$fr_header = $fr_prefix . "header";
388
?>
389
				<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
390
			</div>
391
			<div id="tdph2-<?=$i?>" <?=($tdph2_visible != '1' ? 'style="display:none"' : '')?>>
392
				<table class="table table-striped table-hover">
393
					<thead>
394
						<tr>
395
							<th>&nbsp;</th>
396
							<th>&nbsp;</th>
397
							<th><?=gettext("Mode"); ?></th>
398
							<th><?=gettext("Local Subnet"); ?></th>
399
							<th><?=gettext("Remote Subnet"); ?></th>
400
							<th><?=gettext("P2 Protocol"); ?></th>
401
							<th><?=gettext("P2 Transforms"); ?></th>
402
							<th><?=gettext("P2 Auth Methods"); ?></th>
403
							<th>&nbsp;</th>
404
						</tr>
405
					</thead>
406
					<tbody>
407
<?php $j = 0; foreach ($a_phase2 as $ph2index => $ph2ent): ?>
408
<?php
409
						if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
410
							continue;
411

    
412
						$fr_c = $fr_prefix . "c" . $j;
413
						$fr_d = $fr_prefix . "d" . $j;
414

    
415
						$iconfn = "pass";
416
						$entryStatus = (isset($ph2ent['disabled']) || isset($ph1ent['disabled']) ? 'disabled' : 'enabled');
417

    
418
						if ($entryStatus == 'disabled')
419
							$iconfn .= "_d";
420

    
421
?>
422
						<tr id="<?=$fr_prefix . $j?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>'" class="<?= $entryStatus ?>">
423
							<td>
424
								<input type="checkbox" id="<?=$fr_c?>" name="p2entry[]" value="<?=$ph2index?>" onclick="fr_bgcolor('<?=$j?>', '<?=$fr_prefix?>')" />
425
							</td>
426
							<td>
427
								<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>
428
							</td>
429
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
430
								<?=$ph2ent['mode']?>
431
							</td>
432
<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
433
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
434
								<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
435
							</td>
436
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
437
								<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
438
							</td>
439
<?php else: ?>
440
							<td colspan="2"></td>
441
<?php endif; ?>
442
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
443
								<?=$p2_protos[$ph2ent['protocol']]; ?>
444
							</td>
445
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
446
<?php
447
								foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
448
									if ($k)
449
										echo ", ";
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
							</td>
460
							<td id="<?=$fr_d?>" onclick="fr_toggle('<?=$j?>', '<?=$fr_prefix?>')">
461
<?php
462
								if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
463
									foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
464
										if ($k)
465
											echo ", ";
466
										echo $p2_halgos[$ph2ha];
467
									}
468
								}
469
?>
470
							</td>
471
							<td>
472
								<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
473
								<button class="btn btn-xs btn-default" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>"><?=gettext("move selected entries before this")?></button>
474
								<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("edit phase2 entry"); ?>">edit</a>
475
								<button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>"
476
										onclick="return confirm('<?=gettext("Do you really want to delete this 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 "&amp;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>
(233-233/252)