Project

General

Profile

Download (4.96 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_ipsec_spd.php
5
	Copyright (C) 2004 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
##|+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
require("guiconfig.inc");
43

    
44
$pgtitle = array("Status","IPsec","SPD");
45
include("head.inc");
46

    
47
/* delete any SP? */
48
if ($_GET['act'] == "del") {
49
	$fd = @popen("/usr/local/sbin/setkey -c > /dev/null 2>&1", "w");
50
	if ($fd) {
51
		fwrite($fd, "spddelete {$_GET['srcid']} {$_GET['dstid']} any -P {$_GET['dir']} ;\n");
52
		pclose($fd);
53
		sleep(1);
54
	}
55
}
56

    
57
$spd = ipsec_dump_spd();
58
?>
59

    
60
<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
						<td colspan="4">
130
							<p>
131
								<span class="vexpl">
132
									<span class="red">
133
										<strong>Note:<br></strong>
134
									</span>
135
									You can configure your IPsec <a href="vpn_ipsec.php">here</a>.
136
								</span>
137
							</p>
138
			  			</td>
139
					</table>
140
				</div>
141
			</td>
142
		</tr>
143
	</table>
144
	<?php include("fend.inc"); ?>
145
</body>
146
</html>
147

    
(12-12/217)