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