Projet

Général

Profil

Télécharger (24 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / vpn_ipsec.php @ 495c7f0c

1
<?php
2
/*
3
	vpn_ipsec.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5

    
6
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
7
	Copyright (C) 2008 Shrew Soft Inc
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31

    
32
##|+PRIV
33
##|*IDENT=page-vpn-ipsec
34
##|*NAME=VPN: IPsec page
35
##|*DESCR=Allow access to the 'VPN: IPsec' page.
36
##|*MATCH=vpn_ipsec.php*
37
##|-PRIV
38

    
39
require("guiconfig.inc");
40
require_once("functions.inc");
41
require_once("filter.inc");
42
require_once("shaper.inc");
43
require_once("ipsec.inc");
44
require_once("vpn.inc");
45

    
46
if (!is_array($config['ipsec']['phase1']))
47
	$config['ipsec']['phase1'] = array();
48

    
49
if (!is_array($config['ipsec']['phase2']))
50
	$config['ipsec']['phase2'] = array();
51

    
52
$a_phase1 = &$config['ipsec']['phase1'];
53
$a_phase2 = &$config['ipsec']['phase2'];
54

    
55
$pconfig['enable'] = isset($config['ipsec']['enable']);
56

    
57
if ($_POST) {
58
	if ($_POST['apply']) {
59
		$retval = 0;
60
		$retval = vpn_ipsec_configure();
61
		/* reload the filter in the background */
62
		filter_configure();
63
		$savemsg = get_std_save_message($retval);
64
		if ($retval >= 0) {
65
			if (is_subsystem_dirty('ipsec'))
66
				clear_subsystem_dirty('ipsec');
67
		}
68
	} else if ($_POST['submit']) {
69
		$pconfig = $_POST;
70

    
71
		$config['ipsec']['enable'] = $_POST['enable'] ? true : false;
72

    
73
		write_config();
74

    
75
		$retval = vpn_ipsec_configure();
76
	} else if (isset($_POST['del_x'])) {
77
		/* delete selected p1 entries */
78
		if (is_array($_POST['p1entry']) && count($_POST['p1entry'])) {
79
			foreach ($_POST['p1entry'] as $p1entrydel) {
80
				unset($a_phase1[$p1entrydel]);
81
			}
82
			if (write_config())
83
				mark_subsystem_dirty('ipsec');
84
			header("Location: vpn_ipsec.php");
85
			exit;
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
			header("Location: vpn_ipsec.php");
96
			exit;
97
		}
98
	} else {
99
		/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
100
		unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
101
		foreach ($_POST as $pn => $pd) {
102
			if (preg_match("/del_(\d+)_x/", $pn, $matches)) {
103
				$delbtn = $matches[1];
104
			} else if (preg_match("/delp2_(\d+)_x/", $pn, $matches)) {
105
				$delbtnp2 = $matches[1];
106
			} else if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
107
				$movebtn = $matches[1];
108
			} else if (preg_match("/movep2_(\d+)_x/", $pn, $matches)) {
109
				$movebtnp2 = $matches[1];
110
			} else if (preg_match("/toggle_(\d+)_x/", $pn, $matches)) {
111
				$togglebtn = $matches[1];
112
			} else if (preg_match("/togglep2_(\d+)_x/", $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
			header("Location: vpn_ipsec.php");
215
			exit;
216
		}
217
	}
218
}
219

    
220
$pgtitle = array(gettext("VPN"),gettext("IPsec"));
221
$shortcut_section = "ipsec";
222

    
223
include("head.inc");
224

    
225
?>
226

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

    
323
								$carplist = get_configured_carp_interface_list();
324
								foreach ($carplist as $cif => $carpip)
325
									$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
326

    
327
								$aliaslist = get_configured_ip_aliases_list();
328
								foreach ($aliaslist as $aliasip => $aliasif)
329
									$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
330

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

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

    
452
									$fr_c = $fr_prefix . "c" . $j;
453
									$fr_d = $fr_prefix . "d" . $j;
454

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