1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_ipsec_sad.php
|
5
|
Copyright (C) 2004-2009 Scott Ullrich
|
6
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
7
|
All rights reserved.
|
8
|
|
9
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, 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 the
|
21
|
documentation and/or other materials provided with the distribution.
|
22
|
|
23
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
POSSIBILITY OF SUCH DAMAGE.
|
33
|
*/
|
34
|
|
35
|
/*
|
36
|
pfSense_BUILDER_BINARIES: /sbin/setkey
|
37
|
pfSense_MODULE: ipsec
|
38
|
*/
|
39
|
|
40
|
##|+PRIV
|
41
|
##|*IDENT=page-status-ipsec-sad
|
42
|
##|*NAME=Status: IPsec: SAD page
|
43
|
##|*DESCR=Allow access to the 'Status: IPsec: SAD' page.
|
44
|
##|*MATCH=diag_ipsec_sad.php*
|
45
|
##|-PRIV
|
46
|
|
47
|
require("guiconfig.inc");
|
48
|
require("ipsec.inc");
|
49
|
|
50
|
$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SAD"));
|
51
|
$shortcut_section = "ipsec";
|
52
|
include("head.inc");
|
53
|
|
54
|
$sad = ipsec_dump_sad();
|
55
|
|
56
|
/* delete any SA? */
|
57
|
if ($_GET['act'] == "del") {
|
58
|
$fd = @popen("/sbin/setkey -c > /dev/null 2>&1", "w");
|
59
|
if ($fd) {
|
60
|
fwrite($fd, "delete {$_GET['src']} {$_GET['dst']} {$_GET['proto']} {$_GET['spi']} ;\n");
|
61
|
pclose($fd);
|
62
|
sleep(1);
|
63
|
}
|
64
|
}
|
65
|
|
66
|
$tab_array = array();
|
67
|
$tab_array[] = array(gettext("Overview"), false, "diag_ipsec.php");
|
68
|
$tab_array[] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
|
69
|
$tab_array[] = array(gettext("SAD"), true, "diag_ipsec_sad.php");
|
70
|
$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
|
71
|
$tab_array[] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec");
|
72
|
display_top_tabs($tab_array);
|
73
|
|
74
|
if (count($sad)) {
|
75
|
?>
|
76
|
<div table-responsive>
|
77
|
<table class="table table-striped table-hover table-condensed">
|
78
|
<thead>
|
79
|
<tr>
|
80
|
<th><?=gettext("Source")?></th>
|
81
|
<th><?=gettext("Destination")?></th>
|
82
|
<th><?=gettext("Protocol")?></th>
|
83
|
<th><?=gettext("SPI")?></th>
|
84
|
<th><?=gettext("Enc. alg.")?></th>
|
85
|
<th><?=gettext("Auth. alg.")?></th>
|
86
|
<th><?=gettext("Data")?></th>
|
87
|
<th></th>
|
88
|
</tr>
|
89
|
</thead>
|
90
|
<tbody>
|
91
|
<?php foreach ($sad as $sa) { ?>
|
92
|
<tr>
|
93
|
<td>
|
94
|
<?=htmlspecialchars($sa['src'])?>
|
95
|
</td>
|
96
|
<td>
|
97
|
<?=htmlspecialchars($sa['dst'])?>
|
98
|
</td>
|
99
|
<td>
|
100
|
<?=htmlspecialchars(strtoupper($sa['proto']))?>
|
101
|
</td>
|
102
|
<td>
|
103
|
<?=htmlspecialchars($sa['spi'])?>
|
104
|
</td>
|
105
|
<td>
|
106
|
<?=htmlspecialchars($sa['ealgo'])?>
|
107
|
</td>
|
108
|
<td>
|
109
|
<?=htmlspecialchars($sa['aalgo'])?>
|
110
|
</td>
|
111
|
<td>
|
112
|
<?=htmlspecialchars($sa['data'])?></td>
|
113
|
<td>
|
114
|
<?php
|
115
|
$args = "src=" . rawurlencode($sa['src']);
|
116
|
$args .= "&dst=" . rawurlencode($sa['dst']);
|
117
|
$args .= "&proto=" . rawurlencode($sa['proto']);
|
118
|
$args .= "&spi=" . rawurlencode("0x" . $sa['spi']);
|
119
|
?>
|
120
|
<a class="btn btn-xs btn-danger" href="diag_ipsec_sad.php?act=del&<?=$args?>">Delete</a>
|
121
|
</td>
|
122
|
</tr>
|
123
|
|
124
|
<?php
|
125
|
} ?>
|
126
|
</tbody>
|
127
|
</table>
|
128
|
</div>
|
129
|
<?php
|
130
|
}
|
131
|
else
|
132
|
print_info_box(gettext('No IPsec security associations.'));
|
133
|
|
134
|
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
|
135
|
|
136
|
include("foot.inc");
|