1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_ipsec.php
|
4 |
e2411886
|
Scott Ullrich
|
part of m0n0wall (http://m0n0.ch/wall)
|
5 |
574a2b47
|
Scott Ullrich
|
|
6 |
e2411886
|
Scott Ullrich
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
7 |
a93e56c5
|
Matthew Grooms
|
Copyright (C) 2008 Shrew Soft Inc
|
8 |
cfc707f7
|
Scott Ullrich
|
All rights reserved.
|
9 |
574a2b47
|
Scott Ullrich
|
|
10 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
574a2b47
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
574a2b47
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
574a2b47
|
Scott Ullrich
|
|
20 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
33 |
|
|
##|*IDENT=page-vpn-ipsec
|
34 |
|
|
##|*NAME=VPN: IPsec page
|
35 |
|
|
##|*DESCR=Allow access to the 'VPN: IPsec' page.
|
36 |
|
|
##|*MATCH=vpn_ipsec.php*
|
37 |
|
|
##|-PRIV
|
38 |
|
|
|
39 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
40 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
41 |
|
|
require_once("filter.inc");
|
42 |
|
|
require_once("shaper.inc");
|
43 |
483e6de8
|
Scott Ullrich
|
require_once("ipsec.inc");
|
44 |
|
|
require_once("vpn.inc");
|
45 |
5b237745
|
Scott Ullrich
|
|
46 |
a93e56c5
|
Matthew Grooms
|
if (!is_array($config['ipsec']['phase1']))
|
47 |
|
|
$config['ipsec']['phase1'] = array();
|
48 |
|
|
|
49 |
|
|
if (!is_array($config['ipsec']['phase2']))
|
50 |
|
|
$config['ipsec']['phase2'] = array();
|
51 |
|
|
|
52 |
|
|
$a_phase1 = &$config['ipsec']['phase1'];
|
53 |
|
|
$a_phase2 = &$config['ipsec']['phase2'];
|
54 |
|
|
|
55 |
5b237745
|
Scott Ullrich
|
$pconfig['enable'] = isset($config['ipsec']['enable']);
|
56 |
|
|
|
57 |
|
|
if ($_POST) {
|
58 |
|
|
|
59 |
|
|
if ($_POST['apply']) {
|
60 |
|
|
$retval = 0;
|
61 |
647c7c48
|
Seth Mos
|
$retval = vpn_ipsec_refresh_policies();
|
62 |
3851094f
|
Scott Ullrich
|
$retval = vpn_ipsec_configure();
|
63 |
04b46591
|
Ermal Lu?i
|
/* reload the filter in the background */
|
64 |
|
|
filter_configure();
|
65 |
5b237745
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
66 |
bca506d4
|
jim-p
|
if ($retval >= 0) {
|
67 |
a368a026
|
Ermal Lu?i
|
if (is_subsystem_dirty('ipsec'))
|
68 |
|
|
clear_subsystem_dirty('ipsec');
|
69 |
5b237745
|
Scott Ullrich
|
}
|
70 |
|
|
} else if ($_POST['submit']) {
|
71 |
|
|
$pconfig = $_POST;
|
72 |
574a2b47
|
Scott Ullrich
|
|
73 |
5b237745
|
Scott Ullrich
|
$config['ipsec']['enable'] = $_POST['enable'] ? true : false;
|
74 |
c20acc35
|
Scott Ullrich
|
|
75 |
5b237745
|
Scott Ullrich
|
write_config();
|
76 |
9fad9848
|
jim-p
|
|
77 |
|
|
$retval = vpn_ipsec_configure();
|
78 |
5b237745
|
Scott Ullrich
|
}
|
79 |
|
|
}
|
80 |
|
|
|
81 |
a93e56c5
|
Matthew Grooms
|
if ($_GET['act'] == "delph1")
|
82 |
|
|
{
|
83 |
|
|
if ($a_phase1[$_GET['p1index']]) {
|
84 |
6de5d673
|
Seth Mos
|
/* remove static route if interface is not WAN */
|
85 |
99bbd213
|
Matthew Grooms
|
if ($a_phase1[$_GET['p1index']]['interface'] <> "wan")
|
86 |
fbc8af8f
|
sullrich
|
mwexec("/sbin/route delete -host {$a_phase1[$_GET['p1index']]['remote-gateway']}");
|
87 |
a93e56c5
|
Matthew Grooms
|
|
88 |
|
|
/* remove all phase2 entries that match the ikeid */
|
89 |
|
|
$ikeid = $a_phase1[$_GET['p1index']]['ikeid'];
|
90 |
99bbd213
|
Matthew Grooms
|
foreach ($a_phase2 as $p2index => $ph2tmp)
|
91 |
6fd8526b
|
Rafael Abdo
|
if ($ph2tmp['ikeid'] == $ikeid) {
|
92 |
|
|
remove_tunnel_spd_policy($a_phase1[$_GET['p1index']],$a_phase2[$p2index]);
|
93 |
a93e56c5
|
Matthew Grooms
|
unset($a_phase2[$p2index]);
|
94 |
6fd8526b
|
Rafael Abdo
|
}
|
95 |
|
|
|
96 |
|
|
/* needs to guarantee that SPDs will be removed before phase 1 */
|
97 |
|
|
vpn_ipsec_refresh_policies();
|
98 |
a93e56c5
|
Matthew Grooms
|
|
99 |
|
|
/* remove the phase1 entry */
|
100 |
|
|
unset($a_phase1[$_GET['p1index']]);
|
101 |
647c7c48
|
Seth Mos
|
vpn_ipsec_refresh_policies();
|
102 |
|
|
vpn_ipsec_configure();
|
103 |
a93e56c5
|
Matthew Grooms
|
write_config();
|
104 |
72bd8df5
|
Ermal Lu?i
|
filter_configure();
|
105 |
a93e56c5
|
Matthew Grooms
|
header("Location: vpn_ipsec.php");
|
106 |
|
|
exit;
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
if ($_GET['act'] == "delph2")
|
111 |
|
|
{
|
112 |
6fd8526b
|
Rafael Abdo
|
if ($a_phase1[$_GET['p1index']] && $a_phase2[$_GET['p2index']]) {
|
113 |
|
|
remove_tunnel_spd_policy($a_phase1[$_GET['p1index']],$a_phase2[$_GET['p2index']]);
|
114 |
a93e56c5
|
Matthew Grooms
|
/* remove the phase2 entry */
|
115 |
|
|
unset($a_phase2[$_GET['p2index']]);
|
116 |
647c7c48
|
Seth Mos
|
vpn_ipsec_refresh_policies();
|
117 |
|
|
vpn_ipsec_configure();
|
118 |
3fdb04a6
|
Scott Ullrich
|
filter_configure();
|
119 |
5b237745
|
Scott Ullrich
|
write_config();
|
120 |
|
|
header("Location: vpn_ipsec.php");
|
121 |
|
|
exit;
|
122 |
|
|
}
|
123 |
|
|
}
|
124 |
4df96eff
|
Scott Ullrich
|
|
125 |
108f16bf
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"));
|
126 |
b32dd0a6
|
jim-p
|
$shortcut_section = "ipsec";
|
127 |
6deedfde
|
jim-p
|
|
128 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
129 |
|
|
|
130 |
53d4b84d
|
Scott Ullrich
|
?>
|
131 |
422f27c0
|
Scott Ullrich
|
|
132 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
133 |
5b237745
|
Scott Ullrich
|
<?php include("fbegin.inc"); ?>
|
134 |
|
|
<form action="vpn_ipsec.php" method="post">
|
135 |
323d040b
|
Scott Ullrich
|
<?php
|
136 |
a93e56c5
|
Matthew Grooms
|
if ($savemsg)
|
137 |
|
|
print_info_box($savemsg);
|
138 |
a368a026
|
Ermal Lu?i
|
if ($pconfig['enable'] && is_subsystem_dirty('ipsec'))
|
139 |
108f16bf
|
Carlos Eduardo Ramos
|
print_info_box_np(gettext("The IPsec tunnel configuration has been changed") . ".<br>" . gettext("You must apply the changes in order for them to take effect."));
|
140 |
574a2b47
|
Scott Ullrich
|
?>
|
141 |
a93e56c5
|
Matthew Grooms
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
142 |
|
|
<tr>
|
143 |
|
|
<td class="tabnavtbl">
|
144 |
|
|
<?php
|
145 |
|
|
$tab_array = array();
|
146 |
108f16bf
|
Carlos Eduardo Ramos
|
$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
|
147 |
|
|
$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
148 |
2a2b247b
|
jim-p
|
$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
|
149 |
a93e56c5
|
Matthew Grooms
|
display_top_tabs($tab_array);
|
150 |
|
|
?>
|
151 |
|
|
</td>
|
152 |
|
|
</tr>
|
153 |
|
|
<tr>
|
154 |
|
|
<td>
|
155 |
|
|
<div id="mainarea">
|
156 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
157 |
|
|
<tr>
|
158 |
|
|
<td class="vtable">
|
159 |
667725ce
|
Matthew Grooms
|
<table border="0" cellspacing="2" cellpadding="0">
|
160 |
|
|
<tr>
|
161 |
|
|
<td>
|
162 |
|
|
<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked";?>>
|
163 |
|
|
</td>
|
164 |
|
|
<td>
|
165 |
108f16bf
|
Carlos Eduardo Ramos
|
<strong><?=gettext("Enable IPsec"); ?></strong>
|
166 |
667725ce
|
Matthew Grooms
|
</td>
|
167 |
|
|
</tr>
|
168 |
|
|
</table>
|
169 |
a93e56c5
|
Matthew Grooms
|
</td>
|
170 |
|
|
</tr>
|
171 |
|
|
<tr>
|
172 |
|
|
<td>
|
173 |
108f16bf
|
Carlos Eduardo Ramos
|
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
|
174 |
a93e56c5
|
Matthew Grooms
|
</td>
|
175 |
|
|
</tr>
|
176 |
|
|
</table>
|
177 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
178 |
5bba8dfb
|
Scott Ullrich
|
<?php
|
179 |
|
|
$i = 0;
|
180 |
|
|
foreach ($a_phase1 as $ph1ent) {
|
181 |
|
|
if (isset( $ph1ent['disabled'])) {
|
182 |
|
|
$spans = "<span class=\"gray\">";
|
183 |
|
|
$spane = "</span>";
|
184 |
|
|
}
|
185 |
|
|
else
|
186 |
|
|
$spans = $spane = "";
|
187 |
96162327
|
Scott Ullrich
|
|
188 |
|
|
show_ipsec_header($ph1ent);
|
189 |
4494cf6a
|
Chris Buechler
|
$counter++; // used to determine if we need to output header manually (no records exist)
|
190 |
96162327
|
Scott Ullrich
|
?>
|
191 |
a0d4c5da
|
Matthew Grooms
|
<tr valign="top" ondblclick="document.location='vpn_ipsec_phase1.php?p1index=<?=$i;?>'">
|
192 |
|
|
<td class="listlr">
|
193 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
194 |
|
|
<?php
|
195 |
|
|
if ($ph1ent['interface']) {
|
196 |
|
|
$iflabels = get_configured_interface_with_descr();
|
197 |
6dbffeda
|
smos
|
|
198 |
abcb2bed
|
Ermal Lu?i
|
$carplist = get_configured_carp_interface_list();
|
199 |
|
|
foreach ($carplist as $cif => $carpip)
|
200 |
25f6730a
|
Pierre POMES
|
$iflabels[$cif] = $carpip." (".get_vip_descr($carpip).")";
|
201 |
6dbffeda
|
smos
|
|
202 |
25f6730a
|
Pierre POMES
|
$aliaslist = get_configured_ip_aliases_list();
|
203 |
|
|
foreach ($aliaslist as $aliasip => $aliasif)
|
204 |
|
|
$iflabels[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
205 |
6dbffeda
|
smos
|
|
206 |
|
|
$grouplist = return_gateway_groups_array();
|
207 |
|
|
foreach ($grouplist as $name => $group) {
|
208 |
|
|
if($group[0]['vip'] <> "")
|
209 |
|
|
$vipif = $group[0]['vip'];
|
210 |
|
|
else
|
211 |
|
|
$vipif = $group[0]['int'];
|
212 |
|
|
$iflabels[$name] = "GW Group {$name}";
|
213 |
|
|
}
|
214 |
a93e56c5
|
Matthew Grooms
|
$if = htmlspecialchars($iflabels[$ph1ent['interface']]);
|
215 |
|
|
}
|
216 |
|
|
else
|
217 |
|
|
$if = "WAN";
|
218 |
|
|
|
219 |
3462a529
|
Matthew Grooms
|
if (!isset($ph1ent['mobile']))
|
220 |
|
|
echo $if."<br>".$ph1ent['remote-gateway'];
|
221 |
|
|
else
|
222 |
108f16bf
|
Carlos Eduardo Ramos
|
echo $if."<br><strong>" . gettext("Mobile Client") . "</strong>";
|
223 |
a93e56c5
|
Matthew Grooms
|
?>
|
224 |
|
|
<?=$spane;?>
|
225 |
|
|
</td>
|
226 |
a0d4c5da
|
Matthew Grooms
|
<td class="listr">
|
227 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
228 |
|
|
<?=$ph1ent['mode'];?>
|
229 |
|
|
<?=$spane;?>
|
230 |
|
|
</td>
|
231 |
a0d4c5da
|
Matthew Grooms
|
<td class="listr">
|
232 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
233 |
|
|
<?=$p1_ealgos[$ph1ent['encryption-algorithm']['name']]['name'];?>
|
234 |
|
|
<?php
|
235 |
|
|
if ($ph1ent['encryption-algorithm']['keylen']) {
|
236 |
|
|
if ($ph1ent['encryption-algorithm']['keylen']=="auto")
|
237 |
108f16bf
|
Carlos Eduardo Ramos
|
echo " (" . gettext("auto") . ")";
|
238 |
a93e56c5
|
Matthew Grooms
|
else
|
239 |
108f16bf
|
Carlos Eduardo Ramos
|
echo " ({$ph1ent['encryption-algorithm']['keylen']} " . gettext("bits") . ")";
|
240 |
a93e56c5
|
Matthew Grooms
|
}
|
241 |
|
|
?>
|
242 |
|
|
<?=$spane;?>
|
243 |
|
|
</td>
|
244 |
a0d4c5da
|
Matthew Grooms
|
<td class="listr">
|
245 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
246 |
|
|
<?=$p1_halgos[$ph1ent['hash-algorithm']];?>
|
247 |
|
|
<?=$spane;?>
|
248 |
|
|
</td>
|
249 |
b9056c39
|
Scott Ullrich
|
<td class="listbg">
|
250 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
251 |
b9056c39
|
Scott Ullrich
|
<?=htmlspecialchars($ph1ent['descr']);?>
|
252 |
a93e56c5
|
Matthew Grooms
|
<?=$spane;?>
|
253 |
|
|
</td>
|
254 |
|
|
<td valign="middle" nowrap class="list">
|
255 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
256 |
|
|
<tr>
|
257 |
|
|
<td>
|
258 |
|
|
<a href="vpn_ipsec_phase1.php?p1index=<?=$i;?>">
|
259 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit phase1 entry"); ?>" width="17" height="17" border="0">
|
260 |
a93e56c5
|
Matthew Grooms
|
</a>
|
261 |
|
|
</td>
|
262 |
|
|
<td>
|
263 |
108f16bf
|
Carlos Eduardo Ramos
|
<a href="vpn_ipsec.php?act=delph1&p1index=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this phase1 and all associated phase2 entries?"); ?>')">
|
264 |
|
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete phase1 entry"); ?>" width="17" height="17" border="0">
|
265 |
a93e56c5
|
Matthew Grooms
|
</a>
|
266 |
|
|
</td>
|
267 |
|
|
</tr>
|
268 |
fce61eda
|
Matthew Grooms
|
<?php if (!isset($ph1ent['mobile'])): ?>
|
269 |
a93e56c5
|
Matthew Grooms
|
<tr>
|
270 |
|
|
<td>
|
271 |
|
|
</td>
|
272 |
|
|
<td>
|
273 |
|
|
<a href="vpn_ipsec_phase1.php?dup=<?=$i;?>">
|
274 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("copy phase1 entry"); ?>" width="17" height="17" border="0">
|
275 |
a93e56c5
|
Matthew Grooms
|
</a>
|
276 |
|
|
</td>
|
277 |
|
|
</tr>
|
278 |
fce61eda
|
Matthew Grooms
|
<?php endif; ?>
|
279 |
a93e56c5
|
Matthew Grooms
|
</table>
|
280 |
|
|
</td>
|
281 |
|
|
</tr>
|
282 |
|
|
<tr>
|
283 |
abd378bf
|
Scott Ullrich
|
<td class="listrborder" colspan="5">
|
284 |
0a95b653
|
Scott Ullrich
|
<div id="shph2but-<?=$i?>">
|
285 |
e1b74950
|
Scott Ullrich
|
<?php
|
286 |
|
|
$phase2count=0;
|
287 |
b2a189a8
|
Scott Ullrich
|
foreach ($a_phase2 as $ph2ent) {
|
288 |
c82c89ac
|
Scott Ullrich
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid'])
|
289 |
b2a189a8
|
Scott Ullrich
|
continue;
|
290 |
|
|
if (isset( $ph2ent['disabled']) || isset($ph1ent['disabled']))
|
291 |
|
|
continue;
|
292 |
e1b74950
|
Scott Ullrich
|
$phase2count++;
|
293 |
b2a189a8
|
Scott Ullrich
|
}
|
294 |
e1b74950
|
Scott Ullrich
|
?>
|
295 |
108f16bf
|
Carlos Eduardo Ramos
|
<input type="button" onClick="show_phase2('tdph2-<?=$i?>','shph2but-<?=$i?>')" value="+"></input> - <?php printf(gettext("Show %s Phase-2 entries"), $phase2count); ?></a>
|
296 |
0a95b653
|
Scott Ullrich
|
</div>
|
297 |
|
|
<table class="tabcont" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" id="tdph2-<?=$i?>" style="display:none">
|
298 |
a93e56c5
|
Matthew Grooms
|
<tr>
|
299 |
108f16bf
|
Carlos Eduardo Ramos
|
<td class="listhdrr"><?=gettext("Mode"); ?></td>
|
300 |
1778480d
|
Seth Mos
|
<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
|
301 |
108f16bf
|
Carlos Eduardo Ramos
|
<td class="listhdrr"><?=gettext("Local Subnet"); ?></td>
|
302 |
|
|
<td class="listhdrr"><?=gettext("Remote Subnet"); ?></td>
|
303 |
4b96b367
|
mgrooms
|
<?php endif; ?>
|
304 |
108f16bf
|
Carlos Eduardo Ramos
|
<td class="listhdrr"><?=gettext("P2 Protocol"); ?></td>
|
305 |
|
|
<td class="listhdrr"><?=gettext("P2 Transforms"); ?></td>
|
306 |
|
|
<td class="listhdrr"><?=gettext("P2 Auth Methods"); ?></td>
|
307 |
a93e56c5
|
Matthew Grooms
|
<td class ="list">
|
308 |
3462a529
|
Matthew Grooms
|
<a href="vpn_ipsec_phase2.php?ikeid=<?=$ph1ent['ikeid'];?><?php if (isset($ph1ent['mobile'])) echo "&mobile=true";?>">
|
309 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add phase2 entry"); ?>" width="17" height="17" border="0">
|
310 |
a93e56c5
|
Matthew Grooms
|
</a>
|
311 |
|
|
</td>
|
312 |
|
|
</tr>
|
313 |
|
|
<?php
|
314 |
|
|
$j = 0;
|
315 |
|
|
foreach ($a_phase2 as $ph2ent) {
|
316 |
|
|
if ($ph2ent['ikeid'] != $ph1ent['ikeid']) {
|
317 |
|
|
$j++;
|
318 |
|
|
continue;
|
319 |
|
|
}
|
320 |
|
|
|
321 |
|
|
if (isset( $ph2ent['disabled']) || isset($ph1ent['disabled'])) {
|
322 |
|
|
$spans = "<span class=\"gray\">";
|
323 |
|
|
$spane = "</span>";
|
324 |
|
|
}
|
325 |
|
|
else
|
326 |
|
|
$spans = $spane = "";
|
327 |
|
|
?>
|
328 |
4da0e32a
|
Seth Mos
|
<tr valign="top" ondblclick="document.location='vpn_ipsec_phase2.php?p2index=<?=$j;?>'">
|
329 |
3462a529
|
Matthew Grooms
|
|
330 |
a0d4c5da
|
Matthew Grooms
|
<td nowrap class="listlr">
|
331 |
4b96b367
|
mgrooms
|
<?=$spans;?>
|
332 |
|
|
<?=$ph2ent['mode'];?>
|
333 |
|
|
<?=$spane;?>
|
334 |
|
|
</td>
|
335 |
c443bb14
|
Scott Ullrich
|
<?php
|
336 |
1778480d
|
Seth Mos
|
if(($ph2ent['mode'] <> "tunnel") and ($ph2ent['mode'] <> "tunnel6")) {
|
337 |
c443bb14
|
Scott Ullrich
|
echo "<td nowrap class=\"listr\"> </td><td nowrap class=\"listr\"> </td>";
|
338 |
|
|
}
|
339 |
|
|
?>
|
340 |
1778480d
|
Seth Mos
|
<?php if(($ph2ent['mode'] == "tunnel") or ($ph2ent['mode'] == "tunnel6")): ?>
|
341 |
4b96b367
|
mgrooms
|
<td nowrap class="listr">
|
342 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
343 |
3462a529
|
Matthew Grooms
|
<?=ipsec_idinfo_to_text($ph2ent['localid']); ?>
|
344 |
a93e56c5
|
Matthew Grooms
|
<?=$spane;?>
|
345 |
|
|
</td>
|
346 |
a0d4c5da
|
Matthew Grooms
|
<td nowrap class="listr">
|
347 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
348 |
3462a529
|
Matthew Grooms
|
<?=ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
|
349 |
a93e56c5
|
Matthew Grooms
|
<?=$spane;?>
|
350 |
|
|
</td>
|
351 |
4b96b367
|
mgrooms
|
<?php endif; ?>
|
352 |
a0d4c5da
|
Matthew Grooms
|
<td nowrap class="listr">
|
353 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
354 |
3462a529
|
Matthew Grooms
|
<?php echo $p2_protos[$ph2ent['protocol']]; ?>
|
355 |
a93e56c5
|
Matthew Grooms
|
<?=$spane;?>
|
356 |
|
|
</td>
|
357 |
a0d4c5da
|
Matthew Grooms
|
<td class="listr">
|
358 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
359 |
|
|
<?php
|
360 |
|
|
$k = 0;
|
361 |
|
|
foreach ($ph2ent['encryption-algorithm-option'] as $ph2ea) {
|
362 |
|
|
if ($k++)
|
363 |
|
|
echo ", ";
|
364 |
|
|
echo $p2_ealgos[$ph2ea['name']]['name'];
|
365 |
|
|
if ($ph2ea['keylen']) {
|
366 |
|
|
if ($ph2ea['keylen']=="auto")
|
367 |
108f16bf
|
Carlos Eduardo Ramos
|
echo " (" . gettext("auto") . ")";
|
368 |
a93e56c5
|
Matthew Grooms
|
else
|
369 |
108f16bf
|
Carlos Eduardo Ramos
|
echo " ({$ph2ea['keylen']} " . gettext("bits") . ")";
|
370 |
a93e56c5
|
Matthew Grooms
|
}
|
371 |
|
|
}
|
372 |
|
|
?>
|
373 |
|
|
<?=$spane;?>
|
374 |
|
|
</td>
|
375 |
a0d4c5da
|
Matthew Grooms
|
<td nowrap class="listr">
|
376 |
a93e56c5
|
Matthew Grooms
|
<?=$spans;?>
|
377 |
|
|
<?php
|
378 |
|
|
$k = 0;
|
379 |
|
|
foreach ($ph2ent['hash-algorithm-option'] as $ph2ha) {
|
380 |
|
|
if ($k++)
|
381 |
|
|
echo ", ";
|
382 |
|
|
echo $p2_halgos[$ph2ha];
|
383 |
|
|
}
|
384 |
|
|
?>
|
385 |
|
|
<?=$spane;?>
|
386 |
|
|
</td>
|
387 |
|
|
<td nowrap class="list">
|
388 |
|
|
<a href="vpn_ipsec_phase2.php?p2index=<?=$j;?>">
|
389 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit phase2 entry"); ?>" width="17" height="17" border="0">
|
390 |
a93e56c5
|
Matthew Grooms
|
</a>
|
391 |
6fd8526b
|
Rafael Abdo
|
<a href="vpn_ipsec.php?act=delph2&p1index=<?=$i;?>&p2index=<?=$j;?>" onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')">
|
392 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete phase2 entry"); ?>" width="17" height="17" border="0">
|
393 |
a93e56c5
|
Matthew Grooms
|
</a>
|
394 |
c8ff68a4
|
jim-p
|
<a href="vpn_ipsec_phase2.php?dup=<?=$j;?>">
|
395 |
|
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new Phase 2 based on this one"); ?>" width="17" height="17" border="0">
|
396 |
|
|
</a>
|
397 |
a93e56c5
|
Matthew Grooms
|
</td>
|
398 |
|
|
</tr>
|
399 |
3462a529
|
Matthew Grooms
|
|
400 |
a93e56c5
|
Matthew Grooms
|
<?php
|
401 |
|
|
$j++;
|
402 |
|
|
}
|
403 |
|
|
?>
|
404 |
|
|
</table>
|
405 |
|
|
</td>
|
406 |
|
|
</tr>
|
407 |
0a95b653
|
Scott Ullrich
|
<tr>
|
408 |
|
|
<td>
|
409 |
|
|
|
410 |
|
|
</td>
|
411 |
|
|
</tr>
|
412 |
a93e56c5
|
Matthew Grooms
|
<?php
|
413 |
|
|
$i++;
|
414 |
|
|
}
|
415 |
96162327
|
Scott Ullrich
|
if(!$counter)
|
416 |
83221d3b
|
sullrich
|
show_ipsec_header($ph1ent);
|
417 |
5b237745
|
Scott Ullrich
|
?>
|
418 |
a93e56c5
|
Matthew Grooms
|
<tr>
|
419 |
|
|
<td class="list" colspan="5"></td>
|
420 |
|
|
<td class="list">
|
421 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
422 |
|
|
<tr>
|
423 |
|
|
<td width="17"></td>
|
424 |
|
|
<td>
|
425 |
|
|
<a href="vpn_ipsec_phase1.php">
|
426 |
108f16bf
|
Carlos Eduardo Ramos
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add phase1 entry"); ?>" width="17" height="17" border="0">
|
427 |
a93e56c5
|
Matthew Grooms
|
</a>
|
428 |
|
|
</td>
|
429 |
|
|
</tr>
|
430 |
|
|
</table>
|
431 |
|
|
<td>
|
432 |
|
|
</tr>
|
433 |
|
|
<tr>
|
434 |
|
|
<td colspan="4">
|
435 |
|
|
<p>
|
436 |
|
|
<span class="vexpl">
|
437 |
|
|
<span class="red">
|
438 |
108f16bf
|
Carlos Eduardo Ramos
|
<strong><?=gettext("Note"); ?>:<br></strong>
|
439 |
a93e56c5
|
Matthew Grooms
|
</span>
|
440 |
127eb8e0
|
jim-p
|
<?=gettext("You can check your IPsec status at"); ?> <a href="diag_ipsec.php"><?=gettext("Status:IPsec"); ?></a>.<br/>
|
441 |
|
|
<?=gettext("IPsec Debug Mode can be enabled at"); ?> <a href="system_advanced_misc.php"><?=gettext("System:Advanced:Miscellaneous"); ?></a>.<br/>
|
442 |
|
|
<?=gettext("IPsec can be set to prefer older SAs at"); ?> <a href="system_advanced_misc.php"><?=gettext("System:Advanced:Miscellaneous"); ?></a>.
|
443 |
a93e56c5
|
Matthew Grooms
|
</span>
|
444 |
|
|
</p>
|
445 |
|
|
</td>
|
446 |
|
|
</tr>
|
447 |
|
|
</table>
|
448 |
|
|
</div>
|
449 |
|
|
</td>
|
450 |
5b237745
|
Scott Ullrich
|
</tr>
|
451 |
|
|
</table>
|
452 |
|
|
</form>
|
453 |
|
|
<?php include("fend.inc"); ?>
|
454 |
0a95b653
|
Scott Ullrich
|
<script type="text/javascript">
|
455 |
|
|
function show_phase2(id, buttonid) {
|
456 |
|
|
document.getElementById(buttonid).innerHTML='';
|
457 |
|
|
aodiv = document.getElementById(id);
|
458 |
|
|
aodiv.style.display = "block";
|
459 |
|
|
}
|
460 |
|
|
</script>
|
461 |
323d040b
|
Scott Ullrich
|
</body>
|
462 |
|
|
</html>
|
463 |
96162327
|
Scott Ullrich
|
|
464 |
|
|
<?php
|
465 |
|
|
|
466 |
afcda0d0
|
sullrich
|
function show_ipsec_header($ph1ent) {
|
467 |
|
|
global $g;
|
468 |
83221d3b
|
sullrich
|
if (isset($ph1ent['mobile']))
|
469 |
|
|
$mobile = "&mobile=true";
|
470 |
e46616a7
|
Erik Fonnesbeck
|
?>
|
471 |
96162327
|
Scott Ullrich
|
<tr>
|
472 |
108f16bf
|
Carlos Eduardo Ramos
|
<td class="listhdrr"><?=gettext("Remote Gateway"); ?></td>
|
473 |
|
|
<td class="listhdrr"><?=gettext("Mode"); ?></td>
|
474 |
|
|
<td class="listhdrr"><?=gettext("P1 Protocol"); ?></td>
|
475 |
|
|
<td class="listhdrr"><?=gettext("P1 Transforms"); ?></td>
|
476 |
|
|
<td class="listhdrr"><?=gettext("P1 Description"); ?></td>
|
477 |
96162327
|
Scott Ullrich
|
<td class ="list">
|
478 |
|
|
</td>
|
479 |
|
|
</tr>
|
480 |
|
|
|
481 |
e46616a7
|
Erik Fonnesbeck
|
<?php
|
482 |
96162327
|
Scott Ullrich
|
|
483 |
|
|
}
|
484 |
|
|
|
485 |
04831121
|
Bill Marquette
|
?>
|