1 |
71172088
|
jim-p
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_ipsec_settings.php
|
4 |
|
|
|
5 |
|
|
Copyright (C) 2014 Electric Sheep Fencing, LLC
|
6 |
|
|
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['noinstalllanspd'] = $config['system']['noinstalllanspd'];
|
45 |
|
|
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
|
46 |
|
|
foreach ($ipsec_loglevels as $lkey => $ldescr) {
|
47 |
|
|
if (!empty($config['ipsec']["ipsec_{$lkey}"]))
|
48 |
|
|
$pconfig["ipsec_{$lkey}"] = $config['ipsec']["ipsec_{$lkey}"];
|
49 |
|
|
}
|
50 |
|
|
$pconfig['failoverforcereload'] = isset($config['ipsec']['failoverforcereload']);
|
51 |
|
|
$pconfig['maxmss_enable'] = isset($config['system']['maxmss_enable']);
|
52 |
|
|
$pconfig['maxmss'] = $config['system']['maxmss'];
|
53 |
|
|
|
54 |
6ae8b844
|
Ermal
|
if ($_POST) {
|
55 |
71172088
|
jim-p
|
|
56 |
|
|
unset($input_errors);
|
57 |
|
|
$pconfig = $_POST;
|
58 |
|
|
|
59 |
|
|
if (!$input_errors) {
|
60 |
|
|
|
61 |
|
|
if($_POST['noinstalllanspd'] == "yes") {
|
62 |
|
|
if (!isset($pconfig['noinstalllanspd']))
|
63 |
|
|
$config['system']['noinstalllanspd'] = true;
|
64 |
|
|
} else {
|
65 |
|
|
if (isset($config['system']['noinstalllanspd']))
|
66 |
|
|
unset($config['system']['noinstalllanspd']);
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
if($_POST['preferoldsa_enable'] == "yes")
|
70 |
|
|
$config['ipsec']['preferoldsa'] = true;
|
71 |
|
|
elseif (isset($config['ipsec']['preferoldsa']))
|
72 |
|
|
unset($config['ipsec']['preferoldsa']);
|
73 |
|
|
|
74 |
|
|
if (is_array($config['ipsec'])) {
|
75 |
|
|
foreach ($ipsec_loglevels as $lkey => $ldescr) {
|
76 |
|
|
if (empty($_POST["ipsec_{$lkey}"])) {
|
77 |
|
|
if (isset($config['ipsec']["ipsec_{$lkey}"]))
|
78 |
|
|
unset($config['ipsec']["ipsec_{$lkey}"]);
|
79 |
|
|
} else
|
80 |
|
|
$config['ipsec']["ipsec_{$lkey}"] = $_POST["ipsec_{$lkey}"];
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
if($_POST['failoverforcereload'] == "yes")
|
85 |
|
|
$config['ipsec']['failoverforcereload'] = true;
|
86 |
|
|
elseif (isset($config['ipsec']['failoverforcereload']))
|
87 |
|
|
unset($config['ipsec']['failoverforcereload']);
|
88 |
|
|
|
89 |
|
|
if($_POST['maxmss_enable'] == "yes") {
|
90 |
|
|
$config['system']['maxmss_enable'] = true;
|
91 |
|
|
$config['system']['maxmss'] = $_POST['maxmss'];
|
92 |
|
|
} else {
|
93 |
|
|
unset($config['system']['maxmss_enable']);
|
94 |
|
|
unset($config['system']['maxmss']);
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
write_config();
|
98 |
|
|
|
99 |
|
|
$retval = 0;
|
100 |
|
|
$retval = filter_configure();
|
101 |
|
|
if(stristr($retval, "error") <> true)
|
102 |
|
|
$savemsg = get_std_save_message(gettext($retval));
|
103 |
|
|
else
|
104 |
|
|
$savemsg = gettext($retval);
|
105 |
|
|
|
106 |
|
|
vpn_ipsec_configure_preferoldsa();
|
107 |
|
|
vpn_ipsec_configure();
|
108 |
|
|
vpn_ipsec_configure_loglevels();
|
109 |
|
|
|
110 |
|
|
// header("Location: vpn_ipsec_settings.php");
|
111 |
|
|
// return;
|
112 |
|
|
}
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
$pgtitle = array(gettext("VPN"),gettext("IPsec"),gettext("Settings"));
|
116 |
|
|
$shortcut_section = "ipsec";
|
117 |
|
|
|
118 |
|
|
include("head.inc");
|
119 |
|
|
?>
|
120 |
|
|
|
121 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
122 |
|
|
<?php include("fbegin.inc"); ?>
|
123 |
|
|
|
124 |
|
|
<script type="text/javascript">
|
125 |
391453a1
|
Colin Fleming
|
//<![CDATA[
|
126 |
71172088
|
jim-p
|
|
127 |
|
|
function maxmss_checked(obj) {
|
128 |
|
|
if (obj.checked)
|
129 |
|
|
jQuery('#maxmss').attr('disabled',false);
|
130 |
|
|
else
|
131 |
|
|
jQuery('#maxmss').attr('disabled','true');
|
132 |
|
|
}
|
133 |
|
|
|
134 |
391453a1
|
Colin Fleming
|
//]]>
|
135 |
71172088
|
jim-p
|
</script>
|
136 |
|
|
|
137 |
|
|
<form action="vpn_ipsec_settings.php" method="post" name="iform" id="iform">
|
138 |
|
|
|
139 |
|
|
<?php
|
140 |
|
|
if ($savemsg)
|
141 |
|
|
print_info_box($savemsg);
|
142 |
|
|
if ($input_errors)
|
143 |
|
|
print_input_errors($input_errors);
|
144 |
|
|
?>
|
145 |
|
|
|
146 |
391453a1
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn ipsec settings">
|
147 |
71172088
|
jim-p
|
<tr>
|
148 |
|
|
<td class="tabnavtbl">
|
149 |
|
|
<?php
|
150 |
|
|
$tab_array = array();
|
151 |
|
|
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
|
152 |
|
|
$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
|
153 |
|
|
$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
|
154 |
|
|
$tab_array[3] = array(gettext("Advanced Settings"), true, "vpn_ipsec_settings.php");
|
155 |
|
|
display_top_tabs($tab_array);
|
156 |
|
|
?>
|
157 |
|
|
</td>
|
158 |
|
|
</tr>
|
159 |
|
|
<tr>
|
160 |
|
|
<td id="mainarea">
|
161 |
|
|
<div class="tabcont">
|
162 |
391453a1
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
163 |
71172088
|
jim-p
|
<tr>
|
164 |
|
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("IPSec Advanced Settings"); ?></td>
|
165 |
|
|
</tr>
|
166 |
|
|
<tr>
|
167 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("LAN security associsations"); ?></td>
|
168 |
|
|
<td width="78%" class="vtable">
|
169 |
|
|
<input name="noinstalllanspd" type="checkbox" id="noinstalllanspd" value="yes" <?php if ($pconfig['noinstalllanspd']) echo "checked=\"checked\""; ?> />
|
170 |
|
|
<strong><?=gettext("Do not install LAN SPD"); ?></strong>
|
171 |
|
|
<br />
|
172 |
|
|
<?=gettext("By default, if IPSec is enabled negating SPD are inserted to provide protection. " .
|
173 |
|
|
"This behaviour can be changed by enabling this setting which will prevent installing these SPDs."); ?>
|
174 |
|
|
</td>
|
175 |
|
|
</tr>
|
176 |
|
|
<tr>
|
177 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Security Associations"); ?></td>
|
178 |
|
|
<td width="78%" class="vtable">
|
179 |
|
|
<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked=\"checked\""; ?> />
|
180 |
|
|
<strong><?=gettext("Prefer older IPsec SAs"); ?></strong>
|
181 |
|
|
<br />
|
182 |
|
|
<?=gettext("By default, if several SAs match, the newest one is " .
|
183 |
|
|
"preferred if it's at least 30 seconds old. Select this " .
|
184 |
|
|
"option to always prefer old SAs over new ones."); ?>
|
185 |
|
|
</td>
|
186 |
|
|
</tr>
|
187 |
|
|
<tr>
|
188 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPsec Debug"); ?></td>
|
189 |
|
|
<td width="78%" class="vtable">
|
190 |
|
|
<strong><?=gettext("Start IPSec in debug mode based on sections selected"); ?></strong>
|
191 |
|
|
<br />
|
192 |
391453a1
|
Colin Fleming
|
<table summary="ipsec debug">
|
193 |
71172088
|
jim-p
|
<?php foreach ($ipsec_loglevels as $lkey => $ldescr): ?>
|
194 |
|
|
<tr>
|
195 |
|
|
<td width="22%" valign="top" class="vncell"><?=$ldescr;?></td>
|
196 |
|
|
<td width="78%" valign="top" class="vncell">
|
197 |
|
|
<?php echo "<select name=\"ipsec_{$lkey}\" id=\"ipsec_{$lkey}\">\n";
|
198 |
|
|
foreach (array("Silent", "Audit", "Control", "Diag", "Raw", "Highest") as $lidx => $lvalue) {
|
199 |
|
|
echo "<option value=\"{$lidx}\" ";
|
200 |
|
|
if ($pconfig["ipsec_{$lkey}"] == $lidx)
|
201 |
|
|
echo "selected=\"selected\"";
|
202 |
|
|
echo ">{$lvalue}</option>\n";
|
203 |
|
|
}
|
204 |
|
|
?>
|
205 |
|
|
</select>
|
206 |
|
|
</td>
|
207 |
|
|
</tr>
|
208 |
|
|
<?php endforeach; ?>
|
209 |
391453a1
|
Colin Fleming
|
<tr style="display:none;"><td></td></tr>
|
210 |
71172088
|
jim-p
|
</table>
|
211 |
|
|
<br /><?=gettext("Launches IPSec in debug mode so that more verbose logs " .
|
212 |
|
|
"will be generated to aid in troubleshooting."); ?>
|
213 |
|
|
</td>
|
214 |
|
|
</tr>
|
215 |
|
|
<tr>
|
216 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPsec Reload on Failover"); ?></td>
|
217 |
|
|
<td width="78%" class="vtable">
|
218 |
|
|
<input name="failoverforcereload" type="checkbox" id="failoverforcereload" value="yes" <?php if ($pconfig['failoverforcereload']) echo "checked=\"checked\""; ?> />
|
219 |
|
|
<strong><?=gettext("Force IPsec Reload on Failover"); ?></strong>
|
220 |
|
|
<br />
|
221 |
|
|
<?=gettext("In some circumstances using a gateway group as the interface for " .
|
222 |
|
|
"an IPsec tunnel does not function properly, and IPsec must be forcefully reloaded " .
|
223 |
|
|
"when a failover occurs. Because this will disrupt all IPsec tunnels, this behavior" .
|
224 |
|
|
" is disabled by default. Check this box to force IPsec to fully reload on failover."); ?>
|
225 |
|
|
</td>
|
226 |
|
|
</tr>
|
227 |
|
|
<tr>
|
228 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Maximum MSS"); ?></td>
|
229 |
|
|
<td width="78%" class="vtable">
|
230 |
|
|
<input name="maxmss_enable" type="checkbox" id="maxmss_enable" value="yes" <?php if ($pconfig['maxmss_enable'] == true) echo "checked=\"checked\""; ?> onclick="maxmss_checked(this)" />
|
231 |
|
|
<strong><?=gettext("Enable MSS clamping on VPN traffic"); ?></strong>
|
232 |
|
|
<br />
|
233 |
|
|
<input name="maxmss" id="maxmss" value="<?php if ($pconfig['maxmss'] <> "") echo $pconfig['maxmss']; else "1400"; ?>" class="formfld unknown" <?php if ($pconfig['maxmss_enable'] == false) echo "disabled=\"disabled\""; ?> />
|
234 |
|
|
<br />
|
235 |
|
|
<?=gettext("Enable MSS clamping on TCP flows over VPN. " .
|
236 |
|
|
"This helps overcome problems with PMTUD on IPsec VPN links. If left blank, the default value is 1400 bytes. "); ?>
|
237 |
|
|
</td>
|
238 |
|
|
</tr>
|
239 |
|
|
<tr>
|
240 |
|
|
<td width="22%" valign="top"> </td>
|
241 |
|
|
<td width="78%">
|
242 |
391453a1
|
Colin Fleming
|
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
|
243 |
71172088
|
jim-p
|
</td>
|
244 |
|
|
</tr>
|
245 |
|
|
</table>
|
246 |
|
|
</div>
|
247 |
|
|
</td>
|
248 |
|
|
</tr>
|
249 |
|
|
</table>
|
250 |
|
|
</form>
|
251 |
|
|
<?php include("fend.inc"); ?>
|
252 |
|
|
</body>
|
253 |
|
|
</html>
|