1 |
cf7d1057
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
diag_ipsec.php
|
5 |
13d193c2
|
Scott Ullrich
|
Copyright (C) 2004-2009 Scott Ullrich
|
6 |
a93e56c5
|
Matthew Grooms
|
Copyright (C) 2008 Shrew Soft Inc <mgrooms@shrew.net>.
|
7 |
cf7d1057
|
Scott Ullrich
|
All rights reserved.
|
8 |
|
|
|
9 |
|
|
Parts of this code was originally based on vpn_ipsec_sad.php
|
10 |
|
|
Copyright (C) 2003-2004 Manuel Kasper
|
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 |
13d193c2
|
Scott Ullrich
|
/*
|
35 |
|
|
pfSense_MODULE: ipsec
|
36 |
|
|
*/
|
37 |
|
|
|
38 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
39 |
|
|
##|*IDENT=page-status-ipsec
|
40 |
|
|
##|*NAME=Status: IPsec page
|
41 |
|
|
##|*DESCR=Allow access to the 'Status: IPsec' page.
|
42 |
|
|
##|*MATCH=diag_ipsec.php*
|
43 |
|
|
##|-PRIV
|
44 |
|
|
|
45 |
|
|
|
46 |
a93e56c5
|
Matthew Grooms
|
global $g;
|
47 |
|
|
|
48 |
f8ec8de4
|
Renato Botelho
|
$pgtitle = array(gettext("Status"),gettext("IPsec"));
|
49 |
b32dd0a6
|
jim-p
|
$shortcut_section = "ipsec";
|
50 |
cf7d1057
|
Scott Ullrich
|
|
51 |
|
|
require("guiconfig.inc");
|
52 |
|
|
include("head.inc");
|
53 |
483e6de8
|
Scott Ullrich
|
require("ipsec.inc");
|
54 |
a93e56c5
|
Matthew Grooms
|
|
55 |
6e8b0ec3
|
jim-p
|
if ($_GET['act'] == "connect") {
|
56 |
614be051
|
bcyrill
|
if (is_ipaddrv4($_GET['remoteid']) && is_ipaddrv4($_GET['source'])) {
|
57 |
6e8b0ec3
|
jim-p
|
exec("/sbin/ping -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid']));
|
58 |
|
|
}
|
59 |
614be051
|
bcyrill
|
else if (is_ipaddrv6($_GET['remoteid']) && is_ipaddrv6($_GET['source'])) {
|
60 |
|
|
exec("/sbin/ping6 -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid']));
|
61 |
|
|
}
|
62 |
6e8b0ec3
|
jim-p
|
}
|
63 |
|
|
|
64 |
6e0b68bf
|
jim-p
|
if ($_GET['act'] == "disconnect") {
|
65 |
|
|
if (!empty($_GET['user'])) {
|
66 |
|
|
ipsec_disconnect_mobile($_GET['user']);
|
67 |
|
|
sleep(1);
|
68 |
|
|
$savemsg = gettext("Disconnected user") . " " . $_GET['user'];
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
|
72 |
a93e56c5
|
Matthew Grooms
|
if (!is_array($config['ipsec']['phase2']))
|
73 |
|
|
$config['ipsec']['phase2'] = array();
|
74 |
|
|
|
75 |
|
|
$a_phase2 = &$config['ipsec']['phase2'];
|
76 |
|
|
|
77 |
df0878b0
|
Ermal
|
$status = ipsec_smp_dump_status();
|
78 |
a93e56c5
|
Matthew Grooms
|
|
79 |
cf7d1057
|
Scott Ullrich
|
?>
|
80 |
|
|
|
81 |
6e0b68bf
|
jim-p
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php echo $jsevents["body"]["onload"]; ?>">
|
82 |
cf7d1057
|
Scott Ullrich
|
<?php include("fbegin.inc"); ?>
|
83 |
|
|
<div id="inputerrors"></div>
|
84 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
85 |
|
|
<tr>
|
86 |
a93e56c5
|
Matthew Grooms
|
<td>
|
87 |
|
|
<?php
|
88 |
|
|
$tab_array = array();
|
89 |
f8ec8de4
|
Renato Botelho
|
$tab_array[0] = array(gettext("Overview"), true, "diag_ipsec.php");
|
90 |
|
|
$tab_array[1] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
|
91 |
|
|
$tab_array[2] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
|
92 |
|
|
$tab_array[3] = array(gettext("Logs"), false, "diag_logs_ipsec.php");
|
93 |
a93e56c5
|
Matthew Grooms
|
display_top_tabs($tab_array);
|
94 |
|
|
?>
|
95 |
331aa57b
|
Scott Ullrich
|
</td>
|
96 |
cf7d1057
|
Scott Ullrich
|
</tr>
|
97 |
a93e56c5
|
Matthew Grooms
|
<tr>
|
98 |
6e0b68bf
|
jim-p
|
<td>
|
99 |
c7fbdd6c
|
Ermal
|
<div id="mainarea">
|
100 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" class="tabcont sortable">
|
101 |
|
|
<thead>
|
102 |
|
|
<tr>
|
103 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Description");?></th>
|
104 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Local ID");?></th>
|
105 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Local IP");?></th>
|
106 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Remote ID");?></th>
|
107 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Remote IP");?></a></th>
|
108 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Role");?></a></th>
|
109 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Status");?></a></th>
|
110 |
|
|
</tr>
|
111 |
|
|
</thead>
|
112 |
|
|
<tbody>
|
113 |
|
|
<?php
|
114 |
|
|
if (is_array($status['query']) && is_array($status['query']['ikesalist']) && is_array($status['query']['ikesalist']['ikesa'])) {
|
115 |
|
|
foreach ($status['query']['ikesalist']['ikesa'] as $ikeid => $ikesa) {
|
116 |
|
|
?>
|
117 |
|
|
<tr>
|
118 |
|
|
<td class="listlr">
|
119 |
|
|
<?php echo htmlspecialchars($ikesa['peerconfig']);?>
|
120 |
|
|
</td>
|
121 |
|
|
<td class="listr">
|
122 |
|
|
<?php if (!is_array($ikesa['local']))
|
123 |
|
|
echo "Unknown";
|
124 |
|
|
else {
|
125 |
|
|
if (!empty($ikesa['local']['identification']))
|
126 |
8cd558b6
|
ayvis
|
echo htmlspecialchars($ikesa['local']['identification']) . '<br />' . htmlspecialchars($ikesa['local']['spi']);
|
127 |
c7fbdd6c
|
Ermal
|
else
|
128 |
|
|
echo 'Unknown';
|
129 |
|
|
}
|
130 |
|
|
?>
|
131 |
|
|
</td>
|
132 |
|
|
<td class="listr">
|
133 |
|
|
<?php if (!is_array($ikesa['local']))
|
134 |
|
|
echo "Unknown";
|
135 |
|
|
else {
|
136 |
|
|
if (!empty($ikesa['local']['address']))
|
137 |
|
|
echo htmlspecialchars($ikesa['local']['address']) . ':' . htmlspecialchars($ikesa['local']['port']);
|
138 |
|
|
else
|
139 |
|
|
echo 'Unknown';
|
140 |
|
|
if ($ikesa['local']['nat'])
|
141 |
|
|
echo " NAT-T";
|
142 |
|
|
}
|
143 |
|
|
?>
|
144 |
|
|
</td>
|
145 |
|
|
<td class="listr">
|
146 |
|
|
<?php if (!is_array($ikesa['remote']))
|
147 |
|
|
echo "Unknown";
|
148 |
|
|
else {
|
149 |
|
|
if (!empty($ikesa['remote']['identification']))
|
150 |
8cd558b6
|
ayvis
|
echo htmlspecialchars($ikesa['remote']['identification']) . '<br />' . htmlspecialchars($ikesa['remote']['spi']);
|
151 |
c7fbdd6c
|
Ermal
|
else
|
152 |
|
|
echo 'Unknown';
|
153 |
|
|
}
|
154 |
|
|
?>
|
155 |
|
|
</td>
|
156 |
|
|
<td class="listr">
|
157 |
|
|
<?php if (!is_array($ikesa['remote']))
|
158 |
|
|
echo "Unknown";
|
159 |
|
|
else {
|
160 |
|
|
if (!empty($ikesa['remote']['address']))
|
161 |
|
|
echo htmlspecialchars($ikesa['remote']['address']) . ':' . htmlspecialchars($ikesa['remote']['port']);
|
162 |
|
|
else
|
163 |
|
|
echo 'Unknown';
|
164 |
|
|
if ($ikesa['remote']['nat'])
|
165 |
|
|
echo " NAT-T";
|
166 |
|
|
}
|
167 |
|
|
?>
|
168 |
|
|
</td>
|
169 |
|
|
<td class="listr">
|
170 |
|
|
<?php echo htmlspecialchars($ikesa['role']);?>
|
171 |
|
|
</td>
|
172 |
|
|
<td class="listr">
|
173 |
|
|
<?php echo htmlspecialchars($ikesa['status']);?>
|
174 |
|
|
</td>
|
175 |
|
|
<td class="listbg">
|
176 |
|
|
<?php ?>
|
177 |
|
|
</td>
|
178 |
|
|
<td valign="middle" nowrap class="list">
|
179 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
180 |
|
|
</table>
|
181 |
|
|
</td>
|
182 |
|
|
</tr>
|
183 |
|
|
<?php if (is_array($ikesa['childsalist'])): ?>
|
184 |
|
|
<tr>
|
185 |
|
|
<td class="listrborder" colspan="7">
|
186 |
|
|
<div id="btnchildsa-<?=$ikeid;?>">
|
187 |
91f026b0
|
ayvis
|
<input type="button" onClick="show_childsa('childsa-<?=$ikeid;?>','btnchildsa-<?=$ikeid;?>');" value="+" /> - Show child SA entries</a>
|
188 |
c7fbdd6c
|
Ermal
|
</div>
|
189 |
|
|
<table class="tabcont" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" id="childsa-<?=$ikeid;?>" style="display:none">
|
190 |
|
|
<thead>
|
191 |
a93e56c5
|
Matthew Grooms
|
<tr>
|
192 |
c7fbdd6c
|
Ermal
|
<th nowrap class="listhdrr"><?php echo gettext("Local subnets");?></th>
|
193 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Local SPI");?></th>
|
194 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Remote SPI");?></th>
|
195 |
|
|
<th nowrap class="listhdrr"><?php echo gettext("Remote subnets");?></th>
|
196 |
a93e56c5
|
Matthew Grooms
|
</tr>
|
197 |
c7fbdd6c
|
Ermal
|
</thead>
|
198 |
|
|
<tbody>
|
199 |
|
|
<?php
|
200 |
|
|
if (is_array($ikesa['childsalist']['childsa'])) {
|
201 |
|
|
foreach ($ikesa['childsalist']['childsa'] as $childsa) {
|
202 |
|
|
?>
|
203 |
|
|
<tr valign="top">
|
204 |
|
|
<td nowrap class="listlr">
|
205 |
|
|
<?php if (is_array($childsa['local']) && is_array($childsa['local']['networks']) && is_array($childsa['local']['networks']['network'])) {
|
206 |
|
|
foreach ($childsa['local']['networks']['network'] as $lnets) {
|
207 |
8cd558b6
|
ayvis
|
echo htmlspecialchars($lnets) . "<br />";
|
208 |
c7fbdd6c
|
Ermal
|
}
|
209 |
|
|
} else
|
210 |
|
|
echo "Unknown";
|
211 |
|
|
?>
|
212 |
a93e56c5
|
Matthew Grooms
|
</td>
|
213 |
c7fbdd6c
|
Ermal
|
<td nowrap class="listr">
|
214 |
|
|
<?php if (is_array($childsa['local']))
|
215 |
|
|
echo htmlspecialchars($childsa['local']['spi']);
|
216 |
|
|
?>
|
217 |
a93e56c5
|
Matthew Grooms
|
</td>
|
218 |
c7fbdd6c
|
Ermal
|
<td nowrap class="listr">
|
219 |
|
|
<?php if (is_array($childsa['remote']))
|
220 |
|
|
echo htmlspecialchars($childsa['remote']['spi']);
|
221 |
|
|
?>
|
222 |
a93e56c5
|
Matthew Grooms
|
</td>
|
223 |
c7fbdd6c
|
Ermal
|
<td nowrap class="listlr">
|
224 |
|
|
<?php if (is_array($childsa['remote']) && is_array($childsa['remote']['networks']) && is_array($childsa['remote']['networks']['network'])) {
|
225 |
|
|
foreach ($childsa['remote']['networks']['network'] as $rnets) {
|
226 |
8cd558b6
|
ayvis
|
echo htmlspecialchars($rnets) . "<br />";
|
227 |
c7fbdd6c
|
Ermal
|
}
|
228 |
|
|
} else
|
229 |
|
|
echo "Unknown";
|
230 |
|
|
?>
|
231 |
a93e56c5
|
Matthew Grooms
|
</td>
|
232 |
c7fbdd6c
|
Ermal
|
<td nowrap class="list">
|
233 |
|
|
|
234 |
6e8b0ec3
|
jim-p
|
</td>
|
235 |
a93e56c5
|
Matthew Grooms
|
</tr>
|
236 |
c7fbdd6c
|
Ermal
|
<?php } } ?>
|
237 |
|
|
</tbody>
|
238 |
a93e56c5
|
Matthew Grooms
|
</table>
|
239 |
c7fbdd6c
|
Ermal
|
</td>
|
240 |
|
|
</tr>
|
241 |
|
|
<?php endif;
|
242 |
|
|
}
|
243 |
|
|
}
|
244 |
|
|
?>
|
245 |
|
|
</tbody>
|
246 |
|
|
</table>
|
247 |
|
|
</div>
|
248 |
|
|
</td>
|
249 |
a93e56c5
|
Matthew Grooms
|
</tr>
|
250 |
cf7d1057
|
Scott Ullrich
|
</table>
|
251 |
c7fbdd6c
|
Ermal
|
</div>
|
252 |
0f78d3ad
|
Scott Ullrich
|
|
253 |
|
|
<span class="vexpl">
|
254 |
|
|
<span class="red">
|
255 |
6e0b68bf
|
jim-p
|
<strong><?php echo gettext("Note:");?><br /></strong>
|
256 |
0f78d3ad
|
Scott Ullrich
|
</span>
|
257 |
6e0b68bf
|
jim-p
|
<?php echo gettext("You can configure IPsec");?>
|
258 |
0f78d3ad
|
Scott Ullrich
|
<a href="vpn_ipsec.php">here</a>.
|
259 |
|
|
</span>
|
260 |
c7fbdd6c
|
Ermal
|
<?php unset($status); include("fend.inc"); ?>
|
261 |
|
|
<script type="text/javascript">
|
262 |
|
|
function show_childsa(id, buttonid) {
|
263 |
|
|
document.getElementById(buttonid).innerHTML='';
|
264 |
|
|
aodiv = document.getElementById(id);
|
265 |
|
|
aodiv.style.display = "block";
|
266 |
|
|
}
|
267 |
|
|
</script>
|
268 |
cf7d1057
|
Scott Ullrich
|
</body>
|
269 |
|
|
</html>
|