1 |
71172088
|
jim-p
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_ipsec_settings.php
|
4 |
|
|
|
5 |
ed2d1343
|
Renato Botelho
|
Copyright (C) 2015 Electric Sheep Fencing, LLC
|
6 |
71172088
|
jim-p
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
##|+PRIV
|
31 |
|
|
##|*IDENT=page-vpn-ipsec-settings
|
32 |
|
|
##|*NAME=VPN: IPsec: Settings page
|
33 |
|
|
##|*DESCR=Allow access to the 'VPN: IPsec: Settings' page.
|
34 |
|
|
##|*MATCH=vpn_ipsec_settings.php*
|
35 |
|
|
##|-PRIV
|
36 |
|
|
|
37 |
|
|
require("functions.inc");
|
38 |
|
|
require("guiconfig.inc");
|
39 |
|
|
require_once("filter.inc");
|
40 |
|
|
require_once("shaper.inc");
|
41 |
|
|
require_once("ipsec.inc");
|
42 |
|
|
require_once("vpn.inc");
|
43 |
|
|
|
44 |
|
|
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
|
45 |
|
|
foreach ($ipsec_loglevels as $lkey => $ldescr) {
|
46 |
|
|
if (!empty($config['ipsec']["ipsec_{$lkey}"]))
|
47 |
|
|
$pconfig["ipsec_{$lkey}"] = $config['ipsec']["ipsec_{$lkey}"];
|
48 |
|
|
}
|
49 |
4a076e36
|
Ermal LUÇI
|
$pconfig['unityplugin'] = isset($config['ipsec']['unityplugin']);
|
50 |
e57a3e40
|
Chris Buechler
|
$pconfig['compression'] = isset($config['ipsec']['compression']);
|
51 |
737b18f2
|
Ermal
|
$pconfig['acceptunencryptedmainmode'] = isset($config['ipsec']['acceptunencryptedmainmode']);
|
52 |
71172088
|
jim-p
|
$pconfig['maxmss_enable'] = isset($config['system']['maxmss_enable']);
|
53 |
|
|
$pconfig['maxmss'] = $config['system']['maxmss'];
|
54 |
|
|
|
55 |
6ae8b844
|
Ermal
|
if ($_POST) {
|
56 |
71172088
|
jim-p
|
|
57 |
|
|
unset($input_errors);
|
58 |
|
|
$pconfig = $_POST;
|
59 |
a96dc32e
|
Chris Buechler
|
|
60 |
|
|
if (!in_array($pconfig['ipsec_dmn'], array('0', '1', '2', '3', '4', '5'), true)) {
|
61 |
|
|
$input_errors[] = "A valid value must be specified for Daemon debug.";
|
62 |
|
|
}
|
63 |
|
|
if (!in_array($pconfig['ipsec_mgr'], array('0', '1', '2', '3', '4', '5'), true)) {
|
64 |
|
|
$input_errors[] = "A valid value must be specified for SA Manager debug.";
|
65 |
|
|
}
|
66 |
|
|
if (!in_array($pconfig['ipsec_ike'], array('0', '1', '2', '3', '4', '5'), true)) {
|
67 |
|
|
$input_errors[] = "A valid value must be specified for IKE SA debug.";
|
68 |
|
|
}
|
69 |
|
|
if (!in_array($pconfig['ipsec_chd'], array('0', '1', '2', '3', '4', '5'), true)) {
|
70 |
|
|
$input_errors[] = "A valid value must be specified for IKE Child SA debug.";
|
71 |
|
|
}
|
72 |
|
|
if (!in_array($pconfig['ipsec_job'], array('0', '1', '2', '3', '4', '5'), true)) {
|
73 |
|
|
$input_errors[] = "A valid value must be specified for Job Processing debug.";
|
74 |
|
|
}
|
75 |
|
|
if (!in_array($pconfig['ipsec_cfg'], array('0', '1', '2', '3', '4', '5'), true)) {
|
76 |
|
|
$input_errors[] = "A valid value must be specified for Configuration backend debug.";
|
77 |
|
|
}
|
78 |
|
|
if (!in_array($pconfig['ipsec_knl'], array('0', '1', '2', '3', '4', '5'), true)) {
|
79 |
|
|
$input_errors[] = "A valid value must be specified for Kernel Interface debug.";
|
80 |
|
|
}
|
81 |
|
|
if (!in_array($pconfig['ipsec_net'], array('0', '1', '2', '3', '4', '5'), true)) {
|
82 |
|
|
$input_errors[] = "A valid value must be specified for Networking debug.";
|
83 |
|
|
}
|
84 |
|
|
if (!in_array($pconfig['ipsec_asn'], array('0', '1', '2', '3', '4', '5'), true)) {
|
85 |
|
|
$input_errors[] = "A valid value must be specified for ASN Encoding debug.";
|
86 |
|
|
}
|
87 |
|
|
if (!in_array($pconfig['ipsec_enc'], array('0', '1', '2', '3', '4', '5'), true)) {
|
88 |
|
|
$input_errors[] = "A valid value must be specified for Message encoding debug.";
|
89 |
|
|
}
|
90 |
|
|
if (!in_array($pconfig['ipsec_imc'], array('0', '1', '2', '3', '4', '5'), true)) {
|
91 |
|
|
$input_errors[] = "A valid value must be specified for Integrity checker debug.";
|
92 |
|
|
}
|
93 |
|
|
if (!in_array($pconfig['ipsec_imv'], array('0', '1', '2', '3', '4', '5'), true)) {
|
94 |
|
|
$input_errors[] = "A valid value must be specified for Integrity Verifier debug.";
|
95 |
|
|
}
|
96 |
|
|
if (!in_array($pconfig['ipsec_pts'], array('0', '1', '2', '3', '4', '5'), true)) {
|
97 |
|
|
$input_errors[] = "A valid value must be specified for Platform Trust Service debug.";
|
98 |
|
|
}
|
99 |
|
|
if (!in_array($pconfig['ipsec_tls'], array('0', '1', '2', '3', '4', '5'), true)) {
|
100 |
|
|
$input_errors[] = "A valid value must be specified for TLS Handler debug.";
|
101 |
|
|
}
|
102 |
|
|
if (!in_array($pconfig['ipsec_esp'], array('0', '1', '2', '3', '4', '5'), true)) {
|
103 |
|
|
$input_errors[] = "A valid value must be specified for IPsec Traffic debug.";
|
104 |
|
|
}
|
105 |
|
|
if (!in_array($pconfig['ipsec_lib'], array('0', '1', '2', '3', '4', '5'), true)) {
|
106 |
|
|
$input_errors[] = "A valid value must be specified for StrongSwan Lib debug.";
|
107 |
|
|
}
|
108 |
|
|
if (isset($pconfig['maxmss'])) {
|
109 |
|
|
if (!is_numericint($pconfig['maxmss']) && $pconfig['maxmss'] <> '') {
|
110 |
|
|
$input_errors[] = "An integer must be specified for Maximum MSS.";
|
111 |
|
|
}
|
112 |
|
|
if ($pconfig['maxmss'] <> '' && $pconfig['maxmss'] < 576 || $pconfig['maxmss'] > 65535)
|
113 |
|
|
$input_errors[] = "An integer between 576 and 65535 must be specified for Maximum MSS";
|
114 |
|
|
}
|
115 |
|
|
|
116 |
71172088
|
jim-p
|
if (!$input_errors) {
|
117 |
|
|
|
118 |
|
|
if($_POST['preferoldsa_enable'] == "yes")
|
119 |
|
|
$config['ipsec']['preferoldsa'] = true;
|
120 |
|
|
elseif (isset($config['ipsec']['preferoldsa']))
|
121 |
|
|
unset($config['ipsec']['preferoldsa']);
|
122 |
|
|
|
123 |
|
|
if (is_array($config['ipsec'])) {
|
124 |
|
|
foreach ($ipsec_loglevels as $lkey => $ldescr) {
|
125 |
|
|
if (empty($_POST["ipsec_{$lkey}"])) {
|
126 |
|
|
if (isset($config['ipsec']["ipsec_{$lkey}"]))
|
127 |
|
|
unset($config['ipsec']["ipsec_{$lkey}"]);
|
128 |
|
|
} else
|
129 |
|
|
$config['ipsec']["ipsec_{$lkey}"] = $_POST["ipsec_{$lkey}"];
|
130 |
|
|
}
|
131 |
|
|
}
|
132 |
|
|
|
133 |
e57a3e40
|
Chris Buechler
|
if($_POST['compression'] == "yes")
|
134 |
|
|
$config['ipsec']['compression'] = true;
|
135 |
|
|
elseif (isset($config['ipsec']['compression']))
|
136 |
|
|
unset($config['ipsec']['compression']);
|
137 |
71172088
|
jim-p
|
|
138 |
4a076e36
|
Ermal LUÇI
|
if($_POST['unityplugin'] == "yes")
|
139 |
|
|
$config['ipsec']['unityplugin'] = true;
|
140 |
|
|
elseif (isset($config['ipsec']['unityplugin']))
|
141 |
|
|
unset($config['ipsec']['unityplugin']);
|
142 |
|
|
|
143 |
737b18f2
|
Ermal
|
if($_POST['acceptunencryptedmainmode'] == "yes")
|
144 |
|
|
$config['ipsec']['acceptunencryptedmainmode'] = true;
|
145 |
|
|
elseif (isset($config['ipsec']['acceptunencryptedmainmode']))
|
146 |
|
|
unset($config['ipsec']['acceptunencryptedmainmode']);
|
147 |
|
|
|
148 |
71172088
|
jim-p
|
if($_POST['maxmss_enable'] == "yes") {
|
149 |
|
|
$config['system']['maxmss_enable'] = true;
|
150 |
|
|
$config['system']['maxmss'] = $_POST['maxmss'];
|
151 |
|
|
} else {
|
152 |
|
|
unset($config['system']['maxmss_enable']);
|
153 |
|
|
unset($config['system']['maxmss']);
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
write_config();
|
157 |
|
|
|
158 |
|
|
$retval = 0;
|
159 |
|
|
$retval = filter_configure();
|
160 |
|
|
if(stristr($retval, "error") <> true)
|
161 |
|
|
$savemsg = get_std_save_message(gettext($retval));
|
162 |
|
|
else
|
163 |
|
|
$savemsg = gettext($retval);
|
164 |
|
|
|
165 |
|
|
vpn_ipsec_configure_preferoldsa();
|
166 |
|
|
vpn_ipsec_configure();
|
167 |
|
|
vpn_ipsec_configure_loglevels();
|
168 |
|
|
|
169 |
|
|
// header("Location: vpn_ipsec_settings.php");
|
170 |
|
|
// return;
|
171 |
|
|
}
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Settings"));
|
175 |
|
|
$shortcut_section = "ipsec";
|
176 |
|
|
|
177 |
|
|
include("head.inc");
|
178 |
|
|
?>
|
179 |
|
|
|
180 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
181 |
|
|
<?php include("fbegin.inc"); ?>
|
182 |
|
|
|
183 |
|
|
<script type="text/javascript">
|
184 |
391453a1
|
Colin Fleming
|
//<![CDATA[
|
185 |
71172088
|
jim-p
|
|
186 |
|
|
function maxmss_checked(obj) {
|
187 |
|
|
if (obj.checked)
|
188 |
|
|
jQuery('#maxmss').attr('disabled',false);
|
189 |
|
|
else
|
190 |
|
|
jQuery('#maxmss').attr('disabled','true');
|
191 |
|
|
}
|
192 |
|
|
|
193 |
391453a1
|
Colin Fleming
|
//]]>
|
194 |
71172088
|
jim-p
|
</script>
|
195 |
|
|
|
196 |
|
|
<form action="vpn_ipsec_settings.php" method="post" name="iform" id="iform">
|
197 |
|
|
|
198 |
|
|
<?php
|
199 |
|
|
if ($savemsg)
|
200 |
|
|
print_info_box($savemsg);
|
201 |
|
|
if ($input_errors)
|
202 |
|
|
print_input_errors($input_errors);
|
203 |
|
|
?>
|
204 |
|
|
|
205 |
391453a1
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec settings">
|
206 |
71172088
|
jim-p
|
<tr>
|
207 |
|
|
<td class="tabnavtbl">
|
208 |
|
|
<?php
|
209 |
|
|
$tab_array = array();
|
210 |
|
|
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
|
211 |
|
|
$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
212 |
|
|
$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
|
213 |
|
|
$tab_array[3] = array(gettext("Advanced Settings"), true, "vpn_ipsec_settings.php");
|
214 |
|
|
display_top_tabs($tab_array);
|
215 |
|
|
?>
|
216 |
|
|
</td>
|
217 |
|
|
</tr>
|
218 |
|
|
<tr>
|
219 |
|
|
<td id="mainarea">
|
220 |
|
|
<div class="tabcont">
|
221 |
391453a1
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
222 |
71172088
|
jim-p
|
<tr>
|
223 |
3c4fc30b
|
Chris Buechler
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("IPsec Advanced Settings"); ?></td>
|
224 |
71172088
|
jim-p
|
</tr>
|
225 |
|
|
<tr>
|
226 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Security Associations"); ?></td>
|
227 |
|
|
<td width="78%" class="vtable">
|
228 |
|
|
<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked=\"checked\""; ?> />
|
229 |
|
|
<strong><?=gettext("Prefer older IPsec SAs"); ?></strong>
|
230 |
|
|
<br />
|
231 |
|
|
<?=gettext("By default, if several SAs match, the newest one is " .
|
232 |
|
|
"preferred if it's at least 30 seconds old. Select this " .
|
233 |
|
|
"option to always prefer old SAs over new ones."); ?>
|
234 |
|
|
</td>
|
235 |
|
|
</tr>
|
236 |
|
|
<tr>
|
237 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPsec Debug"); ?></td>
|
238 |
|
|
<td width="78%" class="vtable">
|
239 |
3c4fc30b
|
Chris Buechler
|
<strong><?=gettext("Start IPsec in debug mode based on sections selected"); ?></strong>
|
240 |
71172088
|
jim-p
|
<br />
|
241 |
391453a1
|
Colin Fleming
|
<table summary="ipsec debug">
|
242 |
71172088
|
jim-p
|
<?php foreach ($ipsec_loglevels as $lkey => $ldescr): ?>
|
243 |
|
|
<tr>
|
244 |
|
|
<td width="22%" valign="top" class="vncell"><?=$ldescr;?></td>
|
245 |
|
|
<td width="78%" valign="top" class="vncell">
|
246 |
|
|
<?php echo "<select name=\"ipsec_{$lkey}\" id=\"ipsec_{$lkey}\">\n";
|
247 |
|
|
foreach (array("Silent", "Audit", "Control", "Diag", "Raw", "Highest") as $lidx => $lvalue) {
|
248 |
|
|
echo "<option value=\"{$lidx}\" ";
|
249 |
|
|
if ($pconfig["ipsec_{$lkey}"] == $lidx)
|
250 |
|
|
echo "selected=\"selected\"";
|
251 |
|
|
echo ">{$lvalue}</option>\n";
|
252 |
|
|
}
|
253 |
|
|
?>
|
254 |
|
|
</select>
|
255 |
|
|
</td>
|
256 |
|
|
</tr>
|
257 |
|
|
<?php endforeach; ?>
|
258 |
391453a1
|
Colin Fleming
|
<tr style="display:none;"><td></td></tr>
|
259 |
71172088
|
jim-p
|
</table>
|
260 |
3c4fc30b
|
Chris Buechler
|
<br /><?=gettext("Launches IPsec in debug mode so that more verbose logs " .
|
261 |
71172088
|
jim-p
|
"will be generated to aid in troubleshooting."); ?>
|
262 |
|
|
</td>
|
263 |
|
|
</tr>
|
264 |
|
|
<tr>
|
265 |
40cc36d1
|
Ermal LUÇI
|
<td width="22%" valign="top" class="vncell"><?=gettext("IP Compression"); ?></td>
|
266 |
71172088
|
jim-p
|
<td width="78%" class="vtable">
|
267 |
e57a3e40
|
Chris Buechler
|
<input name="compression" type="checkbox" id="compression" value="yes" <?php if ($pconfig['compression']) echo "checked=\"checked\""; ?> />
|
268 |
40cc36d1
|
Ermal LUÇI
|
<strong><?=gettext("Enable IPCompression"); ?></strong>
|
269 |
71172088
|
jim-p
|
<br />
|
270 |
3add5b2d
|
Chris Buechler
|
<?=gettext("IPComp compression of content is proposed on the connection."); ?>
|
271 |
71172088
|
jim-p
|
</td>
|
272 |
|
|
</tr>
|
273 |
737b18f2
|
Ermal
|
<tr>
|
274 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Unencrypted payloads in IKEv1 Main Mode"); ?></td>
|
275 |
|
|
<td width="78%" class="vtable">
|
276 |
|
|
<input name="acceptunencryptedmainmode" type="checkbox" id="acceptunencryptedmainmode" value="yes" <?php if ($pconfig['acceptunencryptedmainmode']) echo "checked=\"checked\""; ?> />
|
277 |
|
|
<strong><?=gettext("Accept unencrypted ID and HASH payloads in IKEv1 Main Mode"); ?></strong>
|
278 |
|
|
<br />
|
279 |
|
|
<?=gettext("Some implementations send the third Main Mode message unencrypted, probably to find the PSKs for the specified ID for authentication." .
|
280 |
|
|
"This is very similar to Aggressive Mode, and has the same security implications: " .
|
281 |
|
|
"A passive attacker can sniff the negotiated Identity, and start brute forcing the PSK using the HASH payload." .
|
282 |
|
|
" It is recommended to keep this option to no, unless you know exactly what the implications are and require compatibility to such devices (for example, some SonicWall boxes).");?>
|
283 |
|
|
</td>
|
284 |
|
|
</tr>
|
285 |
71172088
|
jim-p
|
<tr>
|
286 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Maximum MSS"); ?></td>
|
287 |
|
|
<td width="78%" class="vtable">
|
288 |
|
|
<input name="maxmss_enable" type="checkbox" id="maxmss_enable" value="yes" <?php if ($pconfig['maxmss_enable'] == true) echo "checked=\"checked\""; ?> onclick="maxmss_checked(this)" />
|
289 |
|
|
<strong><?=gettext("Enable MSS clamping on VPN traffic"); ?></strong>
|
290 |
|
|
<br />
|
291 |
247c417f
|
Sjon Hortensius
|
<input name="maxmss" id="maxmss" value="<?php if ($pconfig['maxmss'] <> "") echo $pconfig['maxmss']; else echo "1400"; ?>" class="formfld unknown" <?php if ($pconfig['maxmss_enable'] == false) echo "disabled=\"disabled\""; ?> />
|
292 |
71172088
|
jim-p
|
<br />
|
293 |
|
|
<?=gettext("Enable MSS clamping on TCP flows over VPN. " .
|
294 |
|
|
"This helps overcome problems with PMTUD on IPsec VPN links. If left blank, the default value is 1400 bytes. "); ?>
|
295 |
|
|
</td>
|
296 |
|
|
</tr>
|
297 |
4a076e36
|
Ermal LUÇI
|
<tr>
|
298 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Disable Cisco Extensions"); ?></td>
|
299 |
|
|
<td width="78%" class="vtable">
|
300 |
|
|
<input name="unityplugin" type="checkbox" id="unityplugin" value="yes" <?php if ($pconfig['unityplugin'] == true) echo "checked=\"checked\""; ?> />
|
301 |
|
|
<strong><?=gettext("Disable Unity Plugin"); ?></strong>
|
302 |
|
|
<br />
|
303 |
|
|
<?=gettext("Disable Unity Plugin which provides Cisco Extension support as Split-Include, Split-Exclude, Split-Dns, ..."); ?>
|
304 |
|
|
</td>
|
305 |
|
|
</tr>
|
306 |
71172088
|
jim-p
|
<tr>
|
307 |
|
|
<td width="22%" valign="top"> </td>
|
308 |
|
|
<td width="78%">
|
309 |
391453a1
|
Colin Fleming
|
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
|
310 |
71172088
|
jim-p
|
</td>
|
311 |
|
|
</tr>
|
312 |
|
|
</table>
|
313 |
|
|
</div>
|
314 |
|
|
</td>
|
315 |
|
|
</tr>
|
316 |
|
|
</table>
|
317 |
|
|
</form>
|
318 |
|
|
<?php include("fend.inc"); ?>
|
319 |
|
|
</body>
|
320 |
|
|
</html>
|