1 |
cf7d1057
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
1af5edbf
|
Stephen Beaver
|
status_ipsec.php
|
4 |
cf7d1057
|
Scott Ullrich
|
*/
|
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 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
61 |
|
|
##|*IDENT=page-status-ipsec
|
62 |
5230f468
|
jim-p
|
##|*NAME=Status: IPsec
|
63 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Status: IPsec' page.
|
64 |
1af5edbf
|
Stephen Beaver
|
##|*MATCH=status_ipsec.php*
|
65 |
6b07c15a
|
Matthew Grooms
|
##|-PRIV
|
66 |
|
|
|
67 |
|
|
|
68 |
a93e56c5
|
Matthew Grooms
|
global $g;
|
69 |
|
|
|
70 |
2eff0148
|
Phil Davis
|
$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("Overview"));
|
71 |
b32dd0a6
|
jim-p
|
$shortcut_section = "ipsec";
|
72 |
cf7d1057
|
Scott Ullrich
|
|
73 |
|
|
require("guiconfig.inc");
|
74 |
|
|
include("head.inc");
|
75 |
3b5918ba
|
Chris Buechler
|
require_once("ipsec.inc");
|
76 |
a93e56c5
|
Matthew Grooms
|
|
77 |
17402c63
|
Ermal
|
if ($_GET['act'] == 'connect') {
|
78 |
|
|
if (ctype_digit($_GET['ikeid'])) {
|
79 |
483c3b5b
|
Ermal LUÇI
|
$ph1ent = ipsec_get_phase1($_GET['ikeid']);
|
80 |
|
|
if (!empty($ph1ent)) {
|
81 |
43531ed7
|
Phil Davis
|
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == 'ikev1') {
|
82 |
483c3b5b
|
Ermal LUÇI
|
$ph2entries = ipsec_get_number_of_phase2($_GET['ikeid']);
|
83 |
|
|
for ($i = 0; $i < $ph2entries; $i++) {
|
84 |
|
|
$connid = escapeshellarg("con{$_GET['ikeid']}00{$i}");
|
85 |
|
|
mwexec("/usr/local/sbin/ipsec down {$connid}");
|
86 |
|
|
mwexec("/usr/local/sbin/ipsec up {$connid}");
|
87 |
|
|
}
|
88 |
|
|
} else {
|
89 |
|
|
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
|
90 |
|
|
mwexec("/usr/local/sbin/ipsec up con" . escapeshellarg($_GET['ikeid']));
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
6e8b0ec3
|
jim-p
|
}
|
94 |
17402c63
|
Ermal
|
} else if ($_GET['act'] == 'ikedisconnect') {
|
95 |
|
|
if (ctype_digit($_GET['ikeid'])) {
|
96 |
5f601060
|
Phil Davis
|
if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
|
97 |
e952906e
|
Ermal
|
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "[" . escapeshellarg($_GET['ikesaid']) . "]");
|
98 |
5f601060
|
Phil Davis
|
} else {
|
99 |
e952906e
|
Ermal
|
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
|
100 |
5f601060
|
Phil Davis
|
}
|
101 |
614be051
|
bcyrill
|
}
|
102 |
e952906e
|
Ermal
|
} else if ($_GET['act'] == 'childdisconnect') {
|
103 |
|
|
if (ctype_digit($_GET['ikeid'])) {
|
104 |
5f601060
|
Phil Davis
|
if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
|
105 |
e952906e
|
Ermal
|
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "{" . escapeshellarg($_GET['ikesaid']) . "}");
|
106 |
5f601060
|
Phil Davis
|
}
|
107 |
6e0b68bf
|
jim-p
|
}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
5f601060
|
Phil Davis
|
if (!is_array($config['ipsec']['phase1'])) {
|
111 |
3795cc0a
|
sbeaver
|
$config['ipsec']['phase1'] = array();
|
112 |
5f601060
|
Phil Davis
|
}
|
113 |
a93e56c5
|
Matthew Grooms
|
|
114 |
fd875a8d
|
Ermal
|
$a_phase1 = &$config['ipsec']['phase1'];
|
115 |
a93e56c5
|
Matthew Grooms
|
|
116 |
1dade399
|
Renato Botelho
|
$status = ipsec_list_sa();
|
117 |
a93e56c5
|
Matthew Grooms
|
|
118 |
3795cc0a
|
sbeaver
|
$tab_array = array();
|
119 |
1af5edbf
|
Stephen Beaver
|
$tab_array[] = array(gettext("Overview"), true, "status_ipsec.php");
|
120 |
|
|
$tab_array[] = array(gettext("Leases"), false, "status_ipsec_leases.php");
|
121 |
|
|
$tab_array[] = array(gettext("SAD"), false, "status_ipsec_sad.php");
|
122 |
|
|
$tab_array[] = array(gettext("SPD"), false, "status_ipsec_spd.php");
|
123 |
3795cc0a
|
sbeaver
|
display_top_tabs($tab_array);
|
124 |
c7fbdd6c
|
Ermal
|
?>
|
125 |
3795cc0a
|
sbeaver
|
|
126 |
|
|
<div class="panel panel-default">
|
127 |
38c55a20
|
Chris Buechler
|
<div class="panel-heading">IPsec status</div>
|
128 |
3795cc0a
|
sbeaver
|
<div class="panel-body table responsive">
|
129 |
10fe1eb5
|
Stephen Beaver
|
<table class="table table-striped table-condensed table-hover sortable-theme-bootstrap" data-sortable>
|
130 |
3795cc0a
|
sbeaver
|
<thead>
|
131 |
|
|
<tr>
|
132 |
|
|
<th><?=gettext("Description")?></th>
|
133 |
|
|
<th><?=gettext("Local ID")?></th>
|
134 |
|
|
<th><?=gettext("Local IP")?></th>
|
135 |
|
|
<th><?=gettext("Remote ID")?></th>
|
136 |
|
|
<th><?=gettext("Remote IP")?></th>
|
137 |
|
|
<th><?=gettext("Role")?></th>
|
138 |
|
|
<th><?=gettext("Reauth")?></th>
|
139 |
|
|
<th><?=gettext("Algo")?></th>
|
140 |
|
|
<th><?=gettext("Status")?></th>
|
141 |
|
|
<th></th>
|
142 |
|
|
</tr>
|
143 |
|
|
</thead>
|
144 |
|
|
<tbody>
|
145 |
|
|
<?php
|
146 |
|
|
$ipsecconnected = array();
|
147 |
|
|
|
148 |
86b2861c
|
Matt Smith
|
if (is_array($status)) {
|
149 |
|
|
foreach ($status as $ikeid => $ikesa) {
|
150 |
|
|
$con_id = substr($ikeid, 3);
|
151 |
0da0d43e
|
Phil Davis
|
|
152 |
3795cc0a
|
sbeaver
|
if ($ikesa['version'] == 1) {
|
153 |
|
|
$ph1idx = substr($con_id, 0, strrpos(substr($con_id, 0, -1), '00'));
|
154 |
|
|
$ipsecconnected[$ph1idx] = $ph1idx;
|
155 |
|
|
} else {
|
156 |
|
|
$ipsecconnected[$con_id] = $ph1idx = $con_id;
|
157 |
|
|
}
|
158 |
|
|
?>
|
159 |
|
|
<tr>
|
160 |
|
|
<td>
|
161 |
|
|
<?=htmlspecialchars(ipsec_get_descr($ph1idx))?>
|
162 |
|
|
</td>
|
163 |
|
|
<td>
|
164 |
|
|
<?php
|
165 |
86b2861c
|
Matt Smith
|
if (!empty($ikesa['local-id'])) {
|
166 |
|
|
if ($ikesa['local-id'] == '%any') {
|
167 |
|
|
print(gettext('Any identifier'));
|
168 |
5f601060
|
Phil Davis
|
} else {
|
169 |
86b2861c
|
Matt Smith
|
print(htmlspecialchars($ikesa['local-id']));
|
170 |
5f601060
|
Phil Davis
|
}
|
171 |
86b2861c
|
Matt Smith
|
} else {
|
172 |
|
|
print(gettext("Unknown"));
|
173 |
|
|
}
|
174 |
|
|
|
175 |
6795e0da
|
Renato Botelho
|
?>
|
176 |
3795cc0a
|
sbeaver
|
</td>
|
177 |
|
|
<td>
|
178 |
6795e0da
|
Renato Botelho
|
<?php
|
179 |
86b2861c
|
Matt Smith
|
if (!empty($ikesa['local-host'])) {
|
180 |
|
|
print(htmlspecialchars($ikesa['local-host']));
|
181 |
|
|
} else {
|
182 |
|
|
print(gettext("Unknown"));
|
183 |
|
|
}
|
184 |
936bfb38
|
Renato Botelho
|
/*
|
185 |
|
|
* XXX: local-nat-t was defined by pfSense
|
186 |
|
|
* When strongswan team accepted the change, they changed it to
|
187 |
|
|
* nat-local. Keep both for a while and remove local-nat-t in
|
188 |
|
|
* the future
|
189 |
|
|
*/
|
190 |
2f95dc5a
|
Renato Botelho
|
if (isset($ikesa['local-nat-t']) || isset($ikesa['nat-local'])) {
|
191 |
86b2861c
|
Matt Smith
|
print(" NAT-T");
|
192 |
|
|
}
|
193 |
6795e0da
|
Renato Botelho
|
?>
|
194 |
0da0d43e
|
Phil Davis
|
</td>
|
195 |
3795cc0a
|
sbeaver
|
<td>
|
196 |
6795e0da
|
Renato Botelho
|
<?php
|
197 |
86b2861c
|
Matt Smith
|
$identity = "";
|
198 |
|
|
if (!empty($ikesa['remote-id'])) {
|
199 |
|
|
if ($ikesa['remote-id'] == '%any') {
|
200 |
|
|
$identity = 'Any identifier';
|
201 |
|
|
} else {
|
202 |
|
|
$identity = htmlspecialchars($ikesa['remote']['identification']);
|
203 |
|
|
}
|
204 |
|
|
}
|
205 |
|
|
if (!empty($ikesa['remote-xauth-id'])) {
|
206 |
|
|
echo htmlspecialchars($ikesa['remote-xauth-id']);
|
207 |
|
|
echo "<br/>{$identity}";
|
208 |
|
|
} elseif (!empty($ikesa['remote-eap-id'])) {
|
209 |
|
|
echo htmlspecialchars($ikesa['remote-eap-id']);
|
210 |
|
|
echo "<br/>{$identity}";
|
211 |
|
|
} else {
|
212 |
|
|
if (empty($identity)) {
|
213 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
214 |
86b2861c
|
Matt Smith
|
} else {
|
215 |
|
|
print($identity);
|
216 |
3795cc0a
|
sbeaver
|
}
|
217 |
86b2861c
|
Matt Smith
|
}
|
218 |
6795e0da
|
Renato Botelho
|
?>
|
219 |
3795cc0a
|
sbeaver
|
</td>
|
220 |
|
|
<td>
|
221 |
6795e0da
|
Renato Botelho
|
<?php
|
222 |
86b2861c
|
Matt Smith
|
if (!empty($ikesa['remote-host'])) {
|
223 |
|
|
print(htmlspecialchars($ikesa['remote-host']));
|
224 |
|
|
} else {
|
225 |
|
|
print(gettext("Unknown"));
|
226 |
|
|
}
|
227 |
936bfb38
|
Renato Botelho
|
/*
|
228 |
|
|
* XXX: remote-nat-t was defined by pfSense
|
229 |
|
|
* When strongswan team accepted the change, they changed it to
|
230 |
|
|
* nat-remote. Keep both for a while and remove remote-nat-t in
|
231 |
|
|
* the future
|
232 |
|
|
*/
|
233 |
|
|
if (isset($ikesa['remote-nat-t']) || isset($ikesa['nat-remote'])) {
|
234 |
86b2861c
|
Matt Smith
|
print(" NAT-T");
|
235 |
|
|
}
|
236 |
6795e0da
|
Renato Botelho
|
?>
|
237 |
4a098495
|
Sjon Hortensius
|
</td>
|
238 |
3795cc0a
|
sbeaver
|
<td>
|
239 |
|
|
IKEv<?=htmlspecialchars($ikesa['version'])?>
|
240 |
|
|
<br/>
|
241 |
86b2861c
|
Matt Smith
|
<?php
|
242 |
|
|
if ($ikesa['initiator'] == 'yes') {
|
243 |
|
|
print("initiator");
|
244 |
|
|
} else {
|
245 |
|
|
print("responder");
|
246 |
|
|
}
|
247 |
|
|
?>
|
248 |
3795cc0a
|
sbeaver
|
</td>
|
249 |
|
|
<td>
|
250 |
00ae4060
|
Matt Smith
|
<?=htmlspecialchars($ikesa['reauth-time']) . gettext(" seconds (") . convert_seconds_to_hms($ikesa['reauth-time']) . ")";?>
|
251 |
3795cc0a
|
sbeaver
|
</td>
|
252 |
|
|
<td>
|
253 |
86b2861c
|
Matt Smith
|
<?=htmlspecialchars($ikesa['encr-alg'])?>
|
254 |
3795cc0a
|
sbeaver
|
<br/>
|
255 |
86b2861c
|
Matt Smith
|
<?=htmlspecialchars($ikesa['integ-alg'])?>
|
256 |
3795cc0a
|
sbeaver
|
<br/>
|
257 |
86b2861c
|
Matt Smith
|
<?=htmlspecialchars($ikesa['prf-alg'])?>
|
258 |
3795cc0a
|
sbeaver
|
<br/>
|
259 |
86b2861c
|
Matt Smith
|
<?=htmlspecialchars($ikesa['dh-group'])?>
|
260 |
3795cc0a
|
sbeaver
|
</td>
|
261 |
|
|
<td>
|
262 |
|
|
<?php
|
263 |
86b2861c
|
Matt Smith
|
if ($ikesa['state'] == 'ESTABLISHED') {
|
264 |
|
|
print('<span style="color:green">');
|
265 |
|
|
} else {
|
266 |
|
|
print('<span>');
|
267 |
|
|
}
|
268 |
6795e0da
|
Renato Botelho
|
?>
|
269 |
86b2861c
|
Matt Smith
|
<?=ucfirst(htmlspecialchars($ikesa['state']))?>
|
270 |
00ae4060
|
Matt Smith
|
<br/><?=htmlspecialchars($ikesa['established']) . gettext(" seconds (" . convert_seconds_to_hms($ikesa['established']) . ") ago")?>
|
271 |
3795cc0a
|
sbeaver
|
</span>
|
272 |
|
|
</td>
|
273 |
|
|
<td >
|
274 |
6795e0da
|
Renato Botelho
|
<?php
|
275 |
2804a932
|
Luiz Otavio O Souza
|
if ($ikesa['state'] != 'ESTABLISHED') {
|
276 |
6795e0da
|
Renato Botelho
|
?>
|
277 |
1af5edbf
|
Stephen Beaver
|
<a href="status_ipsec.php?act=connect&ikeid=<?=$con_id; ?>" class="btn btn-xs btn-success" data-toggle="tooltip" title="Connect VPN" >
|
278 |
3795cc0a
|
sbeaver
|
<?=gettext("Connect VPN")?>
|
279 |
17402c63
|
Ermal
|
</a>
|
280 |
6795e0da
|
Renato Botelho
|
<?php
|
281 |
86b2861c
|
Matt Smith
|
} else {
|
282 |
6795e0da
|
Renato Botelho
|
?>
|
283 |
1af5edbf
|
Stephen Beaver
|
<a href="status_ipsec.php?act=ikedisconnect&ikeid=<?=$con_id; ?>" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Disconnect VPN">
|
284 |
3795cc0a
|
sbeaver
|
<?=gettext("Disconnect")?>
|
285 |
|
|
</a><br />
|
286 |
6795e0da
|
Renato Botelho
|
<?php
|
287 |
86b2861c
|
Matt Smith
|
}
|
288 |
6795e0da
|
Renato Botelho
|
?>
|
289 |
3795cc0a
|
sbeaver
|
</td>
|
290 |
|
|
</tr>
|
291 |
|
|
<tr>
|
292 |
|
|
<td colspan = 10>
|
293 |
6795e0da
|
Renato Botelho
|
<?php
|
294 |
97242546
|
Matt Smith
|
if (is_array($ikesa['child-sas']) && (count($ikesa['child-sas']) > 0)) {
|
295 |
6795e0da
|
Renato Botelho
|
?>
|
296 |
3795cc0a
|
sbeaver
|
<div id="btnchildsa-<?=$ikeid?>">
|
297 |
|
|
<a type="button" onclick="show_childsa('childsa-<?=$ikeid?>','btnchildsa-<?=$ikeid?>');" class="btn btn-sm btn-default" />
|
298 |
|
|
<?=gettext('Show child SA entries')?>
|
299 |
|
|
</a>
|
300 |
|
|
</div>
|
301 |
fd875a8d
|
Ermal
|
|
302 |
3795cc0a
|
sbeaver
|
<table class="table table-hover table-condensed" id="childsa-<?=$ikeid?>" style="display:none">
|
303 |
|
|
<thead>
|
304 |
|
|
<tr class="info">
|
305 |
|
|
<th><?=gettext("Local subnets")?></th>
|
306 |
|
|
<th><?=gettext("Local SPI(s)")?></th>
|
307 |
|
|
<th><?=gettext("Remote subnets")?></th>
|
308 |
|
|
<th><?=gettext("Times")?></th>
|
309 |
|
|
<th><?=gettext("Algo")?></th>
|
310 |
|
|
<th><?=gettext("Stats")?></th>
|
311 |
|
|
<th><!-- Buttons --></th>
|
312 |
|
|
</tr>
|
313 |
|
|
</thead>
|
314 |
|
|
<tbody>
|
315 |
|
|
<?php
|
316 |
86b2861c
|
Matt Smith
|
foreach ($ikesa['child-sas'] as $childid => $childsa) {
|
317 |
3795cc0a
|
sbeaver
|
?>
|
318 |
|
|
<tr>
|
319 |
|
|
<td>
|
320 |
|
|
<?php
|
321 |
86b2861c
|
Matt Smith
|
if (is_array($childsa['local-ts'])) {
|
322 |
|
|
foreach ($childsa['local-ts'] as $lnets) {
|
323 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars(ipsec_fixup_network($lnets)) . "<br />");
|
324 |
86b2861c
|
Matt Smith
|
}
|
325 |
|
|
} else {
|
326 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
327 |
86b2861c
|
Matt Smith
|
}
|
328 |
6795e0da
|
Renato Botelho
|
?>
|
329 |
3795cc0a
|
sbeaver
|
</td>
|
330 |
|
|
<td>
|
331 |
6795e0da
|
Renato Botelho
|
<?php
|
332 |
86b2861c
|
Matt Smith
|
if (isset($childsa['spi-in'])) {
|
333 |
|
|
print(gettext("Local: ") . htmlspecialchars($childsa['spi-in']));
|
334 |
|
|
}
|
335 |
0da0d43e
|
Phil Davis
|
|
336 |
86b2861c
|
Matt Smith
|
if (isset($childsa['spi-out'])) {
|
337 |
|
|
print('<br/>' . gettext('Remote: ') . htmlspecialchars($childsa['spi-out']));
|
338 |
|
|
}
|
339 |
6795e0da
|
Renato Botelho
|
?>
|
340 |
3795cc0a
|
sbeaver
|
</td>
|
341 |
|
|
<td>
|
342 |
6795e0da
|
Renato Botelho
|
<?php
|
343 |
86b2861c
|
Matt Smith
|
if (is_array($childsa['remote-ts'])) {
|
344 |
|
|
foreach ($childsa['remote-ts'] as $rnets) {
|
345 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars(ipsec_fixup_network($rnets)) . '<br />');
|
346 |
86b2861c
|
Matt Smith
|
}
|
347 |
|
|
} else {
|
348 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
349 |
86b2861c
|
Matt Smith
|
}
|
350 |
6795e0da
|
Renato Botelho
|
?>
|
351 |
3795cc0a
|
sbeaver
|
</td>
|
352 |
|
|
<td>
|
353 |
6795e0da
|
Renato Botelho
|
<?php
|
354 |
00ae4060
|
Matt Smith
|
print(gettext("Rekey: ") . htmlspecialchars($childsa['rekey-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['rekey-time']) . ")");
|
355 |
abe98adb
|
Phil Davis
|
print('<br/>' . gettext('Life: ') . htmlspecialchars($childsa['life-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['life-time']) . ")");
|
356 |
|
|
print('<br/>' . gettext('Install: ') .htmlspecialchars($childsa['install-time']) . gettext(" seconds (") . convert_seconds_to_hms($childsa['install-time']) . ")");
|
357 |
3795cc0a
|
sbeaver
|
|
358 |
6795e0da
|
Renato Botelho
|
?>
|
359 |
3795cc0a
|
sbeaver
|
</td>
|
360 |
|
|
<td>
|
361 |
|
|
<?php
|
362 |
86b2861c
|
Matt Smith
|
print(htmlspecialchars($childsa['encr-alg']) . '<br/>');
|
363 |
|
|
print(htmlspecialchars($childsa['integ-alg']) . '<br/>');
|
364 |
0da0d43e
|
Phil Davis
|
|
365 |
86b2861c
|
Matt Smith
|
if (!empty($childsa['prf-alg'])) {
|
366 |
|
|
print(htmlspecialchars($childsa['prf-alg']) . '<br/>');
|
367 |
|
|
}
|
368 |
|
|
if (!empty($childsa['dh-group'])) {
|
369 |
|
|
print(htmlspecialchars($childsa['dh-group']) . '<br/>');
|
370 |
|
|
}
|
371 |
|
|
if (!empty($childsa['esn'])) {
|
372 |
6de4dd1d
|
Phil Davis
|
print(htmlspecialchars($childsa['esn']) . '<br/>');
|
373 |
86b2861c
|
Matt Smith
|
}
|
374 |
0da0d43e
|
Phil Davis
|
|
375 |
86b2861c
|
Matt Smith
|
print(gettext("IPComp: "));
|
376 |
|
|
if (!empty($childsa['cpi-in']) || !empty($childsa['cpi-out'])) {
|
377 |
|
|
print(htmlspecialchars($childsa['cpi-in']) . " " . htmlspecialchars($childsa['cpi-out']));
|
378 |
|
|
} else {
|
379 |
|
|
print(gettext('none'));
|
380 |
|
|
}
|
381 |
3795cc0a
|
sbeaver
|
?>
|
382 |
|
|
</td>
|
383 |
|
|
<td>
|
384 |
|
|
<?php
|
385 |
d0499e38
|
jim-p
|
print(gettext("Bytes-In: ") . htmlspecialchars(number_format($childsa['bytes-in'])) . ' (' . htmlspecialchars(format_bytes($childsa['bytes-in'])) . ')<br/>');
|
386 |
|
|
print(gettext("Packets-In: ") . htmlspecialchars(number_format($childsa['packets-in'])) . '<br/>');
|
387 |
|
|
print(gettext("Bytes-Out: ") . htmlspecialchars(number_format($childsa['bytes-out'])) . ' (' . htmlspecialchars(format_bytes($childsa['bytes-out'])) . ')<br/>');
|
388 |
|
|
print(gettext("Packets-Out: ") . htmlspecialchars(number_format($childsa['packets-out'])) . '<br/>');
|
389 |
3795cc0a
|
sbeaver
|
?>
|
390 |
|
|
</td>
|
391 |
|
|
<td>
|
392 |
1af5edbf
|
Stephen Beaver
|
<a href="status_ipsec.php?act=childdisconnect&ikeid=<?=$con_id; ?>&ikesaid=<?=$childsa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="<?=gettext('Disconnect Child SA')?>">
|
393 |
3795cc0a
|
sbeaver
|
<?=gettext("Disconnect")?>
|
394 |
|
|
</a>
|
395 |
|
|
</td>
|
396 |
|
|
</tr>
|
397 |
|
|
<?php
|
398 |
86b2861c
|
Matt Smith
|
}
|
399 |
b907136c
|
Renato Botelho
|
?>
|
400 |
3795cc0a
|
sbeaver
|
|
401 |
|
|
</tbody>
|
402 |
|
|
</table>
|
403 |
|
|
</td>
|
404 |
|
|
</tr>
|
405 |
b907136c
|
Renato Botelho
|
<?php
|
406 |
97242546
|
Matt Smith
|
}
|
407 |
3795cc0a
|
sbeaver
|
|
408 |
|
|
unset($con_id);
|
409 |
97242546
|
Matt Smith
|
}
|
410 |
|
|
|
411 |
86b2861c
|
Matt Smith
|
}
|
412 |
3795cc0a
|
sbeaver
|
|
413 |
|
|
$rgmap = array();
|
414 |
86b2861c
|
Matt Smith
|
foreach ($a_phase1 as $ph1ent) {
|
415 |
|
|
if (isset($ph1ent['disabled'])) {
|
416 |
3795cc0a
|
sbeaver
|
continue;
|
417 |
86b2861c
|
Matt Smith
|
}
|
418 |
0da0d43e
|
Phil Davis
|
|
419 |
3795cc0a
|
sbeaver
|
$rgmap[$ph1ent['remote-gateway']] = $ph1ent['remote-gateway'];
|
420 |
0da0d43e
|
Phil Davis
|
|
421 |
86b2861c
|
Matt Smith
|
if ($ipsecconnected[$ph1ent['ikeid']]) {
|
422 |
3795cc0a
|
sbeaver
|
continue;
|
423 |
86b2861c
|
Matt Smith
|
}
|
424 |
3795cc0a
|
sbeaver
|
?>
|
425 |
|
|
<tr>
|
426 |
|
|
<td>
|
427 |
|
|
<?php
|
428 |
|
|
print(htmlspecialchars($ph1ent['descr']));
|
429 |
|
|
?>
|
430 |
|
|
</td>
|
431 |
|
|
<td>
|
432 |
|
|
<?php
|
433 |
|
|
list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local");
|
434 |
abe98adb
|
Phil Davis
|
if (empty($myid_data)) {
|
435 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
436 |
abe98adb
|
Phil Davis
|
} else {
|
437 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars($myid_data));
|
438 |
abe98adb
|
Phil Davis
|
}
|
439 |
3795cc0a
|
sbeaver
|
?>
|
440 |
|
|
</td>
|
441 |
|
|
<td>
|
442 |
|
|
<?php
|
443 |
|
|
$ph1src = ipsec_get_phase1_src($ph1ent);
|
444 |
0da0d43e
|
Phil Davis
|
|
445 |
abe98adb
|
Phil Davis
|
if (empty($ph1src)) {
|
446 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
447 |
abe98adb
|
Phil Davis
|
} else {
|
448 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars($ph1src));
|
449 |
abe98adb
|
Phil Davis
|
}
|
450 |
3795cc0a
|
sbeaver
|
?>
|
451 |
|
|
</td>
|
452 |
|
|
<td>
|
453 |
|
|
<?php
|
454 |
|
|
list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap);
|
455 |
abe98adb
|
Phil Davis
|
if (empty($peerid_data)) {
|
456 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
457 |
abe98adb
|
Phil Davis
|
} else {
|
458 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars($peerid_data));
|
459 |
abe98adb
|
Phil Davis
|
}
|
460 |
3795cc0a
|
sbeaver
|
?>
|
461 |
|
|
</td>
|
462 |
|
|
<td>
|
463 |
|
|
<?php
|
464 |
|
|
$ph1src = ipsec_get_phase1_dst($ph1ent);
|
465 |
abe98adb
|
Phil Davis
|
if (empty($ph1src)) {
|
466 |
3795cc0a
|
sbeaver
|
print(gettext("Unknown"));
|
467 |
abe98adb
|
Phil Davis
|
} else {
|
468 |
3795cc0a
|
sbeaver
|
print(htmlspecialchars($ph1src));
|
469 |
abe98adb
|
Phil Davis
|
}
|
470 |
3795cc0a
|
sbeaver
|
?>
|
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 |
1af5edbf
|
Stephen Beaver
|
<a href="status_ipsec.php?act=connect&ikeid=<?=$ph1ent['ikeid']; ?>" class="btn btn-xs btn-success">
|
494 |
3795cc0a
|
sbeaver
|
<?=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 |
3795cc0a
|
sbeaver
|
</tr>
|
501 |
fd875a8d
|
Ermal
|
<?php
|
502 |
86b2861c
|
Matt Smith
|
}
|
503 |
3795cc0a
|
sbeaver
|
unset($ipsecconnected, $phase1, $rgmap);
|
504 |
c7fbdd6c
|
Ermal
|
?>
|
505 |
3795cc0a
|
sbeaver
|
</tbody>
|
506 |
c7fbdd6c
|
Ermal
|
</table>
|
507 |
|
|
</div>
|
508 |
3795cc0a
|
sbeaver
|
</div>
|
509 |
|
|
|
510 |
c7fbdd6c
|
Ermal
|
<script type="text/javascript">
|
511 |
a8590dd6
|
Colin Fleming
|
//<![CDATA[
|
512 |
c7fbdd6c
|
Ermal
|
function show_childsa(id, buttonid) {
|
513 |
|
|
document.getElementById(buttonid).innerHTML='';
|
514 |
|
|
aodiv = document.getElementById(id);
|
515 |
|
|
aodiv.style.display = "block";
|
516 |
|
|
}
|
517 |
a8590dd6
|
Colin Fleming
|
//]]>
|
518 |
c7fbdd6c
|
Ermal
|
</script>
|
519 |
3795cc0a
|
sbeaver
|
|
520 |
|
|
<?php
|
521 |
|
|
unset($status);
|
522 |
|
|
print_info_box(gettext("You can configure IPsec ") . '<a href="vpn_ipsec.php">Here</a>');
|
523 |
|
|
include("foot.inc"); ?>
|