Project

General

Profile

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