Project

General

Profile

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

    
455
									$fr_c = $fr_prefix . "c" . $j;
456
									$fr_d = $fr_prefix . "d" . $j;
457

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