1 |
4d875b4f
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
diag_ipsec_spd.php
|
5 |
4d875b4f
|
Scott Ullrich
|
Copyright (C) 2004 Scott Ullrich
|
6 |
|
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
originially part of m0n0wall (http://m0n0.ch/wall)
|
9 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
|
|
All rights reserved.
|
11 |
4d875b4f
|
Scott Ullrich
|
|
12 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
|
modification, are permitted provided that the following conditions are met:
|
14 |
4d875b4f
|
Scott Ullrich
|
|
15 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
this list of conditions and the following disclaimer.
|
17 |
4d875b4f
|
Scott Ullrich
|
|
18 |
5b237745
|
Scott Ullrich
|
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 |
4d875b4f
|
Scott Ullrich
|
|
22 |
5b237745
|
Scott Ullrich
|
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 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
35 |
|
|
##|*IDENT=page-status-ipsec-spd
|
36 |
|
|
##|*NAME=Status: IPsec: SPD page
|
37 |
|
|
##|*DESCR=Allow access to the 'Status: IPsec: SPD' page.
|
38 |
|
|
##|*MATCH=diag_ipsec_spd.php*
|
39 |
|
|
##|-PRIV
|
40 |
|
|
|
41 |
|
|
|
42 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
43 |
b63695db
|
Scott Ullrich
|
|
44 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Status","IPsec","SPD");
|
45 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
46 |
|
|
|
47 |
5b237745
|
Scott Ullrich
|
/* delete any SP? */
|
48 |
|
|
if ($_GET['act'] == "del") {
|
49 |
a93e56c5
|
Matthew Grooms
|
$fd = @popen("/usr/local/sbin/setkey -c > /dev/null 2>&1", "w");
|
50 |
5b237745
|
Scott Ullrich
|
if ($fd) {
|
51 |
a93e56c5
|
Matthew Grooms
|
fwrite($fd, "spddelete {$_GET['srcid']} {$_GET['dstid']} any -P {$_GET['dir']} ;\n");
|
52 |
5b237745
|
Scott Ullrich
|
pclose($fd);
|
53 |
|
|
sleep(1);
|
54 |
|
|
}
|
55 |
|
|
}
|
56 |
|
|
|
57 |
a93e56c5
|
Matthew Grooms
|
$spd = ipsec_dump_spd();
|
58 |
5b237745
|
Scott Ullrich
|
?>
|
59 |
4d875b4f
|
Scott Ullrich
|
|
60 |
a93e56c5
|
Matthew Grooms
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
61 |
|
|
<?php include("fbegin.inc"); ?>
|
62 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
63 |
|
|
<tr>
|
64 |
|
|
<td>
|
65 |
|
|
<?php
|
66 |
|
|
$tab_array = array();
|
67 |
|
|
$tab_array[0] = array("Overview", false, "diag_ipsec.php");
|
68 |
|
|
$tab_array[1] = array("SAD", false, "diag_ipsec_sad.php");
|
69 |
|
|
$tab_array[2] = array("SPD", true, "diag_ipsec_spd.php");
|
70 |
|
|
display_top_tabs($tab_array);
|
71 |
|
|
?>
|
72 |
|
|
</td>
|
73 |
|
|
</tr>
|
74 |
|
|
<tr>
|
75 |
|
|
<td>
|
76 |
|
|
<div id="mainarea" style="background:#eeeeee">
|
77 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
78 |
|
|
<?php if (count($spd)): ?>
|
79 |
|
|
<tr>
|
80 |
|
|
<td nowrap class="listhdrr">Source</td>
|
81 |
|
|
<td nowrap class="listhdrr">Destination</td>
|
82 |
|
|
<td nowrap class="listhdrr">Direction</td>
|
83 |
|
|
<td nowrap class="listhdrr">Protocol</td>
|
84 |
|
|
<td nowrap class="listhdrr">Tunnel endpoints</td>
|
85 |
|
|
<td nowrap class="list"></td>
|
86 |
|
|
</tr>
|
87 |
|
|
<?php foreach ($spd as $sp): ?>
|
88 |
|
|
<tr>
|
89 |
|
|
<td class="listlr" valign="top"><?=htmlspecialchars($sp['srcid']);?></td>
|
90 |
|
|
<td class="listr" valign="top"><?=htmlspecialchars($sp['dstid']);?></td>
|
91 |
|
|
<td class="listr" valign="top">
|
92 |
|
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_<?=$sp['dir'];?>.gif" width="11" height="11" style="margin-top: 2px">
|
93 |
|
|
</td>
|
94 |
|
|
<td class="listr" valign="top"><?=htmlspecialchars(strtoupper($sp['proto']));?></td>
|
95 |
|
|
<td class="listr" valign="top"><?=htmlspecialchars($sp['src']);?> -> <?=htmlspecialchars($sp['dst']);?></td>
|
96 |
|
|
<td class="list" nowrap>
|
97 |
|
|
<?php
|
98 |
|
|
$args = "srcid=".rawurlencode($sp['srcid']);
|
99 |
|
|
$args .= "&dstid=".rawurlencode($sp['dstid']);
|
100 |
|
|
$args .= "&dir=".rawurlencode($sp['dir']);
|
101 |
|
|
?>
|
102 |
|
|
<a href="diag_ipsec_spd.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security policy?')">
|
103 |
|
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
|
104 |
|
|
</a>
|
105 |
|
|
</td>
|
106 |
|
|
</tr>
|
107 |
|
|
<?php endforeach; ?>
|
108 |
|
|
</table>
|
109 |
|
|
<br>
|
110 |
|
|
<table class="tabcont" border="0" cellspacing="0" cellpadding="6">
|
111 |
|
|
<tr>
|
112 |
|
|
<td width="16"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_in.gif" width="11" height="11"></td>
|
113 |
|
|
<td>incoming (as seen by firewall)</td>
|
114 |
|
|
</tr>
|
115 |
|
|
<tr>
|
116 |
|
|
<td colspan="5" height="4"></td>
|
117 |
|
|
</tr>
|
118 |
|
|
<tr>
|
119 |
|
|
<td><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_out.gif" width="11" height="11"></td>
|
120 |
|
|
<td>outgoing (as seen by firewall)</td>
|
121 |
|
|
</tr>
|
122 |
|
|
<?php else: ?>
|
123 |
|
|
<tr>
|
124 |
|
|
<td>
|
125 |
|
|
<p><strong>No IPsec security policies.</strong></p>
|
126 |
|
|
</td>
|
127 |
|
|
</tr>
|
128 |
|
|
<?php endif; ?>
|
129 |
|
|
</table>
|
130 |
|
|
</div>
|
131 |
|
|
</td>
|
132 |
|
|
</tr>
|
133 |
|
|
</table>
|
134 |
2f6cd24f
|
Scott Ullrich
|
|
135 |
|
|
<p>
|
136 |
|
|
<span class="vexpl">
|
137 |
|
|
<span class="red"><strong>Note:<br></strong></span>
|
138 |
|
|
You can configure your IPsec <a href="vpn_ipsec.php">here</a>.
|
139 |
|
|
</span>
|
140 |
|
|
|
141 |
|
|
<?php include("fend.inc"); ?>
|
142 |
5b237745
|
Scott Ullrich
|
</body>
|
143 |
|
|
</html>
|