1 |
5656fe23
|
Ermal Lu?i
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
vpn_l2tp.php
|
4 |
|
|
*/
|
5 |
b9043cdc
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
|
|
*
|
8 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
9 |
|
|
* 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
|
16 |
|
|
* the documentation and/or other materials provided with the
|
17 |
|
|
* distribution.
|
18 |
|
|
*
|
19 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
20 |
|
|
* must display the following acknowledgment:
|
21 |
|
|
* "This product includes software developed by the pfSense Project
|
22 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
23 |
|
|
*
|
24 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
25 |
|
|
* endorse or promote products derived from this software without
|
26 |
|
|
* prior written permission. For written permission, please contact
|
27 |
|
|
* coreteam@pfsense.org.
|
28 |
|
|
*
|
29 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
30 |
|
|
* nor may "pfSense" appear in their names without prior written
|
31 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
32 |
|
|
*
|
33 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
34 |
|
|
* acknowledgment:
|
35 |
|
|
*
|
36 |
|
|
* "This product includes software developed by the pfSense Project
|
37 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
38 |
|
|
*
|
39 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
40 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
41 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
43 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
44 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
45 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
46 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
48 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
49 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
50 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
51 |
|
|
*
|
52 |
|
|
* ====================================================================
|
53 |
|
|
*
|
54 |
|
|
*/
|
55 |
5656fe23
|
Ermal Lu?i
|
|
56 |
047cb829
|
Ermal Lu?i
|
##|+PRIV
|
57 |
|
|
##|*IDENT=page-vpn-vpnl2tp
|
58 |
|
|
##|*NAME=VPN: VPN L2TP page
|
59 |
|
|
##|*DESCR=Allow access to the 'VPN: VPN L2TP' page.
|
60 |
|
|
##|*MATCH=vpn_l2tp.php*
|
61 |
|
|
##|-PRIV
|
62 |
|
|
|
63 |
5656fe23
|
Ermal Lu?i
|
$pgtitle = array(gettext("VPN"), gettext("L2TP"), gettext("L2TP"));
|
64 |
b32dd0a6
|
jim-p
|
$shortcut_section = "l2tps";
|
65 |
5656fe23
|
Ermal Lu?i
|
|
66 |
|
|
require("guiconfig.inc");
|
67 |
483e6de8
|
Scott Ullrich
|
require_once("vpn.inc");
|
68 |
5656fe23
|
Ermal Lu?i
|
|
69 |
|
|
if (!is_array($config['l2tp']['radius'])) {
|
70 |
|
|
$config['l2tp']['radius'] = array();
|
71 |
|
|
}
|
72 |
|
|
$l2tpcfg = &$config['l2tp'];
|
73 |
|
|
|
74 |
|
|
$pconfig['remoteip'] = $l2tpcfg['remoteip'];
|
75 |
|
|
$pconfig['localip'] = $l2tpcfg['localip'];
|
76 |
a56120f2
|
Ermal Lu?i
|
$pconfig['l2tp_subnet'] = $l2tpcfg['l2tp_subnet'];
|
77 |
5656fe23
|
Ermal Lu?i
|
$pconfig['mode'] = $l2tpcfg['mode'];
|
78 |
|
|
$pconfig['interface'] = $l2tpcfg['interface'];
|
79 |
c8cc0c1c
|
smos
|
$pconfig['l2tp_dns1'] = $l2tpcfg['dns1'];
|
80 |
|
|
$pconfig['l2tp_dns2'] = $l2tpcfg['dns2'];
|
81 |
|
|
$pconfig['wins'] = $l2tpcfg['wins'];
|
82 |
5656fe23
|
Ermal Lu?i
|
$pconfig['radiusenable'] = isset($l2tpcfg['radius']['enable']);
|
83 |
|
|
$pconfig['radacct_enable'] = isset($l2tpcfg['radius']['accounting']);
|
84 |
|
|
$pconfig['radiusserver'] = $l2tpcfg['radius']['server'];
|
85 |
|
|
$pconfig['radiussecret'] = $l2tpcfg['radius']['secret'];
|
86 |
|
|
$pconfig['radiusissueips'] = $l2tpcfg['radius']['radiusissueips'];
|
87 |
|
|
$pconfig['n_l2tp_units'] = $l2tpcfg['n_l2tp_units'];
|
88 |
|
|
$pconfig['paporchap'] = $l2tpcfg['paporchap'];
|
89 |
40de0b13
|
Ermal Lu?i
|
$pconfig['secret'] = $l2tpcfg['secret'];
|
90 |
5656fe23
|
Ermal Lu?i
|
|
91 |
|
|
if ($_POST) {
|
92 |
|
|
|
93 |
|
|
unset($input_errors);
|
94 |
|
|
$pconfig = $_POST;
|
95 |
|
|
|
96 |
|
|
/* input validation */
|
97 |
|
|
if ($_POST['mode'] == "server") {
|
98 |
|
|
$reqdfields = explode(" ", "localip remoteip");
|
99 |
6c07db48
|
Phil Davis
|
$reqdfieldsn = array(gettext("Server address"), gettext("Remote start address"));
|
100 |
5656fe23
|
Ermal Lu?i
|
|
101 |
|
|
if ($_POST['radiusenable']) {
|
102 |
|
|
$reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
|
103 |
|
|
$reqdfieldsn = array_merge($reqdfieldsn,
|
104 |
a3e00d53
|
Phil Davis
|
array(gettext("RADIUS server address"), gettext("RADIUS shared secret")));
|
105 |
5656fe23
|
Ermal Lu?i
|
}
|
106 |
|
|
|
107 |
1e9b4611
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
108 |
5656fe23
|
Ermal Lu?i
|
|
109 |
|
|
if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) {
|
110 |
|
|
$input_errors[] = gettext("A valid server address must be specified.");
|
111 |
|
|
}
|
112 |
0a0b17d9
|
Renato Botelho
|
if (is_ipaddr_configured($_POST['localip'])) {
|
113 |
|
|
$input_errors[] = gettext("'Server address' parameter should NOT be set to any IP address currently in use on this firewall.");
|
114 |
|
|
}
|
115 |
a56120f2
|
Ermal Lu?i
|
if (($_POST['l2tp_subnet'] && !is_ipaddr($_POST['remoteip']))) {
|
116 |
5656fe23
|
Ermal Lu?i
|
$input_errors[] = gettext("A valid remote start address must be specified.");
|
117 |
|
|
}
|
118 |
|
|
if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver']))) {
|
119 |
|
|
$input_errors[] = gettext("A valid RADIUS server address must be specified.");
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
/* if this is an AJAX caller then handle via JSON */
|
123 |
a3e00d53
|
Phil Davis
|
if (isAjax() && is_array($input_errors)) {
|
124 |
5656fe23
|
Ermal Lu?i
|
input_errors2Ajax($input_errors);
|
125 |
|
|
exit;
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
if (!$input_errors) {
|
129 |
a56120f2
|
Ermal Lu?i
|
$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['l2tp_subnet']);
|
130 |
96033063
|
Erik Fonnesbeck
|
$subnet_start = ip2ulong($_POST['remoteip']);
|
131 |
|
|
$subnet_end = ip2ulong($_POST['remoteip']) + $_POST['n_l2tp_units'] - 1;
|
132 |
5656fe23
|
Ermal Lu?i
|
|
133 |
96033063
|
Erik Fonnesbeck
|
if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
|
134 |
61144c9b
|
Sander van Leeuwen
|
(ip2ulong($_POST['localip']) <= $subnet_end)) {
|
135 |
5656fe23
|
Ermal Lu?i
|
$input_errors[] = gettext("The specified server address lies in the remote subnet.");
|
136 |
|
|
}
|
137 |
a55e9c70
|
Ermal Lu?i
|
if ($_POST['localip'] == get_interface_ip("lan")) {
|
138 |
5656fe23
|
Ermal Lu?i
|
$input_errors[] = gettext("The specified server address is equal to the LAN interface address.");
|
139 |
|
|
}
|
140 |
|
|
}
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
/* if this is an AJAX caller then handle via JSON */
|
144 |
a3e00d53
|
Phil Davis
|
if (isAjax() && is_array($input_errors)) {
|
145 |
5656fe23
|
Ermal Lu?i
|
input_errors2Ajax($input_errors);
|
146 |
|
|
exit;
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
if (!$input_errors) {
|
150 |
|
|
$l2tpcfg['remoteip'] = $_POST['remoteip'];
|
151 |
|
|
$l2tpcfg['localip'] = $_POST['localip'];
|
152 |
a56120f2
|
Ermal Lu?i
|
$l2tpcfg['l2tp_subnet'] = $_POST['l2tp_subnet'];
|
153 |
5656fe23
|
Ermal Lu?i
|
$l2tpcfg['mode'] = $_POST['mode'];
|
154 |
|
|
$l2tpcfg['interface'] = $_POST['interface'];
|
155 |
|
|
$l2tpcfg['n_l2tp_units'] = $_POST['n_l2tp_units'];
|
156 |
|
|
|
157 |
|
|
$l2tpcfg['radius']['server'] = $_POST['radiusserver'];
|
158 |
|
|
$l2tpcfg['radius']['secret'] = $_POST['radiussecret'];
|
159 |
40de0b13
|
Ermal Lu?i
|
$l2tpcfg['secret'] = $_POST['secret'];
|
160 |
5656fe23
|
Ermal Lu?i
|
|
161 |
a3e00d53
|
Phil Davis
|
if ($_POST['wins']) {
|
162 |
c8cc0c1c
|
smos
|
$l2tpcfg['wins'] = $_POST['wins'];
|
163 |
a3e00d53
|
Phil Davis
|
} else {
|
164 |
c8cc0c1c
|
smos
|
unset($l2tpcfg['wins']);
|
165 |
a3e00d53
|
Phil Davis
|
}
|
166 |
c8cc0c1c
|
smos
|
|
167 |
5656fe23
|
Ermal Lu?i
|
$l2tpcfg['paporchap'] = $_POST['paporchap'];
|
168 |
|
|
|
169 |
c8cc0c1c
|
smos
|
|
170 |
|
|
if ($_POST['l2tp_dns1'] == "") {
|
171 |
6c07db48
|
Phil Davis
|
if (isset($l2tpcfg['dns1'])) {
|
172 |
c8cc0c1c
|
smos
|
unset($l2tpcfg['dns1']);
|
173 |
a3e00d53
|
Phil Davis
|
}
|
174 |
6c07db48
|
Phil Davis
|
} else {
|
175 |
|
|
$l2tpcfg['dns1'] = $_POST['l2tp_dns1'];
|
176 |
|
|
}
|
177 |
c8cc0c1c
|
smos
|
|
178 |
6c07db48
|
Phil Davis
|
if ($_POST['l2tp_dns2'] == "") {
|
179 |
|
|
if (isset($l2tpcfg['dns2'])) {
|
180 |
|
|
unset($l2tpcfg['dns2']);
|
181 |
a3e00d53
|
Phil Davis
|
}
|
182 |
6c07db48
|
Phil Davis
|
} else {
|
183 |
|
|
$l2tpcfg['dns2'] = $_POST['l2tp_dns2'];
|
184 |
|
|
}
|
185 |
c8cc0c1c
|
smos
|
|
186 |
a3e00d53
|
Phil Davis
|
if ($_POST['radiusenable'] == "yes") {
|
187 |
5656fe23
|
Ermal Lu?i
|
$l2tpcfg['radius']['enable'] = true;
|
188 |
a3e00d53
|
Phil Davis
|
} else {
|
189 |
5656fe23
|
Ermal Lu?i
|
unset($l2tpcfg['radius']['enable']);
|
190 |
a3e00d53
|
Phil Davis
|
}
|
191 |
5656fe23
|
Ermal Lu?i
|
|
192 |
a3e00d53
|
Phil Davis
|
if ($_POST['radacct_enable'] == "yes") {
|
193 |
5656fe23
|
Ermal Lu?i
|
$l2tpcfg['radius']['accounting'] = true;
|
194 |
a3e00d53
|
Phil Davis
|
} else {
|
195 |
5656fe23
|
Ermal Lu?i
|
unset($l2tpcfg['radius']['accounting']);
|
196 |
a3e00d53
|
Phil Davis
|
}
|
197 |
5656fe23
|
Ermal Lu?i
|
|
198 |
a3e00d53
|
Phil Davis
|
if ($_POST['radiusissueips'] == "yes") {
|
199 |
5656fe23
|
Ermal Lu?i
|
$l2tpcfg['radius']['radiusissueips'] = true;
|
200 |
a3e00d53
|
Phil Davis
|
} else {
|
201 |
5656fe23
|
Ermal Lu?i
|
unset($l2tpcfg['radius']['radiusissueips']);
|
202 |
a3e00d53
|
Phil Davis
|
}
|
203 |
5656fe23
|
Ermal Lu?i
|
|
204 |
|
|
write_config();
|
205 |
|
|
|
206 |
|
|
$retval = 0;
|
207 |
|
|
$retval = vpn_l2tp_configure();
|
208 |
|
|
$savemsg = get_std_save_message($retval);
|
209 |
|
|
|
210 |
|
|
/* if ajax is calling, give them an update message */
|
211 |
a3e00d53
|
Phil Davis
|
if (isAjax()) {
|
212 |
5656fe23
|
Ermal Lu?i
|
print_info_box_np($savemsg);
|
213 |
a3e00d53
|
Phil Davis
|
}
|
214 |
5656fe23
|
Ermal Lu?i
|
}
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
include("head.inc");
|
218 |
|
|
?>
|
219 |
|
|
|
220 |
|
|
<script type="text/javascript">
|
221 |
d28502be
|
Colin Fleming
|
//<![CDATA[
|
222 |
6c07db48
|
Phil Davis
|
function get_radio_value(obj) {
|
223 |
5656fe23
|
Ermal Lu?i
|
for (i = 0; i < obj.length; i++) {
|
224 |
a3e00d53
|
Phil Davis
|
if (obj[i].checked) {
|
225 |
5656fe23
|
Ermal Lu?i
|
return obj[i].value;
|
226 |
a3e00d53
|
Phil Davis
|
}
|
227 |
5656fe23
|
Ermal Lu?i
|
}
|
228 |
|
|
return null;
|
229 |
|
|
}
|
230 |
|
|
|
231 |
|
|
function enable_change(enable_over) {
|
232 |
|
|
if ((get_radio_value(document.iform.mode) == "server") || enable_over) {
|
233 |
|
|
document.iform.remoteip.disabled = 0;
|
234 |
|
|
document.iform.localip.disabled = 0;
|
235 |
a56120f2
|
Ermal Lu?i
|
document.iform.l2tp_subnet.disabled = 0;
|
236 |
5656fe23
|
Ermal Lu?i
|
document.iform.radiusenable.disabled = 0;
|
237 |
|
|
document.iform.radiusissueips.disabled = 0;
|
238 |
|
|
document.iform.paporchap.disabled = 0;
|
239 |
|
|
document.iform.interface.disabled = 0;
|
240 |
|
|
document.iform.n_l2tp_units.disabled = 0;
|
241 |
40de0b13
|
Ermal Lu?i
|
document.iform.secret.disabled = 0;
|
242 |
c8cc0c1c
|
smos
|
document.iform.l2tp_dns1.disabled = 0;
|
243 |
|
|
document.iform.l2tp_dns2.disabled = 0;
|
244 |
a3e00d53
|
Phil Davis
|
/* fix colors */
|
245 |
5656fe23
|
Ermal Lu?i
|
document.iform.remoteip.style.backgroundColor = '#FFFFFF';
|
246 |
|
|
document.iform.localip.style.backgroundColor = '#FFFFFF';
|
247 |
a56120f2
|
Ermal Lu?i
|
document.iform.l2tp_subnet.style.backgroundColor = '#FFFFFF';
|
248 |
5656fe23
|
Ermal Lu?i
|
document.iform.radiusenable.style.backgroundColor = '#FFFFFF';
|
249 |
|
|
document.iform.radiusissueips.style.backgroundColor = '#FFFFFF';
|
250 |
|
|
document.iform.paporchap.style.backgroundColor = '#FFFFFF';
|
251 |
|
|
document.iform.interface.style.backgroundColor = '#FFFFFF';
|
252 |
|
|
document.iform.n_l2tp_units.style.backgroundColor = '#FFFFFF';
|
253 |
40de0b13
|
Ermal Lu?i
|
document.iform.secret.style.backgroundColor = '#FFFFFF';
|
254 |
5656fe23
|
Ermal Lu?i
|
if (document.iform.radiusenable.checked || enable_over) {
|
255 |
|
|
document.iform.radacct_enable.disabled = 0;
|
256 |
|
|
document.iform.radiusserver.disabled = 0;
|
257 |
|
|
document.iform.radiussecret.disabled = 0;
|
258 |
|
|
document.iform.radiusissueips.disabled = 0;
|
259 |
a3e00d53
|
Phil Davis
|
/* fix colors */
|
260 |
5656fe23
|
Ermal Lu?i
|
document.iform.radacct_enable.style.backgroundColor = '#FFFFFF';
|
261 |
|
|
document.iform.radiusserver.style.backgroundColor = '#FFFFFF';
|
262 |
|
|
document.iform.radiussecret.style.backgroundColor = '#FFFFFF';
|
263 |
|
|
document.iform.radiusissueips.style.backgroundColor = '#FFFFFF';
|
264 |
|
|
} else {
|
265 |
|
|
document.iform.radacct_enable.disabled = 1;
|
266 |
|
|
document.iform.radiusserver.disabled = 1;
|
267 |
|
|
document.iform.radiussecret.disabled = 1;
|
268 |
|
|
document.iform.radiusissueips.disabled = 1;
|
269 |
a3e00d53
|
Phil Davis
|
/* fix colors */
|
270 |
5656fe23
|
Ermal Lu?i
|
document.iform.radacct_enable.style.backgroundColor = '#D4D0C8';
|
271 |
|
|
document.iform.radiusserver.style.backgroundColor = '#D4D0C8';
|
272 |
|
|
document.iform.radiussecret.style.backgroundColor = '#D4D0C8';
|
273 |
|
|
document.iform.radiusissueips.style.backgroundColor = '#D4D0C8';
|
274 |
|
|
}
|
275 |
|
|
} else {
|
276 |
|
|
document.iform.interface.disabled = 1;
|
277 |
|
|
document.iform.n_l2tp_units.disabled = 1;
|
278 |
a56120f2
|
Ermal Lu?i
|
document.iform.l2tp_subnet.disabled = 1;
|
279 |
c8cc0c1c
|
smos
|
document.iform.l2tp_dns1.disabled = 1;
|
280 |
|
|
document.iform.l2tp_dns2.disabled = 1;
|
281 |
5656fe23
|
Ermal Lu?i
|
document.iform.paporchap.disabled = 1;
|
282 |
|
|
document.iform.remoteip.disabled = 1;
|
283 |
|
|
document.iform.localip.disabled = 1;
|
284 |
|
|
document.iform.radiusenable.disabled = 1;
|
285 |
|
|
document.iform.radacct_enable.disabled = 1;
|
286 |
|
|
document.iform.radiusserver.disabled = 1;
|
287 |
|
|
document.iform.radiussecret.disabled = 1;
|
288 |
|
|
document.iform.radiusissueips.disabled = 1;
|
289 |
40de0b13
|
Ermal Lu?i
|
document.iform.secret.disabled = 1;
|
290 |
a3e00d53
|
Phil Davis
|
/* fix colors */
|
291 |
5656fe23
|
Ermal Lu?i
|
document.iform.interface.style.backgroundColor = '#D4D0C8';
|
292 |
|
|
document.iform.n_l2tp_units.style.backgroundColor = '#D4D0C8';
|
293 |
a56120f2
|
Ermal Lu?i
|
document.iform.l2tp_subnet.style.backgroundColor = '#D4D0C8';
|
294 |
5656fe23
|
Ermal Lu?i
|
document.iform.paporchap.style.backgroundColor = '#D4D0C8';
|
295 |
|
|
document.iform.remoteip.style.backgroundColor = '#D4D0C8';
|
296 |
|
|
document.iform.localip.style.backgroundColor = '#D4D0C8';
|
297 |
|
|
document.iform.radiusenable.style.backgroundColor = '#D4D0C8';
|
298 |
|
|
document.iform.radacct_enable.style.backgroundColor = '#D4D0C8';
|
299 |
|
|
document.iform.radiusserver.style.backgroundColor = '#D4D0C8';
|
300 |
|
|
document.iform.radiussecret.style.backgroundColor = '#D4D0C8';
|
301 |
|
|
document.iform.radiusissueips.style.backgroundColor = '#D4D0C8';
|
302 |
40de0b13
|
Ermal Lu?i
|
document.iform.secret.style.backgroundColor = '#D4D0C8';
|
303 |
5656fe23
|
Ermal Lu?i
|
}
|
304 |
|
|
}
|
305 |
d28502be
|
Colin Fleming
|
//]]>
|
306 |
5656fe23
|
Ermal Lu?i
|
</script>
|
307 |
61144c9b
|
Sander van Leeuwen
|
|
308 |
|
|
<form class="form-horizontal" action="vpn_l2tp.php" method="post" name="iform" id="iform">
|
309 |
|
|
<?php if ($input_errors) print_input_errors($input_errors)?>
|
310 |
|
|
<?php if ($savemsg) print_info_box($savemsg)?>
|
311 |
|
|
|
312 |
|
|
<?php
|
313 |
|
|
$tab_array = array();
|
314 |
|
|
$tab_array[0] = array(gettext("Configuration"), true, "vpn_l2tp.php");
|
315 |
|
|
$tab_array[1] = array(gettext("Users"), false, "vpn_l2tp_users.php");
|
316 |
748cbea6
|
Sander van Leeuwen
|
display_top_tabs($tab_array);
|
317 |
61144c9b
|
Sander van Leeuwen
|
?>
|
318 |
|
|
|
319 |
|
|
<div class="panel panel-default">
|
320 |
|
|
<div class="panel-heading">
|
321 |
|
|
<h2 class="panel-title"><?=gettext('Enable L2TP'); ?></h2>
|
322 |
|
|
</div>
|
323 |
|
|
|
324 |
|
|
<div class="panel-body">
|
325 |
|
|
<div class="form-group">
|
326 |
|
|
<div class="col-sm-10">
|
327 |
|
|
<label>
|
328 |
|
|
<input name="mode" type="radio" onclick="enable_change(false)" value="off" <?php if (($pconfig['mode'] != "server") && ($pconfig['mode'] != "redir")) echo "checked=\"checked\""?> />
|
329 |
|
|
<?=gettext("Off")?>
|
330 |
|
|
</label>
|
331 |
|
|
<label>
|
332 |
|
|
<input type="radio" name="mode" value="server" onclick="enable_change(false)" <?php if ($pconfig['mode'] == "server") echo "checked=\"checked\""?> />
|
333 |
|
|
<?=gettext("Enable L2TP server")?>
|
334 |
|
|
</label>
|
335 |
|
|
</div>
|
336 |
|
|
</div>
|
337 |
|
|
</div>
|
338 |
|
|
</div>
|
339 |
|
|
|
340 |
|
|
<div class="panel panel-default">
|
341 |
|
|
<div class="panel-heading">
|
342 |
|
|
<h2 class="panel-title"><?=gettext('Configuration'); ?></h2>
|
343 |
|
|
</div>
|
344 |
|
|
|
345 |
|
|
<div class="panel-body">
|
346 |
|
|
<div class="form-group">
|
347 |
|
|
<label for="interface" class="col-sm-2 control-label"><?=gettext("Interface")?></label>
|
348 |
|
|
<div class="col-sm-2">
|
349 |
|
|
<select class="form-control" name="interface" class="formselect" id="interface">
|
350 |
|
|
<?php
|
351 |
|
|
$interfaces = get_configured_interface_with_descr();
|
352 |
|
|
foreach ($interfaces as $iface => $ifacename): ?>
|
353 |
|
|
<option value="<?=$iface?>" <?php if ($iface == $pconfig['interface']) echo "selected=\"selected\""?>>
|
354 |
|
|
<?=htmlspecialchars($ifacename)?>
|
355 |
|
|
</option>
|
356 |
|
|
<?php endforeach?>
|
357 |
|
|
</select>
|
358 |
|
|
</div>
|
359 |
|
|
</div>
|
360 |
|
|
<div class="form-group">
|
361 |
|
|
<label for="localip" class="col-sm-2 control-label"><?=gettext("Server Address")?></label>
|
362 |
|
|
<div class="col-sm-10">
|
363 |
|
|
<?=$mandfldhtml?><input name="localip" type="text" class="form-control formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip'])?>" />
|
364 |
|
|
|
365 |
|
|
<span class="help-block">
|
366 |
|
|
<?=gettext("Enter the IP address the L2TP server should give to clients for use as their \"gateway\"")?>.
|
367 |
|
|
<br />
|
368 |
|
|
<?=gettext("Typically this is set to an unused IP just outside of the client range")?>.
|
369 |
|
|
<br />
|
370 |
|
|
<br />
|
371 |
|
|
<?=gettext("NOTE: This should NOT be set to any IP address currently in use on this firewall")?>.
|
372 |
|
|
</span>
|
373 |
|
|
</div>
|
374 |
|
|
</div>
|
375 |
|
|
|
376 |
|
|
<div class="form-group">
|
377 |
|
|
<label for="remoteip" class="col-sm-2 control-label"><?=gettext("Remote Address Range")?></label>
|
378 |
|
|
<div class="col-sm-10">
|
379 |
|
|
<?=$mandfldhtml?><input name="remoteip" type="text" class="form-control formfld unknown" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip'])?>" />
|
380 |
|
|
<span class="help-block">
|
381 |
|
|
<?=gettext("Specify the starting address for the client IP address subnet.")?>
|
382 |
|
|
</span>
|
383 |
|
|
</div>
|
384 |
|
|
</div>
|
385 |
|
|
|
386 |
|
|
<div class="form-group">
|
387 |
|
|
<label for="l2tp_subnet" class="col-sm-2 control-label"><?=gettext("Subnet Mask")?></label>
|
388 |
|
|
<div class="col-sm-2">
|
389 |
|
|
<select id="l2tp_subnet" name="l2tp_subnet" class="form-control">
|
390 |
|
|
<?php
|
391 |
3fac0afc
|
Jose Luis Duran
|
for($x=0; $x<33; $x++) {
|
392 |
61144c9b
|
Sander van Leeuwen
|
if($x == $pconfig['l2tp_subnet'])
|
393 |
|
|
$SELECTED = " selected=\"selected\"";
|
394 |
|
|
else
|
395 |
|
|
$SELECTED = "";
|
396 |
|
|
echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";
|
397 |
3fac0afc
|
Jose Luis Duran
|
}
|
398 |
61144c9b
|
Sander van Leeuwen
|
?>
|
399 |
|
|
</select>
|
400 |
|
|
<span class="help-block">
|
401 |
|
|
<?=gettext("Hint:")?> 24 <?=gettext("is")?> 255.255.255.0
|
402 |
|
|
</span>
|
403 |
|
|
</div>
|
404 |
|
|
</div>
|
405 |
|
|
|
406 |
|
|
<div class="form-group">
|
407 |
|
|
<label for="n_l2tp_units" class="col-sm-2 control-label"><?=gettext("Number of L2TP users")?></label>
|
408 |
|
|
<div class="col-sm-2">
|
409 |
|
|
<select id="n_l2tp_units" name="n_l2tp_units" class="form-control">
|
410 |
5656fe23
|
Ermal Lu?i
|
<?php
|
411 |
3fac0afc
|
Jose Luis Duran
|
for($x=0; $x<255; $x++) {
|
412 |
61144c9b
|
Sander van Leeuwen
|
if($x == $pconfig['n_l2tp_units'])
|
413 |
|
|
$SELECTED = " selected=\"selected\"";
|
414 |
|
|
else
|
415 |
|
|
$SELECTED = "";
|
416 |
|
|
echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";
|
417 |
3fac0afc
|
Jose Luis Duran
|
}
|
418 |
5656fe23
|
Ermal Lu?i
|
?>
|
419 |
61144c9b
|
Sander van Leeuwen
|
</select>
|
420 |
|
|
<span class="help-block">
|
421 |
|
|
<?=gettext("Hint:")?> 10 <?=gettext("is ten L2TP clients")?>
|
422 |
|
|
</span>
|
423 |
|
|
</div>
|
424 |
|
|
</div>
|
425 |
|
|
|
426 |
|
|
<div class="form-group">
|
427 |
|
|
<label for="secret" class="col-sm-2 control-label"><?=gettext("Secret")?></label>
|
428 |
|
|
<div class="col-sm-10">
|
429 |
|
|
<input type="password" name="secret" id="secret" class="formfld pwd form-control" value="<?=htmlspecialchars($pconfig['secret'])?>" />
|
430 |
|
|
<span class="help-block">
|
431 |
|
|
<?=gettext("Specify optional secret shared between peers. Required on some devices/setups.")?>
|
432 |
|
|
</span>
|
433 |
|
|
</div>
|
434 |
|
|
</div>
|
435 |
|
|
|
436 |
|
|
<div class="form-group">
|
437 |
|
|
<label for="paporchap" class="col-sm-2 control-label"><?=gettext("Authentication Type")?></label>
|
438 |
|
|
<div class="col-sm-2">
|
439 |
|
|
<?=$mandfldhtml?><select name="paporchap" id="paporchap" class="form-control">
|
440 |
|
|
<option value='chap'<?php if($pconfig['paporchap'] == "chap") echo " selected=\"selected\""?>><?=gettext("CHAP")?></option>
|
441 |
3fac0afc
|
Jose Luis Duran
|
<option value='chap-msv2'<?php if ($pconfig['paporchap'] == "chap-msv2") echo " selected=\"selected\""?>><?=gettext("MS-CHAPv2")?></option>
|
442 |
61144c9b
|
Sander van Leeuwen
|
<option value='pap'<?php if($pconfig['paporchap'] == "pap") echo " selected=\"selected\""?>><?=gettext("PAP")?></option>
|
443 |
|
|
</select>
|
444 |
|
|
<span class="help-block">
|
445 |
|
|
<?=gettext("Specifies which protocol to use for authentication.")?>
|
446 |
|
|
</span>
|
447 |
|
|
</div>
|
448 |
|
|
</div>
|
449 |
|
|
|
450 |
|
|
<div class="form-group">
|
451 |
|
|
<label for="l2tp_dns1" class="col-sm-2 control-label"><?=gettext("L2TP DNS Servers")?></label>
|
452 |
|
|
<div class="col-sm-10">
|
453 |
|
|
<?=$mandfldhtml?><input name="l2tp_dns1" type="text" class="formfld unknown form-control" id="l2tp_dns1" size="20" value="<?=htmlspecialchars($pconfig['l2tp_dns1'])?>" />
|
454 |
3fac0afc
|
Jose Luis Duran
|
<input name="l2tp_dns2" type="text" class="formfld unknown form-control" id="l2tp_dns2" size="20" value="<?=htmlspecialchars($pconfig['l2tp_dns2'])?>" />
|
455 |
61144c9b
|
Sander van Leeuwen
|
<span class="help-block">
|
456 |
3fac0afc
|
Jose Luis Duran
|
<?=gettext("primary and secondary DNS servers assigned to L2TP clients")?>
|
457 |
61144c9b
|
Sander van Leeuwen
|
</span>
|
458 |
3fac0afc
|
Jose Luis Duran
|
</div>
|
459 |
61144c9b
|
Sander van Leeuwen
|
</div>
|
460 |
|
|
|
461 |
|
|
<div class="form-group">
|
462 |
|
|
<label for="wins" class="col-sm-2 control-label"><?=gettext("WINS Server")?></label>
|
463 |
|
|
<div class="col-sm-10">
|
464 |
|
|
<input name="wins" class="formfld unknown form-control" id="wins" size="20" value="<?=htmlspecialchars($pconfig['wins'])?>" />
|
465 |
3fac0afc
|
Jose Luis Duran
|
</div>
|
466 |
61144c9b
|
Sander van Leeuwen
|
</div>
|
467 |
|
|
</div>
|
468 |
|
|
</div>
|
469 |
|
|
|
470 |
|
|
<div class="panel panel-default">
|
471 |
|
|
<div class="panel-heading">
|
472 |
|
|
<h2 class="panel-title"><?=gettext('RADIUS'); ?></h2>
|
473 |
|
|
</div>
|
474 |
|
|
|
475 |
|
|
<div class="panel-body">
|
476 |
|
|
<div class="form-group">
|
477 |
44fb6286
|
Chris Buechler
|
<label for="radiusenable" class="col-sm-2 control-label"><?=gettext('RADIUS Authentication')?></label>
|
478 |
61144c9b
|
Sander van Leeuwen
|
<div class="col-sm-10 checkbox">
|
479 |
|
|
<label>
|
480 |
|
|
<input name="radiusenable" type="checkbox" id="radiusenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiusenable']) echo "checked=\"checked\""?> />
|
481 |
|
|
<?=gettext("Use a RADIUS server for authentication")?>
|
482 |
|
|
</label>
|
483 |
|
|
<span class="help-block">
|
484 |
3fac0afc
|
Jose Luis Duran
|
<?=gettext("When set, all users will be authenticated using the RADIUS server specified below. The local user database will not be used.")?>
|
485 |
61144c9b
|
Sander van Leeuwen
|
</span>
|
486 |
|
|
</div>
|
487 |
|
|
</div>
|
488 |
|
|
<div class="form-group">
|
489 |
44fb6286
|
Chris Buechler
|
<label for="radacct_enable" class="col-sm-2 control-label"><?=gettext('RADIUS Accounting')?></label>
|
490 |
61144c9b
|
Sander van Leeuwen
|
<div class="col-sm-10 checkbox">
|
491 |
|
|
<label>
|
492 |
|
|
<input name="radacct_enable" type="checkbox" id="radacct_enable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radacct_enable']) echo "checked=\"checked\""?> />
|
493 |
|
|
<?=gettext("Enable RADIUS accounting")?>
|
494 |
|
|
</label>
|
495 |
|
|
<span class="help-block">
|
496 |
|
|
<?=gettext("Sends accounting packets to the RADIUS server.")?>
|
497 |
|
|
</span>
|
498 |
|
|
</div>
|
499 |
|
|
</div>
|
500 |
|
|
|
501 |
|
|
<div class="form-group">
|
502 |
|
|
<label for="radiusserver" class="col-sm-2 control-label"><?=gettext("RADIUS Server")?></label>
|
503 |
|
|
<div class="col-sm-10">
|
504 |
|
|
<input name="radiusserver" type="text" class="formfld unknown form-control" id="radiusserver" size="20" value="<?=htmlspecialchars($pconfig['radiusserver'])?>" />
|
505 |
|
|
<span class="help-block">
|
506 |
|
|
<?=gettext("Enter the IP address of the RADIUS server.")?>
|
507 |
|
|
</span>
|
508 |
|
|
</div>
|
509 |
|
|
</div>
|
510 |
|
|
<div class="form-group">
|
511 |
|
|
<label for="radiussecret" class="col-sm-2 control-label"><?=gettext("RADIUS Shared Secret")?></label>
|
512 |
|
|
<div class="col-sm-10">
|
513 |
|
|
<input name="radiussecret" type="password" class="formfld pwd form-control" id="radiussecret" size="20" value="<?=htmlspecialchars($pconfig['radiussecret'])?>" />
|
514 |
|
|
<span class="help-block">
|
515 |
|
|
<?=gettext("Enter the shared secret that will be used to authenticate to the RADIUS server.")?>
|
516 |
|
|
</span>
|
517 |
|
|
</div>
|
518 |
|
|
</div>
|
519 |
|
|
|
520 |
|
|
<div class="form-group">
|
521 |
44fb6286
|
Chris Buechler
|
<label for="radiusissueips" class="col-sm-2 control-label"><?=gettext("RADIUS Issued IPs")?></label>
|
522 |
61144c9b
|
Sander van Leeuwen
|
<div class="col-sm-10 checkbox">
|
523 |
|
|
<label>
|
524 |
|
|
<input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips"<?php if(isset($pconfig['radiusissueips'])) echo " checked=\"checked\""?> />
|
525 |
|
|
<?=gettext("Issue IP Addresses via RADIUS server.")?>
|
526 |
|
|
</label>
|
527 |
|
|
</div>
|
528 |
|
|
</div>
|
529 |
|
|
</div>
|
530 |
|
|
</div>
|
531 |
|
|
|
532 |
c4a7740d
|
Sander van Leeuwen
|
<?php
|
533 |
|
|
// TODO: Is it possible to detect available rules and only show warning if there are no (relevant) rules set?
|
534 |
|
|
?>
|
535 |
61144c9b
|
Sander van Leeuwen
|
<div class="alert alert-danger">
|
536 |
|
|
<strong><?=gettext("Note:")?></strong> <?=gettext("Don't forget to add a firewall rule to permit traffic from L2TP clients!")?>
|
537 |
|
|
</div>
|
538 |
|
|
|
539 |
|
|
<div class="col-sm-10 col-sm-offset-2">
|
540 |
|
|
<input id="submit" name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save")?>" onclick="enable_change(true)" />
|
541 |
|
|
</div>
|
542 |
5656fe23
|
Ermal Lu?i
|
</form>
|
543 |
|
|
|
544 |
|
|
<script type="text/javascript">
|
545 |
d28502be
|
Colin Fleming
|
//<![CDATA[
|
546 |
5656fe23
|
Ermal Lu?i
|
enable_change(false);
|
547 |
d28502be
|
Colin Fleming
|
//]]>
|
548 |
5656fe23
|
Ermal Lu?i
|
</script>
|
549 |
|
|
|
550 |
3fac0afc
|
Jose Luis Duran
|
<?php include("foot.inc")?>
|