Project

General

Profile

Download (4.87 KB) Statistics
| Branch: | Tag: | Revision:
1 4d875b4f Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	diag_ipsec_sad.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-sad
41
##|*NAME=Status: IPsec: SAD page
42
##|*DESCR=Allow access to the 'Status: IPsec: SAD' page.
43
##|*MATCH=diag_ipsec_sad.php*
44
##|-PRIV
45
46 5b237745 Scott Ullrich
require("guiconfig.inc");
47 483e6de8 Scott Ullrich
require("ipsec.inc");
48 b63695db Scott Ullrich
49 5bd7a1f7 jean.feltrin
$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SAD"));
50 b32dd0a6 jim-p
$shortcut_section = "ipsec";
51 b63695db Scott Ullrich
include("head.inc");
52
53 a93e56c5 Matthew Grooms
$sad = ipsec_dump_sad();
54 5b237745 Scott Ullrich
55
/* delete any SA? */
56
if ($_GET['act'] == "del") {
57 a93e56c5 Matthew Grooms
	$fd = @popen("/usr/local/sbin/setkey -c > /dev/null 2>&1", "w");
58 5b237745 Scott Ullrich
	if ($fd) {
59
		fwrite($fd, "delete {$_GET['src']} {$_GET['dst']} {$_GET['proto']} {$_GET['spi']} ;\n");
60
		pclose($fd);
61
		sleep(1);
62
	}
63
}
64
65
?>
66 c55a8ab9 Holger Bauer
67 a93e56c5 Matthew Grooms
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
68
	<?php include("fbegin.inc"); ?>
69
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
70
		<tr>
71
			<td>
72
				<?php
73
					$tab_array = array();
74 5bd7a1f7 jean.feltrin
					$tab_array[0] = array(gettext("Overview"), false, "diag_ipsec.php");
75
					$tab_array[1] = array(gettext("SAD"), true, "diag_ipsec_sad.php");
76
					$tab_array[2] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
77
					$tab_array[3] = array(gettext("Logs"), false, "diag_logs_ipsec.php");
78 a93e56c5 Matthew Grooms
					display_top_tabs($tab_array);
79
				?>
80
			</td>
81
		</tr>
82
		<tr>
83
			<td>
84
				<div id="mainarea">
85 def25408 Scott Ullrich
					<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0">
86 a93e56c5 Matthew Grooms
						<?php if (count($sad)): ?>
87
						<tr>
88 5bd7a1f7 jean.feltrin
							<td nowrap class="listhdrr"><?=gettext("Source");?></td>
89 657ba532 Renato Botelho
							<td nowrap class="listhdrr"><?=gettext("Destination");?></td>
90 5bd7a1f7 jean.feltrin
							<td nowrap class="listhdrr"><?=gettext("Protocol");?></td>
91
							<td nowrap class="listhdrr"><?=gettext("SPI");?></td>
92
							<td nowrap class="listhdrr"><?=gettext("Enc. alg.");?></td>
93
							<td nowrap class="listhdr"><?=gettext("Auth. alg.");?></td>
94 f451ea09 jim-p
							<td nowrap class="listhdr"><?=gettext("Data");?></td>
95 a93e56c5 Matthew Grooms
							<td nowrap class="list"></td>
96
						</tr>
97
						<?php foreach ($sad as $sa): ?>
98
						<tr>
99
							<td class="listlr"><?=htmlspecialchars($sa['src']);?></td>
100
							<td class="listr"><?=htmlspecialchars($sa['dst']);?></td>
101
							<td class="listr"><?=htmlspecialchars(strtoupper($sa['proto']));?></td>
102
							<td class="listr"><?=htmlspecialchars($sa['spi']);?></td>
103
							<td class="listr"><?=htmlspecialchars($sa['ealgo']);?></td>
104
							<td class="listr"><?=htmlspecialchars($sa['aalgo']);?></td>
105 f451ea09 jim-p
							<td class="listr"><?=htmlspecialchars($sa['data']);?></td>
106 a93e56c5 Matthew Grooms
							<td class="list" nowrap>
107
								<?php
108
									$args = "src=" . rawurlencode($sa['src']);
109
									$args .= "&dst=" . rawurlencode($sa['dst']);
110
									$args .= "&proto=" . rawurlencode($sa['proto']);
111
									$args .= "&spi=" . rawurlencode("0x" . $sa['spi']);
112
								?>
113 f4713e57 Carlos Eduardo Ramos
								<a href="diag_ipsec_sad.php?act=del&<?=$args;?>" onclick="return confirm('<?=gettext("Do you really want to delete this security association?"); ?>')">
114 a93e56c5 Matthew Grooms
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
115
								</a>
116
							</td>
117
						</tr>
118
						<?php endforeach; ?>
119
						<?php else: ?>
120
						<tr>
121
							<td>
122 5bd7a1f7 jean.feltrin
								<p><strong><?=gettext("No IPsec security associations.");?></strong></p>
123 a93e56c5 Matthew Grooms
							</td>
124
						</tr>
125
						<?php endif; ?>
126
					</table>
127
				</div>
128
			</td>
129
		</tr>
130
	</table>
131 2f6cd24f Scott Ullrich
132
<p/>
133
134
<span class="vexpl">
135 f4713e57 Carlos Eduardo Ramos
<span class="red"><strong><?=gettext("Note:");?><br></strong></span>
136
<?=gettext("You can configure your IPsec");?> <a href="vpn_ipsec.php"><?=gettext("here.");?></a>
137 2f6cd24f Scott Ullrich
</span>
138
139
<?php include("fend.inc"); ?>
140 5b237745 Scott Ullrich
</body>
141
</html>