Project

General

Profile

Download (15.1 KB) Statistics
| Branch: | Tag: | Revision:
1 cf7d1057 Scott Ullrich
<?php
2
/*
3
	diag_ipsec.php
4
*/
5 fd9ebcd5 Stephen Beaver
/* ====================================================================
6 0da0d43e Phil Davis
 *  Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7 90719498 Phil Davis
 *  portions Copyright (c) 2008 Shrew Soft Inc <mgrooms@shrew.net>.
8 86b2861c Matt Smith
 *
9
 *  Parts of this code originally based on vpn_ipsec_sad.php from m0n0wall,
10 0dc2d195 Phil Davis
 *  Copyright (c) 2003-2004 Manuel Kasper (BSD 2 clause)
11 fd9ebcd5 Stephen Beaver
 *
12 0da0d43e Phil Davis
 *  Redistribution and use in source and binary forms, with or without modification,
13
 *  are permitted provided that the following conditions are met:
14 fd9ebcd5 Stephen Beaver
 *
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
20
 *      the documentation and/or other materials provided with the
21 0da0d43e Phil Davis
 *      distribution.
22 fd9ebcd5 Stephen Beaver
 *
23 0da0d43e Phil Davis
 *  3. All advertising materials mentioning features or use of this software
24 fd9ebcd5 Stephen Beaver
 *      must display the following acknowledgment:
25
 *      "This product includes software developed by the pfSense Project
26 0da0d43e Phil Davis
 *       for use in the pfSense software distribution. (http://www.pfsense.org/).
27 fd9ebcd5 Stephen Beaver
 *
28
 *  4. The names "pfSense" and "pfSense Project" must not be used to
29
 *       endorse or promote products derived from this software without
30
 *       prior written permission. For written permission, please contact
31
 *       coreteam@pfsense.org.
32
 *
33
 *  5. Products derived from this software may not be called "pfSense"
34
 *      nor may "pfSense" appear in their names without prior written
35
 *      permission of the Electric Sheep Fencing, LLC.
36
 *
37
 *  6. Redistributions of any form whatsoever must retain the following
38
 *      acknowledgment:
39
 *
40
 *  "This product includes software developed by the pfSense Project
41
 *  for use in the pfSense software distribution (http://www.pfsense.org/).
42 0da0d43e Phil Davis
 *
43 fd9ebcd5 Stephen Beaver
 *  THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
44
 *  EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
47
 *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
49
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
50
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51
 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
52
 *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
54
 *  OF THE POSSIBILITY OF SUCH DAMAGE.
55
 *
56
 *  ====================================================================
57
 *
58
 */
59 cf7d1057 Scott Ullrich
60 13d193c2 Scott Ullrich
/*
61 3795cc0a sbeaver
	pfSense_MODULE: ipsec
62 13d193c2 Scott Ullrich
*/
63
64 6b07c15a Matthew Grooms
##|+PRIV
65
##|*IDENT=page-status-ipsec
66
##|*NAME=Status: IPsec page
67
##|*DESCR=Allow access to the 'Status: IPsec' page.
68
##|*MATCH=diag_ipsec.php*
69
##|-PRIV
70
71
72 a93e56c5 Matthew Grooms
global $g;
73
74 699737d9 Phil Davis
$pgtitle = array(gettext("Status"), gettext("IPsec"));
75 b32dd0a6 jim-p
$shortcut_section = "ipsec";
76 cf7d1057 Scott Ullrich
77
require("guiconfig.inc");
78
include("head.inc");
79 3b5918ba Chris Buechler
require_once("ipsec.inc");
80 a93e56c5 Matthew Grooms
81 17402c63 Ermal
if ($_GET['act'] == 'connect') {
82
	if (ctype_digit($_GET['ikeid'])) {
83 483c3b5b Ermal LUÇI
		$ph1ent = ipsec_get_phase1($_GET['ikeid']);
84
		if (!empty($ph1ent)) {
85 43531ed7 Phil Davis
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == 'ikev1') {
86 483c3b5b Ermal LUÇI
				$ph2entries = ipsec_get_number_of_phase2($_GET['ikeid']);
87
				for ($i = 0; $i < $ph2entries; $i++) {
88
					$connid = escapeshellarg("con{$_GET['ikeid']}00{$i}");
89
					mwexec("/usr/local/sbin/ipsec down {$connid}");
90
					mwexec("/usr/local/sbin/ipsec up {$connid}");
91
				}
92
			} else {
93
				mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
94
				mwexec("/usr/local/sbin/ipsec up con" . escapeshellarg($_GET['ikeid']));
95
			}
96
		}
97 6e8b0ec3 jim-p
	}
98 17402c63 Ermal
} else if ($_GET['act'] == 'ikedisconnect') {
99
	if (ctype_digit($_GET['ikeid'])) {
100 5f601060 Phil Davis
		if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
101 e952906e Ermal
			mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "[" . escapeshellarg($_GET['ikesaid']) . "]");
102 5f601060 Phil Davis
		} else {
103 e952906e Ermal
			mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
104 5f601060 Phil Davis
		}
105 614be051 bcyrill
	}
106 e952906e Ermal
} else if ($_GET['act'] == 'childdisconnect') {
107
	if (ctype_digit($_GET['ikeid'])) {
108 5f601060 Phil Davis
		if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
109 e952906e Ermal
			mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "{" . escapeshellarg($_GET['ikesaid']) . "}");
110 5f601060 Phil Davis
		}
111 6e0b68bf jim-p
	}
112
}
113
114 5f601060 Phil Davis
if (!is_array($config['ipsec']['phase1'])) {
115 3795cc0a sbeaver
	$config['ipsec']['phase1'] = array();
116 5f601060 Phil Davis
}
117 a93e56c5 Matthew Grooms
118 fd875a8d Ermal
$a_phase1 = &$config['ipsec']['phase1'];
119 a93e56c5 Matthew Grooms
120 1dade399 Renato Botelho
$status = ipsec_list_sa();
121 a93e56c5 Matthew Grooms
122 3795cc0a sbeaver
$tab_array = array();
123
$tab_array[] = array(gettext("Overview"), true, "diag_ipsec.php");
124
$tab_array[] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
125
$tab_array[] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
126
$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
127 08d333ae Stephen Beaver
$tab_array[] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec");
128 3795cc0a sbeaver
display_top_tabs($tab_array);
129 c7fbdd6c Ermal
?>
130 3795cc0a sbeaver
131
<div class="panel panel-default">
132
	<div class="panel-heading">IPSec status</div>
133
	<div class="panel-body table responsive">
134 10fe1eb5 Stephen Beaver
		<table class="table table-striped table-condensed table-hover sortable-theme-bootstrap" data-sortable>
135 3795cc0a sbeaver
			<thead>
136
				<tr>
137
					<th><?=gettext("Description")?></th>
138
					<th><?=gettext("Local ID")?></th>
139
					<th><?=gettext("Local IP")?></th>
140
					<th><?=gettext("Remote ID")?></th>
141
					<th><?=gettext("Remote IP")?></th>
142
					<th><?=gettext("Role")?></th>
143
					<th><?=gettext("Reauth")?></th>
144
					<th><?=gettext("Algo")?></th>
145
					<th><?=gettext("Status")?></th>
146
					<th></th>
147
				</tr>
148
			</thead>
149
			<tbody>
150
<?php
151
$ipsecconnected = array();
152
153 86b2861c Matt Smith
if (is_array($status)) {
154
	foreach ($status as $ikeid => $ikesa) {
155
	$con_id = substr($ikeid, 3);
156 0da0d43e Phil Davis
157 3795cc0a sbeaver
		if ($ikesa['version'] == 1) {
158
			$ph1idx = substr($con_id, 0, strrpos(substr($con_id, 0, -1), '00'));
159
			$ipsecconnected[$ph1idx] = $ph1idx;
160
		} else {
161
			$ipsecconnected[$con_id] = $ph1idx = $con_id;
162
		}
163
?>
164
				<tr>
165
					<td>
166
						<?=htmlspecialchars(ipsec_get_descr($ph1idx))?>
167
					</td>
168
					<td>
169
<?php
170 86b2861c Matt Smith
		if (!empty($ikesa['local-id'])) {
171
			if ($ikesa['local-id'] == '%any') {
172
				print(gettext('Any identifier'));
173 5f601060 Phil Davis
			} else {
174 86b2861c Matt Smith
				print(htmlspecialchars($ikesa['local-id']));
175 5f601060 Phil Davis
			}
176 86b2861c Matt Smith
		} else {
177
			print(gettext("Unknown"));
178
		}
179
180 6795e0da Renato Botelho
?>
181 3795cc0a sbeaver
					</td>
182
					<td>
183 6795e0da Renato Botelho
<?php
184 86b2861c Matt Smith
		if (!empty($ikesa['local-host'])) {
185
			print(htmlspecialchars($ikesa['local-host']));
186
		} else {
187
			print(gettext("Unknown"));
188
		}
189 936bfb38 Renato Botelho
		/*
190
		 * XXX: local-nat-t was defined by pfSense
191
		 * When strongswan team accepted the change, they changed it to
192
		 * nat-local. Keep both for a while and remove local-nat-t in
193
		 * the future
194
		 */
195 2f95dc5a Renato Botelho
		if (isset($ikesa['local-nat-t']) || isset($ikesa['nat-local'])) {
196 86b2861c Matt Smith
			print(" NAT-T");
197
		}
198 6795e0da Renato Botelho
?>
199 0da0d43e Phil Davis
					</td>
200 3795cc0a sbeaver
					<td>
201 6795e0da Renato Botelho
<?php
202 86b2861c Matt Smith
		$identity = "";
203
		if (!empty($ikesa['remote-id'])) {
204
			if ($ikesa['remote-id'] == '%any') {
205
				$identity = 'Any identifier';
206
			} else {
207
				$identity = htmlspecialchars($ikesa['remote']['identification']);
208
			}
209
		}
210
		if (!empty($ikesa['remote-xauth-id'])) {
211
			echo htmlspecialchars($ikesa['remote-xauth-id']);
212
			echo "<br/>{$identity}";
213
		} elseif (!empty($ikesa['remote-eap-id'])) {
214
			echo htmlspecialchars($ikesa['remote-eap-id']);
215
			echo "<br/>{$identity}";
216
		} else {
217
			if (empty($identity)) {
218 3795cc0a sbeaver
				print(gettext("Unknown"));
219 86b2861c Matt Smith
			} else {
220
				print($identity);
221 3795cc0a sbeaver
			}
222 86b2861c Matt Smith
		}
223 6795e0da Renato Botelho
?>
224 3795cc0a sbeaver
					</td>
225
					<td>
226 6795e0da Renato Botelho
<?php
227 86b2861c Matt Smith
		if (!empty($ikesa['remote-host'])) {
228
			print(htmlspecialchars($ikesa['remote-host']));
229
		} else {
230
			print(gettext("Unknown"));
231
		}
232 936bfb38 Renato Botelho
		/*
233
		 * XXX: remote-nat-t was defined by pfSense
234
		 * When strongswan team accepted the change, they changed it to
235
		 * nat-remote. Keep both for a while and remove remote-nat-t in
236
		 * the future
237
		 */
238
		if (isset($ikesa['remote-nat-t']) || isset($ikesa['nat-remote'])) {
239 86b2861c Matt Smith
			print(" NAT-T");
240
		}
241 6795e0da Renato Botelho
?>
242 4a098495 Sjon Hortensius
					</td>
243 3795cc0a sbeaver
					<td>
244
						IKEv<?=htmlspecialchars($ikesa['version'])?>
245
						<br/>
246 86b2861c Matt Smith
<?php
247
		if ($ikesa['initiator'] == 'yes') {
248
			print("initiator");
249
		} else {
250
			print("responder");
251
		}
252
?>
253 3795cc0a sbeaver
					</td>
254
					<td>
255 00ae4060 Matt Smith
						<?=htmlspecialchars($ikesa['reauth-time']) . gettext(" seconds (") . convert_seconds_to_hms($ikesa['reauth-time']) . ")";?>
256 3795cc0a sbeaver
					</td>
257
					<td>
258 86b2861c Matt Smith
						<?=htmlspecialchars($ikesa['encr-alg'])?>
259 3795cc0a sbeaver
						<br/>
260 86b2861c Matt Smith
						<?=htmlspecialchars($ikesa['integ-alg'])?>
261 3795cc0a sbeaver
						<br/>
262 86b2861c Matt Smith
						<?=htmlspecialchars($ikesa['prf-alg'])?>
263 3795cc0a sbeaver
						<br/>
264 86b2861c Matt Smith
						<?=htmlspecialchars($ikesa['dh-group'])?>
265 3795cc0a sbeaver
					</td>
266
					<td>
267
<?php
268 86b2861c Matt Smith
		if ($ikesa['state'] == 'ESTABLISHED') {
269
			print('<span style="color:green">');
270
		} else {
271
			print('<span>');
272
		}
273 6795e0da Renato Botelho
?>
274 86b2861c Matt Smith
						<?=ucfirst(htmlspecialchars($ikesa['state']))?>
275 00ae4060 Matt Smith
						<br/><?=htmlspecialchars($ikesa['established']) . gettext(" seconds (" . convert_seconds_to_hms($ikesa['established']) . ") ago")?>
276 3795cc0a sbeaver
						</span>
277
					</td>
278
					<td >
279 6795e0da Renato Botelho
<?php
280 2804a932 Luiz Otavio O Souza
		if ($ikesa['state'] != 'ESTABLISHED') {
281 6795e0da Renato Botelho
?>
282 4a098495 Sjon Hortensius
					<a href="diag_ipsec.php?act=connect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-success" data-toggle="tooltip" title="Connect VPN" >
283 3795cc0a sbeaver
							<?=gettext("Connect VPN")?>
284 17402c63 Ermal
						</a>
285 6795e0da Renato Botelho
<?php
286 86b2861c Matt Smith
		} else {
287 6795e0da Renato Botelho
?>
288 3795cc0a sbeaver
						<a href="diag_ipsec.php?act=ikedisconnect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Disconnect VPN">
289
							<?=gettext("Disconnect")?>
290
						</a><br />
291 86b2861c Matt Smith
						<a href="diag_ipsec.php?act=ikedisconnect&amp;ikeid=<?=$con_id; ?>&amp;ikesaid=<?=$ikesa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="Disconnect VPN connection">
292 3795cc0a sbeaver
							<?=gettext("Disconnect")?>
293 e952906e Ermal
						</a>
294 6795e0da Renato Botelho
<?php
295 86b2861c Matt Smith
		}
296 6795e0da Renato Botelho
?>
297 3795cc0a sbeaver
					</td>
298
				</tr>
299
				<tr>
300
					<td colspan = 10>
301 6795e0da Renato Botelho
<?php
302 97242546 Matt Smith
		if (is_array($ikesa['child-sas']) && (count($ikesa['child-sas']) > 0)) {
303 6795e0da Renato Botelho
?>
304 3795cc0a sbeaver
						<div id="btnchildsa-<?=$ikeid?>">
305
							<a type="button" onclick="show_childsa('childsa-<?=$ikeid?>','btnchildsa-<?=$ikeid?>');" class="btn btn-sm btn-default" />
306
								<?=gettext('Show child SA entries')?>
307
							</a>
308
						</div>
309 fd875a8d Ermal
310 3795cc0a sbeaver
						<table class="table table-hover table-condensed" id="childsa-<?=$ikeid?>" style="display:none">
311
							<thead>
312
								<tr class="info">
313
									<th><?=gettext("Local subnets")?></th>
314
									<th><?=gettext("Local SPI(s)")?></th>
315
									<th><?=gettext("Remote subnets")?></th>
316
									<th><?=gettext("Times")?></th>
317
									<th><?=gettext("Algo")?></th>
318
									<th><?=gettext("Stats")?></th>
319
									<th><!-- Buttons --></th>
320
								</tr>
321
							</thead>
322
							<tbody>
323
<?php
324 86b2861c Matt Smith
			foreach ($ikesa['child-sas'] as $childid => $childsa) {
325 3795cc0a sbeaver
?>
326
								<tr>
327
									<td>
328
<?php
329 86b2861c Matt Smith
				if (is_array($childsa['local-ts'])) {
330
					foreach ($childsa['local-ts'] as $lnets) {
331 3795cc0a sbeaver
						print(htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />");
332 86b2861c Matt Smith
					}
333
				} else {
334 3795cc0a sbeaver
					print(gettext("Unknown"));
335 86b2861c Matt Smith
				}
336 6795e0da Renato Botelho
?>
337 3795cc0a sbeaver
									</td>
338
									<td>
339 6795e0da Renato Botelho
<?php
340 86b2861c Matt Smith
				if (isset($childsa['spi-in'])) {
341
					print(gettext("Local: ") . htmlspecialchars($childsa['spi-in']));
342
				}
343 0da0d43e Phil Davis
344 86b2861c Matt Smith
				if (isset($childsa['spi-out'])) {
345
					print('<br/>' . gettext('Remote: ') . htmlspecialchars($childsa['spi-out']));
346
				}
347 6795e0da Renato Botelho
?>
348 3795cc0a sbeaver
									</td>
349
									<td>
350 6795e0da Renato Botelho
<?php
351 86b2861c Matt Smith
				if (is_array($childsa['remote-ts'])) {
352
					foreach ($childsa['remote-ts'] as $rnets) {
353 3795cc0a sbeaver
						print(htmlspecialchars(ipsec_fixup_network($rnets)) . '<br />');
354 86b2861c Matt Smith
					}
355
				} else {
356 3795cc0a sbeaver
					print(gettext("Unknown"));
357 86b2861c Matt Smith
				}
358 6795e0da Renato Botelho
?>
359 3795cc0a sbeaver
									</td>
360
									<td>
361 6795e0da Renato Botelho
<?php
362 00ae4060 Matt Smith
				print(gettext("Rekey: ") . htmlspecialchars($childsa['rekey-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['rekey-time']) . ")");
363
				print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")" );
364
				print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")" );
365 3795cc0a sbeaver
366 6795e0da Renato Botelho
?>
367 3795cc0a sbeaver
									</td>
368
									<td>
369
<?php
370 86b2861c Matt Smith
				print(htmlspecialchars($childsa['encr-alg']) . '<br/>');
371
				print(htmlspecialchars($childsa['integ-alg']) . '<br/>');
372 0da0d43e Phil Davis
373 86b2861c Matt Smith
				if (!empty($childsa['prf-alg'])) {
374
					print(htmlspecialchars($childsa['prf-alg']) . '<br/>');
375
				}
376
				if (!empty($childsa['dh-group'])) {
377
					print(htmlspecialchars($childsa['dh-group']) . '<br/>');
378
				}
379
				if (!empty($childsa['esn'])) {
380 6de4dd1d Phil Davis
					print(htmlspecialchars($childsa['esn']) . '<br/>');
381 86b2861c Matt Smith
				}
382 0da0d43e Phil Davis
383 86b2861c Matt Smith
				print(gettext("IPComp: "));
384
				if (!empty($childsa['cpi-in']) || !empty($childsa['cpi-out'])) {
385
					print(htmlspecialchars($childsa['cpi-in']) . " " . htmlspecialchars($childsa['cpi-out']));
386
				} else {
387
					print(gettext('none'));
388
				}
389 3795cc0a sbeaver
?>
390
									</td>
391
									<td>
392
<?php
393 d0499e38 jim-p
				print(gettext("Bytes-In: ") . htmlspecialchars(number_format($childsa['bytes-in'])) . ' (' . htmlspecialchars(format_bytes($childsa['bytes-in'])) . ')<br/>');
394
				print(gettext("Packets-In: ") . htmlspecialchars(number_format($childsa['packets-in'])) . '<br/>');
395
				print(gettext("Bytes-Out: ") . htmlspecialchars(number_format($childsa['bytes-out'])) . ' (' . htmlspecialchars(format_bytes($childsa['bytes-out'])) . ')<br/>');
396
				print(gettext("Packets-Out: ") . htmlspecialchars(number_format($childsa['packets-out'])) . '<br/>');
397 3795cc0a sbeaver
?>
398
									</td>
399
									<td>
400 97242546 Matt Smith
										<a href="diag_ipsec.php?act=childdisconnect&amp;ikeid=<?=$con_id; ?>&amp;ikesaid=<?=$childsa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="<?=gettext('Disconnect Child SA')?>">
401 3795cc0a sbeaver
											<?=gettext("Disconnect")?>
402
										</a>
403
									</td>
404
								</tr>
405
<?php
406 86b2861c Matt Smith
			}
407 b907136c Renato Botelho
?>
408 3795cc0a sbeaver
409
							</tbody>
410
						</table>
411
					</td>
412
				</tr>
413 b907136c Renato Botelho
<?php
414 97242546 Matt Smith
		}
415 3795cc0a sbeaver
416
		unset($con_id);
417 97242546 Matt Smith
	}
418
419 86b2861c Matt Smith
}
420 3795cc0a sbeaver
421
$rgmap = array();
422 86b2861c Matt Smith
foreach ($a_phase1 as $ph1ent) {
423
	if (isset($ph1ent['disabled'])) {
424 3795cc0a sbeaver
		continue;
425 86b2861c Matt Smith
	}
426 0da0d43e Phil Davis
427 3795cc0a sbeaver
	$rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway'];
428 0da0d43e Phil Davis
429 86b2861c Matt Smith
	if ($ipsecconnected[$ph1ent['ikeid']]) {
430 3795cc0a sbeaver
		continue;
431 86b2861c Matt Smith
	}
432 3795cc0a sbeaver
?>
433
				<tr>
434
					<td>
435
<?php
436
	print(htmlspecialchars($ph1ent['descr']));
437
?>
438
					</td>
439
					<td>
440
<?php
441
	list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
442
	if (empty($myid_data))
443
		print(gettext("Unknown"));
444
	else
445
		print(htmlspecialchars($myid_data));
446
?>
447
					</td>
448
					<td>
449
<?php
450
	$ph1src = ipsec_get_phase1_src($ph1ent);
451 0da0d43e Phil Davis
452 3795cc0a sbeaver
	if (empty($ph1src))
453
		print(gettext("Unknown"));
454
	else
455
		print(htmlspecialchars($ph1src));
456
?>
457
					</td>
458
					<td>
459
<?php
460
	list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
461
	if (empty($peerid_data))
462
		print(gettext("Unknown"));
463
	else
464
		print(htmlspecialchars($peerid_data));
465
?>
466
					</td>
467
					<td>
468
<?php
469
	$ph1src = ipsec_get_phase1_dst($ph1ent);
470
	if (empty($ph1src))
471
		print(gettext("Unknown"));
472
	else
473
		print(htmlspecialchars($ph1src));
474
?>
475
					</td>
476
					<td>
477
					</td>
478
					<td>
479
					</td>
480
					<td>
481
					</td>
482
<?php
483 86b2861c Matt Smith
	if (isset($ph1ent['mobile'])) {
484 3795cc0a sbeaver
?>
485
					<td>
486
						<?=gettext("Awaiting connections")?>
487
					</td>
488
					<td>
489
					</td>
490
<?php
491 86b2861c Matt Smith
	} else {
492 3795cc0a sbeaver
?>
493
					<td>
494
						<?=gettext("Disconnected")?>
495
					</td>
496
					<td >
497
						<a href="diag_ipsec.php?act=connect&amp;ikeid=<?=$ph1ent['ikeid']; ?>" class="btn btn-xs btn-success">
498
							<?=gettext("Connect VPN")?>
499 6795e0da Renato Botelho
						</a>
500 3795cc0a sbeaver
					</td>
501 b907136c Renato Botelho
<?php
502 86b2861c Matt Smith
	}
503 b907136c Renato Botelho
?>
504 6ed90cfd Chris Buechler
					<td>
505 3795cc0a sbeaver
					</td>
506
				</tr>
507 fd875a8d Ermal
<?php
508 86b2861c Matt Smith
}
509 3795cc0a sbeaver
unset($ipsecconnected, $phase1, $rgmap);
510 c7fbdd6c Ermal
?>
511 3795cc0a sbeaver
			</tbody>
512 c7fbdd6c Ermal
		</table>
513
	</div>
514 3795cc0a sbeaver
</div>
515
516 c7fbdd6c Ermal
<script type="text/javascript">
517 a8590dd6 Colin Fleming
//<![CDATA[
518 c7fbdd6c Ermal
function show_childsa(id, buttonid) {
519
	document.getElementById(buttonid).innerHTML='';
520
	aodiv = document.getElementById(id);
521
	aodiv.style.display = "block";
522
}
523 a8590dd6 Colin Fleming
//]]>
524 c7fbdd6c Ermal
</script>
525 3795cc0a sbeaver
526
<?php
527
unset($status);
528
print_info_box(gettext("You can configure IPsec ") . '<a href="vpn_ipsec.php">Here</a>');
529
include("foot.inc"); ?>