Project

General

Profile

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