Project

General

Profile

Download (3.91 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_ipsec_spd.php
5
	Copyright (C) 2004-2009 Scott Ullrich
6
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7
	All rights reserved.
8

    
9
	originally part of m0n0wall (http://m0n0.ch/wall)
10
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34

    
35
/*
36
	pfSense_BUILDER_BINARIES:	/sbin/setkey
37
	pfSense_MODULE: ipsec
38
*/
39

    
40
##|+PRIV
41
##|*IDENT=page-status-ipsec-spd
42
##|*NAME=Status: IPsec: SPD page
43
##|*DESCR=Allow access to the 'Status: IPsec: SPD' page.
44
##|*MATCH=diag_ipsec_spd.php*
45
##|-PRIV
46

    
47
define(DEBUG, true);
48
define(RIGHTARROW, '&#x25ba;');
49
define(LEFTARROW,  '&#x25c0;');
50

    
51
require("guiconfig.inc");
52
require("ipsec.inc");
53

    
54
$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("SPD"));
55
$shortcut_section = "ipsec";
56
include("head.inc");
57

    
58
if(DEBUG) { // Dummy data for testing. REMOVE for production
59
	$spd = array ( 0 => array ( 'srcid' => '172.27.0.0/16', 'dstid' => '172.21.2.0/24', 'dir' => 'in' , 'proto' => 'esp', 'dst' => '184.57.8.247', 'src' => '208.123.73.7', 'reqid' => 'nique:1' ),
60
				   1 => array ( 'srcid' => '172.21.2.0/24', 'dstid' => '172.27.0.0/16', 'dir' => 'out', 'proto' => 'esp', 'dst' => '208.123.73.7', 'src' => '184.57.8.247', 'reqid' => 'nique:1' ) );
61
}
62
else
63
	$spd = ipsec_dump_spd();
64

    
65
$tab_array = array();
66
$tab_array[0] = array(gettext("Overview"), false, "diag_ipsec.php");
67
$tab_array[1] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
68
$tab_array[2] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
69
$tab_array[3] = array(gettext("SPD"), true, "diag_ipsec_spd.php");
70
$tab_array[4] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec");
71
display_top_tabs($tab_array);
72
?>
73
<?php
74
if (count($spd)){
75
?>
76
	<table class="table table-striped table-hover table-condensed">
77
		<thead>
78
			<tr>
79
				<th><?= gettext("Source"); ?></th>
80
				<th><?= gettext("Destination"); ?></th>
81
				<th><?= gettext("Direction"); ?></th>
82
				<th><?= gettext("Protocol"); ?></th>
83
				<th><?= gettext("Tunnel endpoints"); ?></th>
84
			</tr>
85
		</thead>
86

    
87
		<tbody>
88
<?php
89
	foreach ($spd as $sp) {
90
		if($sp['dir'] == 'in')
91
			$dirstr = LEFTARROW . ' Inbound';
92
		else
93
			$dirstr = RIGHTARROW . ' Outbound';
94
?>
95
			<tr>
96
				<td>
97
					<?=htmlspecialchars($sp['srcid'])?>
98
				</td>
99
				<td>
100
					<?=htmlspecialchars($sp['dstid'])?>
101
				</td>
102
				<td>
103
					<?=$dirstr ?>
104
				</td>
105
				<td>
106
					<?=htmlspecialchars(strtoupper($sp['proto']))?>
107
				</td>
108
				<td>
109
					<?=htmlspecialchars($sp['src'])?> -> <?=htmlspecialchars($sp['dst'])?>
110
				</td>
111
			</tr>
112
<?php
113
	}
114
?>
115
		</tbody>
116
	</table>
117

    
118
<?php
119
	 } // e-o-if (count($spd))
120
else {
121
	print_info_box(gettext('No IPsec security policies configured.'));
122
}
123

    
124
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
125

    
126
include("foot.inc");
(17-17/241)