Project

General

Profile

Download (24.3 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / vpn_ipsec.php @ a1b66bec

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
		}
85
	} else if (isset($_POST['delp2_x'])) {
86
		/* delete selected p2 entries */
87
		if (is_array($_POST['p2entry']) && count($_POST['p2entry'])) {
88
			foreach ($_POST['p2entry'] as $p2entrydel) {
89
				unset($a_phase2[$p2entrydel]);
90
			}
91
			if (write_config())
92
				mark_subsystem_dirty('ipsec');
93
		}
94
	} else {
95
		/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
96
		unset($delbtn, $delbtnp2, $movebtn, $movebtnp2, $togglebtn, $togglebtnp2);
97
		foreach ($_POST as $pn => $pd) {
98
			if (preg_match("/del_(\d+)_x/", $pn, $matches)) {
99
				$delbtn = $matches[1];
100
			} else if (preg_match("/delp2_(\d+)_x/", $pn, $matches)) {
101
				$delbtnp2 = $matches[1];
102
			} else if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
103
				$movebtn = $matches[1];
104
			} else if (preg_match("/movep2_(\d+)_x/", $pn, $matches)) {
105
				$movebtnp2 = $matches[1];
106
			} else if (preg_match("/toggle_(\d+)_x/", $pn, $matches)) {
107
				$togglebtn = $matches[1];
108
			} else if (preg_match("/togglep2_(\d+)_x/", $pn, $matches)) {
109
				$togglebtnp2 = $matches[1];
110
			}
111
		}
112

    
113
		$save = 1;
114

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

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

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

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

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

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

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

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

    
163
			/* copy $movebtnp2 p2 entry */
164
			if ($movebtnp2 < count($a_phase2))
165
				$a_phase2_new[] = $a_phase2[$movebtnp2];
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
			if (count($a_phase2_new) > 0)
173
				$a_phase2 = $a_phase2_new;
174

    
175
		} else if (isset($togglebtn)) {
176
			if (isset($a_phase1[$togglebtn]['disabled']))
177
				unset($a_phase1[$togglebtn]['disabled']);
178
			else
179
				$a_phase1[$togglebtn]['disabled'] = true;
180

    
181
		} else if (isset($togglebtnp2)) {
182
			if (isset($a_phase2[$togglebtnp2]['disabled']))
183
				unset($a_phase2[$togglebtnp2]['disabled']);
184
			else
185
				$a_phase2[$togglebtnp2]['disabled'] = true;
186

    
187
		} else if (isset($delbtn)) {
188
			/* remove static route if interface is not WAN */
189
			if ($a_phase1[$delbtn]['interface'] <> "wan")
190
				mwexec("/sbin/route delete -host {$a_phase1[$delbtn]['remote-gateway']}");
191

    
192
			/* remove all phase2 entries that match the ikeid */
193
			$ikeid = $a_phase1[$delbtn]['ikeid'];
194
			foreach ($a_phase2 as $p2index => $ph2tmp)
195
				if ($ph2tmp['ikeid'] == $ikeid) {
196
					unset($a_phase2[$p2index]);
197
				}
198

    
199
			unset($a_phase1[$delbtn]);
200

    
201
		} else if (isset($delbtnp2)) {
202
			unset($a_phase2[$delbtnp2]);
203

    
204
		} else
205
			$save = 0;
206

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

    
214
$pgtitle = array(gettext("VPN"),gettext("IPsec"));
215
$shortcut_section = "ipsec";
216

    
217
include("head.inc");
218

    
219
?>
220

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

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

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

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

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

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

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