1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_ipsec_leases.php
|
5
|
Copyright (C) 2014 Ermal LUÇi
|
6
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
|
31
|
/*
|
32
|
pfSense_BUILDER_BINARIES: /usr/local/sbin/ipsec
|
33
|
pfSense_MODULE: ipsec
|
34
|
*/
|
35
|
|
36
|
##|+PRIV
|
37
|
##|*IDENT=page-status-ipsec-leases
|
38
|
##|*NAME=Status: IPsec: Leases page
|
39
|
##|*DESCR=Allow access to the 'Status: IPsec: Leases' page.
|
40
|
##|*MATCH=diag_ipsec_leases.php*
|
41
|
##|-PRIV
|
42
|
|
43
|
define(DEBUG, true); // Force dummy data for testing. Setting up a pFSense box to get real data is far too hard!
|
44
|
|
45
|
require("guiconfig.inc");
|
46
|
require("ipsec.inc");
|
47
|
|
48
|
$pgtitle = array(gettext("Status"),gettext("IPsec"),gettext("Leases"));
|
49
|
$shortcut_section = "ipsec";
|
50
|
include("head.inc");
|
51
|
|
52
|
$mobile = ipsec_dump_mobile();
|
53
|
|
54
|
$tab_array = array();
|
55
|
$tab_array[] = array(gettext("Overview"), false, "diag_ipsec.php");
|
56
|
$tab_array[] = array(gettext("Leases"), true, "diag_ipsec_leases.php");
|
57
|
$tab_array[] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
|
58
|
$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
|
59
|
$tab_array[] = array(gettext("Logs"), false, "diag_logs.php?logfile=ipsec");
|
60
|
display_top_tabs($tab_array);
|
61
|
|
62
|
if (isset($mobile['pool']) && is_array($mobile['pool'])) {
|
63
|
?>
|
64
|
<div class="table-responsive">
|
65
|
<table class="table table-hover table-condensed">
|
66
|
<thead>
|
67
|
<tr>
|
68
|
<th><?=gettext("Pool")?></th>
|
69
|
<th><?=gettext("Usage")?></th>
|
70
|
<th><?=gettext("Online")?></th>
|
71
|
<th><?=gettext("ID")?></th>
|
72
|
<th><?=gettext("Host")?></th>
|
73
|
<th><?=gettext("Status")?></th>
|
74
|
</tr>
|
75
|
</thead>
|
76
|
<tbody>
|
77
|
<?php
|
78
|
foreach($mobile['pool'] as $pool) {
|
79
|
// The first row of each pool includes the pool information
|
80
|
?>
|
81
|
<tr>
|
82
|
<td>
|
83
|
<?=$pool['name']?>
|
84
|
</td>
|
85
|
<td>
|
86
|
<?=$pool['usage']?>
|
87
|
</td>
|
88
|
<td>
|
89
|
<?=$pool['online']?>
|
90
|
</td>
|
91
|
|
92
|
<?php
|
93
|
$leaserow = true;
|
94
|
if (is_array($pool['lease']) && count($pool['lease']) > 0) {
|
95
|
foreach ($pool['lease'] as $lease) {
|
96
|
if(!$leaserow) {
|
97
|
// On subsequent rows the first three columns are blank
|
98
|
?>
|
99
|
<tr>
|
100
|
<td></td>
|
101
|
<td></td>
|
102
|
<td></td>
|
103
|
<?php
|
104
|
}
|
105
|
$leaserow = false;
|
106
|
?>
|
107
|
<td>
|
108
|
<?=htmlspecialchars($lease['id'])?>
|
109
|
</td>
|
110
|
<td>
|
111
|
<?=htmlspecialchars($lease['host'])?>
|
112
|
</td>
|
113
|
<td>
|
114
|
<?=htmlspecialchars($lease['status'])?>
|
115
|
</td>
|
116
|
</tr>
|
117
|
<?php
|
118
|
|
119
|
}
|
120
|
}
|
121
|
else {
|
122
|
?>
|
123
|
<td colspan="3" class="warning"><?=gettext('No leases from this pool yet.')?></td>
|
124
|
</tr>
|
125
|
<?php
|
126
|
}
|
127
|
}
|
128
|
?>
|
129
|
</tbody>
|
130
|
</table>
|
131
|
</div>
|
132
|
<?php
|
133
|
}
|
134
|
else
|
135
|
print_info_box(gettext('No IPsec pools.'));
|
136
|
|
137
|
print_info_box(gettext('You can configure your IPsec subsystem by clicking ') . '<a href="vpn_ipsec.php">' . gettext("here.") . '</a>');
|
138
|
|
139
|
include("foot.inc");
|