Project

General

Profile

Download (24.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['submit']) {
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
		unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
99
		foreach ($_POST as $pn => $pd) {
100
			if (preg_match("/del_(\d+)_x/", $pn, $matches)) {
101
				$delbtn = $matches[1];
102
			} else if (preg_match("/delp2_(\d+)_x/", $pn, $matches)) {
103
				$delbtnp2 = $matches[1];
104
			} else if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
105
				$movebtn = $matches[1];
106
			} else if (preg_match("/movep2_(\d+)_x/", $pn, $matches)) {
107
				$movebtnp2 = $matches[1];
108
			} else if (preg_match("/toggle_(\d+)_x/", $pn, $matches)) {
109
				$togglebtn = $matches[1];
110
			} else if (preg_match("/togglep2_(\d+)_x/", $pn, $matches)) {
111
				$togglebtnp2 = $matches[1];
112
			}
113
		}
114

    
115
		$save = 1;
116

    
117
		/* move selected p1 entries before this */
118
		if (isset($movebtn) && is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
119
			$a_phase1_new = array();
120

    
121
			/* copy all p1 entries < $movebtn and not selected */
122
			for ($i = 0; $i < $movebtn; $i++) {
123
				if (!in_array($i, $_POST['p1entry']))
124
					$a_phase1_new[] = $a_phase1[$i];
125
			}
126

    
127
			/* copy all selected p1 entries */
128
			for ($i = 0; $i < count($a_phase1); $i++) {
129
				if ($i == $movebtn)
130
					continue;
131
				if (in_array($i, $_POST['p1entry']))
132
					$a_phase1_new[] = $a_phase1[$i];
133
			}
134

    
135
			/* copy $movebtn p1 entry */
136
			if ($movebtn < count($a_phase1))
137
				$a_phase1_new[] = $a_phase1[$movebtn];
138

    
139
			/* copy all p1 entries > $movebtn and not selected */
140
			for ($i = $movebtn+1; $i < count($a_phase1); $i++) {
141
				if (!in_array($i, $_POST['p1entry']))
142
					$a_phase1_new[] = $a_phase1[$i];
143
			}
144
			if (count($a_phase1_new) > 0)
145
				$a_phase1 = $a_phase1_new;
146

    
147
		} else if (isset($movebtnp2) && is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
148
			/* move selected p2 entries before this */
149
			$a_phase2_new = array();
150

    
151
			/* copy all p2 entries < $movebtnp2 and not selected */
152
			for ($i = 0; $i < $movebtnp2; $i++) {
153
				if (!in_array($i, $_POST['p2entry']))
154
					$a_phase2_new[] = $a_phase2[$i];
155
			}
156

    
157
			/* copy all selected p2 entries */
158
			for ($i = 0; $i < count($a_phase2); $i++) {
159
				if ($i == $movebtnp2)
160
					continue;
161
				if (in_array($i, $_POST['p2entry']))
162
					$a_phase2_new[] = $a_phase2[$i];
163
			}
164

    
165
			/* copy $movebtnp2 p2 entry */
166
			if ($movebtnp2 < count($a_phase2))
167
				$a_phase2_new[] = $a_phase2[$movebtnp2];
168

    
169
			/* copy all p2 entries > $movebtnp2 and not selected */
170
			for ($i = $movebtnp2+1; $i < count($a_phase2); $i++) {
171
				if (!in_array($i, $_POST['p2entry']))
172
					$a_phase2_new[] = $a_phase2[$i];
173
			}
174
			if (count($a_phase2_new) > 0)
175
				$a_phase2 = $a_phase2_new;
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
			/* remove all phase2 entries that match the ikeid */
195
			$ikeid = $a_phase1[$delbtn]['ikeid'];
196
			foreach ($a_phase2 as $p2index => $ph2tmp)
197
				if ($ph2tmp['ikeid'] == $ikeid) {
198
					unset($a_phase2[$p2index]);
199
				}
200

    
201
			unset($a_phase1[$delbtn]);
202

    
203
		} else if (isset($delbtnp2)) {
204
			unset($a_phase2[$delbtnp2]);
205

    
206
		} else
207
			$save = 0;
208

    
209
		if ($save === 1) {
210
			if (write_config())
211
				mark_subsystem_dirty('ipsec');
212
		}
213
	}
214
}
215

    
216
$pgtitle = array(gettext("VPN"),gettext("IPsec"));
217
$shortcut_section = "ipsec";
218

    
219
include("head.inc");
220

    
221
?>
222

    
223
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
224
<?php include("fbegin.inc"); ?>
225
<form action="vpn_ipsec.php" method="post">
226
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
227
<?php
228
	if ($savemsg)
229
		print_info_box($savemsg);
230
	if ($pconfig['enable'] && is_subsystem_dirty('ipsec'))
231
		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."));
232
?>
233
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec">
234
	<tr>
235
		<td class="tabnavtbl">
236
<?php
237
			$tab_array = array();
238
			$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
239
			$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
240
			$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
241
			$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
242
			display_top_tabs($tab_array);
243
?>
244
		</td>
245
	</tr>
246
	<tr>
247
		<td>
248
			<div id="mainarea">
249
				<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
250
					<tr>
251
						<td class="vtable">
252
							<table border="0" cellspacing="2" cellpadding="0" summary="enable">
253
								<tr>
254
									<td>
255
										<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\"";?> />
256
									</td>
257
									<td>
258
										<strong><?=gettext("Enable IPsec"); ?></strong>
259
									</td>
260
								</tr>
261
							</table>
262
						</td>
263
					</tr>
264
					<tr>
265
						<td>
266
							<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
267
						</td>
268
					</tr>
269
				</table>
270
				<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="phase-1 entries">
271
					<tr id="frheader">
272
						<td class="list">&nbsp;</td>
273
						<td class="list">&nbsp;</td>
274
						<td class="listhdrr"><?=gettext("IKE"); ?></td>
275
						<td class="listhdrr"><?=gettext("Remote Gateway"); ?></td>
276
						<td class="listhdrr"><?=gettext("Mode"); ?></td>
277
						<td class="listhdrr"><?=gettext("P1 Protocol"); ?></td>
278
						<td class="listhdrr"><?=gettext("P1 Transforms"); ?></td>
279
						<td class="listhdrr"><?=gettext("P1 Description"); ?></td>
280
						<td class="list">
281
						</td>
282
					</tr>
283
<?php
284
				$i = 0;
285
				foreach ($a_phase1 as $ph1ent):
286
					$iconfn = "pass";
287
					$spans = $spane = "";
288
					if (isset($ph1ent['disabled'])) {
289
						$spans = "<span class=\"gray\">";
290
						$spane = "</span>";
291
						$iconfn .= "_d";
292
					}
293
?>
294
					<tr valign="top" id="fr<?=$i;?>" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i;?>'">
295
						<td class="listt" align="center" valign="middle">
296
							<input type="checkbox" id="frc<?=$i;?>" name="p1entry[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
297
						</td>
298
						<td class="listt" align="center" valign="middle">
299
							<input name="toggle_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn?>.gif"
300
								title="<?=gettext("click to toggle enabled/disabled status");?>"
301
								type="image" style="height:11;width:11;border:0" />
302
						</td>
303
						<td class="listlr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>">
304
							<?=$spans;?>
305
<?php
306
							if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
307
								echo "V1";
308
							else
309
								echo "V2";
310
?>
311
							<?=$spane;?>
312
						</td>
313
						<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>">
314
							<?=$spans;?>
315
<?php
316
							if ($ph1ent['interface']) {
317
								$iflabels = get_configured_interface_with_descr();
318

    
319
								$carplist = get_configured_carp_interface_list();
320
								foreach ($carplist as $cif => $carpip)
321
									$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
322

    
323
								$aliaslist = get_configured_ip_aliases_list();
324
								foreach ($aliaslist as $aliasip => $aliasif)
325
									$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
326

    
327
								$grouplist = return_gateway_groups_array();
328
								foreach ($grouplist as $name => $group) {
329
									if($group[0]['vip'] <> "")
330
										$vipif = $group[0]['vip'];
331
									else
332
										$vipif = $group[0]['int'];
333
									$iflabels[$name] = "GW Group {$name}";
334
								}
335
								$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
336
							}
337
							else
338
								$if = "WAN";
339

    
340
							if (!isset($ph1ent['mobile']))
341
								echo $if."<br />".$ph1ent['remote-gateway'];
342
							else
343
								echo $if."<br /><strong>" . gettext("Mobile Client") . "</strong>";
344
?>
345
							<?=$spane;?>
346
						</td>
347
						<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>">
348
							<?=$spans;?>
349
							<?php
350
							if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == "ikev1")
351
								echo "{$ph1ent['mode']}";
352
							?>
353
							<?=$spane;?>
354
						</td>
355
						<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>">
356
							<?=$spans;?>
357
							<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?>
358
<?php
359
							if ($ph1ent['encryption-algorithm']['keylen']) {
360
								if ($ph1ent['encryption-algorithm']['keylen']=="auto")
361
									echo " (" . gettext("auto") . ")";
362
								else
363
									echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
364
							}
365
?>
366
							<?=$spane;?>
367
						</td>
368
						<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>">
369
							<?=$spans;?>
370
							<?=$p1_halgos[$ph1ent['hash-algorithm']];?>
371
							<?=$spane;?>
372
						</td>
373
						<td class="listbg" onclick="fr_toggle(<?=$i;?>)">
374
							<?=$spans;?>
375
							<?=htmlspecialchars($ph1ent['descr']);?>&nbsp;
376
							<?=$spane;?>
377
						</td>
378
						<td valign="middle" class="list nowrap">
379
							<table border="0" cellspacing="0" cellpadding="1" summary="icons">
380
								<tr>
381
									<td>
382
										<input onmouseover="fr_insline(<?=$i;?>, true)" onmouseout="fr_insline(<?=$i;?>, false)"
383
											name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif"
384
											title="<?=gettext("move selected entries before this");?>"
385
											type="image" style="height:17;width:17;border:0" />
386
									</td>
387
									<td>
388
										<a href="vpn_ipsec_phase1.php?p1index=<?=$i;?>">
389
											<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit phase1 entry"); ?>" width="17" height="17" border="0" alt="edit" />
390
										</a>
391
									</td>
392
								</tr>
393
								<tr>
394
									<td>
395
										<input name="del_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif"
396
											title="<?=gettext("delete phase1 entry");?>"
397
											type="image" style="height:17;width:17;border:0"
398
											onclick="return confirm('<?=gettext("Do you really want to delete this phase1 and all associated phase2 entries?"); ?>')" />
399
									</td>
400
									<td>
401
<?php
402
							if (!isset($ph1ent['mobile'])):
403
?>
404
										<a href="vpn_ipsec_phase1.php?dup=<?=$i;?>">
405
											<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("copy phase1 entry"); ?>" width="17" height="17" border="0" alt="add" />
406
										</a>
407
<?php
408
							endif;
409
?>
410
									</td>
411
								</tr>
412
							</table>
413
						</td>
414
					</tr>
415
					<tr>
416
						<td class="listt">&nbsp;</td>
417
						<td class="listt">&nbsp;</td>
418
						<td class="listrborder" colspan="6">
419
<?php
420
							if (isset($_POST["tdph2-{$i}-visible"]))
421
								$tdph2_visible = htmlspecialchars($_POST["tdph2-{$i}-visible"]);
422
							else
423
								$tdph2_visible = 0;
424
?>
425
							<input type="hidden" name="tdph2-<?=$i;?>-visible" id="tdph2-<?=$i;?>-visible" value="<?=$tdph2_visible?>" />
426
							<div id="shph2but-<?=$i?>" <?php echo ($tdph2_visible == '1' ? 'style="display:none"' : '');?>>
427
<?php
428
							$phase2count=0;
429
							foreach ($a_phase2 as $ph2ent) {
430
								if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
431
									continue;
432
								$phase2count++;
433
							}
434
							$fr_prefix = "frp2{$i}";
435
							$fr_header = $fr_prefix . "header";
436
?>
437
								<input type="button" onclick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+" /> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?>
438
							</div>
439
							<div id="tdph2-<?=$i?>" <?php echo ($tdph2_visible != '1' ? 'style="display:none"' : '');?>>
440
							<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="phase-2 entries">
441
							<tr id="<?=$fr_header;?>">
442
									<td>&nbsp;</td>
443
									<td>&nbsp;</td>
444
									<td class="listhdrr"><?=gettext("Mode"); ?></td>
445
									<td class="listhdrr"><?=gettext("Local Subnet"); ?></td>
446
									<td class="listhdrr"><?=gettext("Remote Subnet"); ?></td>
447
									<td class="listhdrr"><?=gettext("P2 Protocol"); ?></td>
448
									<td class="listhdrr"><?=gettext("P2 Transforms"); ?></td>
449
									<td class="listhdrr"><?=gettext("P2 Auth Methods"); ?></td>
450
									<td class ="list">&nbsp;</td>
451
								</tr>
452
<?php
453
								$j = 0;
454
								foreach ($a_phase2 as $ph2index => $ph2ent):
455
									if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
456
										continue;
457

    
458
									$fr_c = $fr_prefix . "c" . $j;
459
									$fr_d = $fr_prefix . "d" . $j;
460

    
461
									$iconfn = "pass";
462
									$spans = $spane = "";
463
									if (isset($ph2ent['disabled']) || isset($ph1ent['disabled'])) {
464
										$spans = "<span class=\"gray\">";
465
										$spane = "</span>";
466
										$iconfn .= "_d";
467
									}
468
?>
469
								<tr valign="top" id="<?=$fr_prefix . $j;?>" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>'">
470
									<td class="listt" align="center" valign="middle">
471
									<input type="checkbox" id="<?=$fr_c;?>" name="p2entry[]" value="<?=$ph2index;?>" onclick="fr_bgcolor('<?=$j;?>', '<?=$fr_prefix;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
472
									</td>
473
									<td class="listt" align="center" valign="middle">
474
										<input name="togglep2_<?=$ph2index;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn?>.gif"
475
											title="<?=gettext("click to toggle enabled/disabled status");?>"
476
											type="image" style="height:11;width:11;border:0" />
477
									</td>
478
									<td class="listlr nowrap" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
479
										<?=$spans;?>
480
										<?=$ph2ent['mode'];?>
481
										<?=$spane;?>
482
									</td>
483
<?php
484
									if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")):
485
?>
486
										<td class="listr nowrap" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
487
											<?=$spans;?>
488
												<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
489
											<?=$spane;?>
490
										</td>
491
										<td class="listr nowrap" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
492
											<?=$spans;?>
493
												<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
494
											<?=$spane;?>
495
										</td>
496
<?php
497
									else:
498
										echo "<td class=\"listr nowrap\">&nbsp;</td><td class=\"listr nowrap\">&nbsp;</td>";
499
									endif;
500
?>
501
									<td class="listr nowrap" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
502
										<?=$spans;?>
503
										<?php echo $p2_protos[$ph2ent['protocol']]; ?>
504
										<?=$spane;?>
505
									</td>
506
									<td class="listr" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
507
										<?=$spans;?>
508
<?php
509
										foreach ($ph2ent['encryption-algorithm-option'] as $k => $ph2ea) {
510
											if ($k)
511
												echo ", ";
512
											echo $p2_ealgos[$ph2ea['name']]['name'];
513
											if ($ph2ea['keylen']) {
514
												if ($ph2ea['keylen']=="auto")
515
													echo " (" . gettext("auto") . ")";
516
												else
517
													echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
518
											}
519
										}
520
?>
521
										<?=$spane;?>
522
									</td>
523
									<td class="listr nowrap" id="<?=$fr_d;?>" onclick="fr_toggle('<?=$j;?>', '<?=$fr_prefix;?>')">
524
										<?=$spans;?>
525
<?php
526
										if (!empty($ph2ent['hash-algorithm-option']) && is_array($ph2ent['hash-algorithm-option'])) {
527
											foreach ($ph2ent['hash-algorithm-option'] as $k => $ph2ha) {
528
												if ($k)
529
													echo ", ";
530
												echo $p2_halgos[$ph2ha];
531
											}
532
										}
533
?>
534
										<?=$spane;?>
535
									</td>
536
									<td class="list nowrap" valign="middle">
537
										<input onmouseover="fr_insline(<?=$j;?>, true, '<?=$fr_prefix;?>')" onmouseout="fr_insline(<?=$j;?>, false, '<?=$fr_prefix;?>')"
538
											name="movep2_<?=$j;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif"
539
											title="<?=gettext("move selected entries before this");?>"
540
											type="image" style="height:17;width:17;border:0" />
541
										<a href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid'];?>">
542
											<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit phase2 entry"); ?>" width="17" height="17" border="0" alt="edit" />
543
										</a>
544
										<input name="delp2_<?=$ph2index;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif"
545
											title="<?=gettext("delete phase2 entry");?>"
546
											type="image" style="height:17;width:17;border:0"
547
											onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')" />
548
										<a href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid'];?>">
549
											<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new Phase 2 based on this one"); ?>" width="17" height="17" border="0" alt="add" />
550
										</a>
551
									</td>
552
								</tr>
553
<?php
554
									$j++;
555
								endforeach;
556
?>
557
								<tr valign="top" id="<?=$fr_prefix . $j;?>">
558
									<td class="list" colspan="8"></td>
559
									<td class="list nowrap" valign="middle">
560
<?php
561
									if ($j == 0):
562
?>
563
										<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" />
564
<?php
565
									else:
566
?>
567
										<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");?>" />
568
<?php
569
									endif;
570
?>
571
										<a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid'];?><?php if (isset($ph1ent['mobile'])) echo "&amp;mobile=true";?>">
572
											<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add phase2 entry"); ?>" width="17" height="17" border="0" alt="add" />
573
										</a>
574
<?php
575
									if ($j == 0):
576
?>
577
										<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" />
578
<?php
579
									else:
580
?>
581
										<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?");?>')" />
582
<?php
583
									endif;
584
?>
585
									</td>
586
								</tr>
587
							</table>
588
							</div>
589
						</td>
590
					</tr>
591
<?php
592
					$i++;
593
				endforeach;  // $a_phase1 as $ph1ent
594
?>
595
					<tr valign="top" id="fr<?=$i;?>">
596
						<td class="list" colspan="8"></td>
597
						<td class="list nowrap" valign="middle">
598
							<table border="0" cellspacing="0" cellpadding="1" summary="edit">
599
								<tr>
600
									<td>
601
<?php
602
									if ($i == 0):
603
?>
604
										<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" />
605
<?php
606
									else:
607
?>
608
										<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");?>" />
609
<?php
610
									endif;
611
?>
612
									</td>
613
									<td>
614
										<a href="vpn_ipsec_phase1.php">
615
											<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new phase1");?>" alt="add" />
616
										</a>
617
									</td>
618
								</tr>
619
								<tr>
620
									<td>
621
<?php
622
									if ($i == 0):
623
?>
624
										<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" />
625
<?php
626
									else:
627
?>
628
										<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?");?>')" />
629
<?php
630
									endif;
631
?>
632
									</td>
633
								</tr>
634
							</table>
635
						</td>
636
					</tr>
637
					<tr>
638
						<td colspan="8">
639
							<p>
640
								<span class="vexpl">
641
									<span class="red">
642
										<strong><?=gettext("Note"); ?>:<br /></strong>
643
									</span>
644
									<?=gettext("You can check your IPsec status at"); ?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br />
645
									<?=gettext("IPsec Debug Mode can be enabled at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.<br />
646
									<?=gettext("IPsec can be set to prefer older SAs at"); ?> <a href="vpn_ipsec_settings.php"><?=gettext("VPN:IPsec:Advanced Settings"); ?></a>.
647
								</span>
648
							</p>
649
						</td>
650
					</tr>
651
				</table>
652
			</div>
653
		</td>
654
	</tr>
655
</table>
656
</form>
657
<?php include("fend.inc"); ?>
658
<script type="text/javascript">
659
//<![CDATA[
660
function show_phase2(id, buttonid) {
661
	document.getElementById(buttonid).innerHTML='';
662
	document.getElementById(id).style.display = "block";
663
	var visible = id + '-visible';
664
	document.getElementById(visible).value = "1";
665
}
666
//]]>
667
</script>
668
</body>
669
</html>
(237-237/256)