Project

General

Profile

Download (4.47 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_ipsec_sad.php
5
	Copyright (C) 2004-2009 Scott Ullrich
6
	All rights reserved.
7

    
8
	originially part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
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
/*
35
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/setkey
36
	pfSense_MODULE:	ipsec
37
*/
38

    
39
##|+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
require("guiconfig.inc");
47
require("ipsec.inc");
48

    
49
$pgtitle = array("Status","IPsec","SAD");
50
include("head.inc");
51

    
52
$sad = ipsec_dump_sad();
53

    
54
/* delete any SA? */
55
if ($_GET['act'] == "del") {
56
	$fd = @popen("/usr/local/sbin/setkey -c > /dev/null 2>&1", "w");
57
	if ($fd) {
58
		fwrite($fd, "delete {$_GET['src']} {$_GET['dst']} {$_GET['proto']} {$_GET['spi']} ;\n");
59
		pclose($fd);
60
		sleep(1);
61
	}
62
}
63

    
64
?>
65

    
66
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
67
	<?php include("fbegin.inc"); ?>
68
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
69
		<tr>
70
			<td>
71
				<?php
72
					$tab_array = array();
73
					$tab_array[0] = array("Overview", false, "diag_ipsec.php");
74
					$tab_array[1] = array("SAD", true, "diag_ipsec_sad.php");
75
					$tab_array[2] = array("SPD", false, "diag_ipsec_spd.php");
76
					$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
77
					display_top_tabs($tab_array);
78
				?>
79
			</td>
80
		</tr>
81
		<tr>
82
			<td>
83
				<div id="mainarea">
84
					<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0">
85
						<?php if (count($sad)): ?>
86
						<tr>
87
							<td nowrap class="listhdrr">Source</td>
88
							<td nowrap class="listhdrr">Destination</a></td>
89
							<td nowrap class="listhdrr">Protocol</td>
90
							<td nowrap class="listhdrr">SPI</td>
91
							<td nowrap class="listhdrr">Enc. alg.</td>
92
							<td nowrap class="listhdr">Auth. alg.</td>
93
							<td nowrap class="list"></td>
94
						</tr>
95
						<?php foreach ($sad as $sa): ?>
96
						<tr>
97
							<td class="listlr"><?=htmlspecialchars($sa['src']);?></td>
98
							<td class="listr"><?=htmlspecialchars($sa['dst']);?></td>
99
							<td class="listr"><?=htmlspecialchars(strtoupper($sa['proto']));?></td>
100
							<td class="listr"><?=htmlspecialchars($sa['spi']);?></td>
101
							<td class="listr"><?=htmlspecialchars($sa['ealgo']);?></td>
102
							<td class="listr"><?=htmlspecialchars($sa['aalgo']);?></td>
103
							<td class="list" nowrap>
104
								<?php
105
									$args = "src=" . rawurlencode($sa['src']);
106
									$args .= "&dst=" . rawurlencode($sa['dst']);
107
									$args .= "&proto=" . rawurlencode($sa['proto']);
108
									$args .= "&spi=" . rawurlencode("0x" . $sa['spi']);
109
								?>
110
								<a href="diag_ipsec_sad.php?act=del&<?=$args;?>" onclick="return confirm('Do you really want to delete this security association?')">
111
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0">
112
								</a>
113
							</td>
114
						</tr>
115
						<?php endforeach; ?>
116
						<?php else: ?>
117
						<tr>
118
							<td>
119
								<p><strong>No IPsec security associations.</strong></p>
120
							</td>
121
						</tr>
122
						<?php endif; ?>
123
					</table>
124
				</div>
125
			</td>
126
		</tr>
127
	</table>
128

    
129
<p/>
130

    
131
<span class="vexpl">
132
<span class="red"><strong>Note:<br></strong></span>
133
You can configure your IPsec <a href="vpn_ipsec.php">here</a>.
134
</span>
135

    
136
<?php include("fend.inc"); ?>
137
</body>
138
</html>
(12-12/221)