1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_ipsec.php
|
5
|
Copyright (C) 2007 Scott Ullrich
|
6
|
Copyright (C) 2008 Shrew Soft Inc <mgrooms@shrew.net>.
|
7
|
All rights reserved.
|
8
|
|
9
|
Parts of this code was originally based on vpn_ipsec_sad.php
|
10
|
Copyright (C) 2003-2004 Manuel Kasper
|
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
|
36
|
##|*NAME=Status: IPsec page
|
37
|
##|*DESCR=Allow access to the 'Status: IPsec' page.
|
38
|
##|*MATCH=diag_ipsec.php*
|
39
|
##|-PRIV
|
40
|
|
41
|
|
42
|
global $g;
|
43
|
|
44
|
$pgtitle = array("Status","IPsec");
|
45
|
|
46
|
require("guiconfig.inc");
|
47
|
include("head.inc");
|
48
|
|
49
|
if (!is_array($config['ipsec']['phase2']))
|
50
|
$config['ipsec']['phase2'] = array();
|
51
|
|
52
|
$a_phase2 = &$config['ipsec']['phase2'];
|
53
|
|
54
|
$spd = ipsec_dump_spd();
|
55
|
$sad = ipsec_dump_sad();
|
56
|
|
57
|
?>
|
58
|
|
59
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
|
60
|
<?php include("fbegin.inc"); ?>
|
61
|
<div id="inputerrors"></div>
|
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", true, "diag_ipsec.php");
|
68
|
$tab_array[1] = array("SAD", false, "diag_ipsec_sad.php");
|
69
|
$tab_array[2] = array("SPD", false, "diag_ipsec_spd.php");
|
70
|
display_top_tabs($tab_array);
|
71
|
?>
|
72
|
</td>
|
73
|
</tr>
|
74
|
<tr>
|
75
|
<td>
|
76
|
<div id="mainarea">
|
77
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
78
|
<tr>
|
79
|
<td nowrap class="listhdrr">Local IP</td>
|
80
|
<td nowrap class="listhdrr">Remote IP</a></td>
|
81
|
<td nowrap class="listhdrr">Local Network</td>
|
82
|
<td nowrap class="listhdrr">Remote Network</a></td>
|
83
|
<td nowrap class="listhdrr">Description</a></td>
|
84
|
<td nowrap class="listhdrr">Status</td>
|
85
|
</tr>
|
86
|
<?php
|
87
|
foreach ($a_phase2 as $ph2ent) {
|
88
|
if (!isset($ph2ent['disabled'])) {
|
89
|
ipsec_lookup_phase1($ph2ent,$ph1ent);
|
90
|
if(ipsec_phase2_status($spd,$sad,$ph1ent,$ph2ent))
|
91
|
$icon = "pass";
|
92
|
else
|
93
|
$icon = "reject";
|
94
|
?>
|
95
|
<tr>
|
96
|
<td class="listlr">
|
97
|
<?=htmlspecialchars(ipsec_get_phase1_src($ph1ent));?>
|
98
|
</td>
|
99
|
<td class="listr">
|
100
|
<?=htmlspecialchars($ph1ent['remote-gateway']);?>
|
101
|
</td>
|
102
|
<td class="listr">
|
103
|
<?php echo ipsec_idinfo_to_text($ph2ent['localid']); ?>
|
104
|
</td>
|
105
|
<td class="listr">
|
106
|
<?php echo ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
|
107
|
</td>
|
108
|
<td class="listr"><?=htmlspecialchars($ph2ent['descr']);?></td>
|
109
|
<td class="listr">
|
110
|
<center>
|
111
|
<img src ="/themes/<?=$g['theme']?>/images/icons/icon_<?=$icon?>.gif">
|
112
|
</center>
|
113
|
</td>
|
114
|
</tr>
|
115
|
<?php
|
116
|
}
|
117
|
}
|
118
|
?>
|
119
|
<tr>
|
120
|
<td colspan="4">
|
121
|
<p>
|
122
|
<span class="vexpl">
|
123
|
<span class="red">
|
124
|
<strong>Note:<br /></strong>
|
125
|
</span>
|
126
|
You can configure your IPsec
|
127
|
<a href="vpn_ipsec.php">here</a>.
|
128
|
</span>
|
129
|
</p>
|
130
|
</td>
|
131
|
</tr>
|
132
|
</table>
|
133
|
</div>
|
134
|
</td>
|
135
|
</tr>
|
136
|
</table>
|
137
|
|
138
|
<?php include("fend.inc"); ?>
|
139
|
</body>
|
140
|
</html>
|
141
|
|