Project

General

Profile

Download (59.1 KB) Statistics
| Branch: | Tag: | Revision:
1 a5c0b6c7 Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3
	services_captiveportal.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5 a5c0b6c7 Scott Ullrich
6 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
7 0bd34ed6 Scott Ullrich
	Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
8 5b237745 Scott Ullrich
	All rights reserved.
9 a5c0b6c7 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 a5c0b6c7 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 a5c0b6c7 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 a5c0b6c7 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 1d333258 Scott Ullrich
/*
32
	pfSense_MODULE:	captiveportal
33
*/
34 5b237745 Scott Ullrich
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-services-captiveportal
37
##|*NAME=Services: Captive portal page
38
##|*DESCR=Allow access to the 'Services: Captive portal' page.
39
##|*MATCH=services_captiveportal.php*
40
##|-PRIV
41
42 ccb55b27 Darren Embry
require_once("functions.inc");
43
require_once("filter.inc");
44
require_once("shaper.inc");
45
require_once("captiveportal.inc");
46 5b237745 Scott Ullrich
47 aa87cf11 Renato Botelho
if (substr($_GET['act'], 0, 3) == "get")
48
	$nocsrf = true;
49
50
require_once("guiconfig.inc");
51
52 baec2b00 Ermal
global $cpzone;
53
global $cpzoneid;
54
55
$cpzoneid = 1; /* Just a default */
56 b4792bf8 Ermal
$cpzone = $_GET['zone'];
57
if (isset($_POST['zone']))
58
	$cpzone = $_POST['zone'];
59 6fde5a1e Carlos Eduardo Ramos
60 287f7e26 Ermal
if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) {
61 060bc78b Renato Botelho
	header("Location: services_captiveportal_zones.php");
62
	exit;
63 5b237745 Scott Ullrich
}
64
65 b4792bf8 Ermal
if (!is_array($config['captiveportal']))
66
	$config['captiveportal'] = array();
67
$a_cp =& $config['captiveportal'];
68
69
$pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']);
70 b32dd0a6 jim-p
$shortcut_section = "captiveportal";
71 b4792bf8 Ermal
72 5b237745 Scott Ullrich
if ($_GET['act'] == "viewhtml") {
73 a636682d bcyrill
	if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['htmltext'])
74
		echo base64_decode($a_cp[$cpzone]['page']['htmltext']);
75 5b237745 Scott Ullrich
	exit;
76 aa87cf11 Renato Botelho
} else if ($_GET['act'] == "gethtmlhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['htmltext']) {
77
	$file_data = base64_decode($a_cp[$cpzone]['page']['htmltext']);
78
	$file_size = strlen($file_data);
79
80
	header("Content-Type: text/html");
81
	header("Content-Disposition: attachment; filename=portal.html");
82
	header("Content-Length: $file_size");
83
	echo $file_data;
84
85 92603e27 Renato Botelho
	exit;
86
} else if ($_GET['act'] == "delhtmlhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['htmltext']) {
87
	unset($a_cp[$cpzone]['page']['htmltext']);
88
	write_config(sprintf(gettext("Captive Portal: zone %s: Restore default portal page"), $cpzone));
89
	header("Location: services_captiveportal.php?zone={$cpzone}");
90 aa87cf11 Renato Botelho
	exit;
91 5b237745 Scott Ullrich
} else if ($_GET['act'] == "viewerrhtml") {
92 a636682d bcyrill
	if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['errtext'])
93
		echo base64_decode($a_cp[$cpzone]['page']['errtext']);
94 5b237745 Scott Ullrich
	exit;
95 aa87cf11 Renato Botelho
} else if ($_GET['act'] == "geterrhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['errtext']) {
96
	$file_data = base64_decode($a_cp[$cpzone]['page']['errtext']);
97
	$file_size = strlen($file_data);
98
99
	header("Content-Type: text/html");
100
	header("Content-Disposition: attachment; filename=err.html");
101
	header("Content-Length: $file_size");
102
	echo $file_data;
103
104 92603e27 Renato Botelho
	exit;
105
} else if ($_GET['act'] == "delerrhtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['errtext']) {
106
	unset($a_cp[$cpzone]['page']['errtext']);
107
	write_config(sprintf(gettext("Captive Portal: zone %s: Restore default error page"), $cpzone));
108
	header("Location: services_captiveportal.php?zone={$cpzone}");
109 aa87cf11 Renato Botelho
	exit;
110 5b87b24e Ermal
} else if ($_GET['act'] == "viewlogouthtml") {
111 a636682d bcyrill
	if ($a_cp[$cpzone] && $a_cp[$cpzone]['page']['logouttext'])
112
		echo base64_decode($a_cp[$cpzone]['page']['logouttext']);
113 5b87b24e Ermal
	exit;
114 aa87cf11 Renato Botelho
} else if ($_GET['act'] == "getlogouthtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['logouttext']) {
115
	$file_data = base64_decode($a_cp[$cpzone]['page']['logouttext']);
116
	$file_size = strlen($file_data);
117
118
	header("Content-Type: text/html");
119
	header("Content-Disposition: attachment; filename=logout.html");
120
	header("Content-Length: $file_size");
121
	echo $file_data;
122
123 92603e27 Renato Botelho
	exit;
124
} else if ($_GET['act'] == "dellogouthtml" && $a_cp[$cpzone] && $a_cp[$cpzone]['page']['logouttext']) {
125
	unset($a_cp[$cpzone]['page']['logouttext']);
126
	write_config(sprintf(gettext("Captive Portal: zone %s: Restore default logout page"), $cpzone));
127
	header("Location: services_captiveportal.php?zone={$cpzone}");
128 aa87cf11 Renato Botelho
	exit;
129 5b237745 Scott Ullrich
}
130
131 36f6ed35 bcyrill
if (!is_array($config['ca']))
132
	$config['ca'] = array();
133
134
$a_ca =& $config['ca'];
135
136
if (!is_array($config['cert']))
137
	$config['cert'] = array();
138
139
$a_cert =& $config['cert'];
140
141 a636682d bcyrill
if ($a_cp[$cpzone]) {
142 baec2b00 Ermal
	$cpzoneid = $pconfig['zoneid'] = $a_cp[$cpzone]['zoneid'];
143 b4792bf8 Ermal
	$pconfig['cinterface'] = $a_cp[$cpzone]['interface'];
144
	$pconfig['maxproc'] = $a_cp[$cpzone]['maxproc'];
145
	$pconfig['maxprocperip'] = $a_cp[$cpzone]['maxprocperip'];
146
	$pconfig['timeout'] = $a_cp[$cpzone]['timeout'];
147
	$pconfig['idletimeout'] = $a_cp[$cpzone]['idletimeout'];
148
	$pconfig['freelogins_count'] = $a_cp[$cpzone]['freelogins_count'];
149
	$pconfig['freelogins_resettimeout'] = $a_cp[$cpzone]['freelogins_resettimeout'];
150
	$pconfig['freelogins_updatetimeouts'] = isset($a_cp[$cpzone]['freelogins_updatetimeouts']);
151
	$pconfig['enable'] = isset($a_cp[$cpzone]['enable']);
152
	$pconfig['auth_method'] = $a_cp[$cpzone]['auth_method'];
153 a8cb0038 Renato Botelho
	$pconfig['localauth_priv'] = isset($a_cp[$cpzone]['localauth_priv']);
154 b4792bf8 Ermal
	$pconfig['radacct_enable'] = isset($a_cp[$cpzone]['radacct_enable']);
155
	$pconfig['radmac_enable'] = isset($a_cp[$cpzone]['radmac_enable']);
156
	$pconfig['radmac_secret'] = $a_cp[$cpzone]['radmac_secret'];
157
	$pconfig['reauthenticate'] = isset($a_cp[$cpzone]['reauthenticate']);
158
	$pconfig['reauthenticateacct'] = $a_cp[$cpzone]['reauthenticateacct'];
159
	$pconfig['httpslogin_enable'] = isset($a_cp[$cpzone]['httpslogin']);
160
	$pconfig['httpsname'] = $a_cp[$cpzone]['httpsname'];
161
	$pconfig['preauthurl'] = strtolower($a_cp[$cpzone]['preauthurl']);
162 2f1548d6 Renato Botelho
	$pconfig['blockedmacsurl'] = strtolower($a_cp[$cpzone]['blockedmacsurl']);
163 36f6ed35 bcyrill
	$pconfig['certref'] = $a_cp[$cpzone]['certref'];
164 b7b461fc derelict-pf
	$pconfig['nohttpsforwards'] = isset($a_cp[$cpzone]['nohttpsforwards']);
165 b4792bf8 Ermal
	$pconfig['logoutwin_enable'] = isset($a_cp[$cpzone]['logoutwin_enable']);
166
	$pconfig['peruserbw'] = isset($a_cp[$cpzone]['peruserbw']);
167
	$pconfig['bwdefaultdn'] = $a_cp[$cpzone]['bwdefaultdn'];
168
	$pconfig['bwdefaultup'] = $a_cp[$cpzone]['bwdefaultup'];
169
	$pconfig['nomacfilter'] = isset($a_cp[$cpzone]['nomacfilter']);
170
	$pconfig['noconcurrentlogins'] = isset($a_cp[$cpzone]['noconcurrentlogins']);
171 060bc78b Renato Botelho
	$pconfig['radius_protocol'] = $a_cp[$cpzone]['radius_protocol'];
172 b4792bf8 Ermal
	$pconfig['redirurl'] = $a_cp[$cpzone]['redirurl'];
173
	$pconfig['radiusip'] = $a_cp[$cpzone]['radiusip'];
174
	$pconfig['radiusip2'] = $a_cp[$cpzone]['radiusip2'];
175 ebc0e4b6 Ermal
	$pconfig['radiusip3'] = $a_cp[$cpzone]['radiusip3'];
176
	$pconfig['radiusip4'] = $a_cp[$cpzone]['radiusip4'];
177 b4792bf8 Ermal
	$pconfig['radiusport'] = $a_cp[$cpzone]['radiusport'];
178
	$pconfig['radiusport2'] = $a_cp[$cpzone]['radiusport2'];
179 ebc0e4b6 Ermal
	$pconfig['radiusport3'] = $a_cp[$cpzone]['radiusport3'];
180
	$pconfig['radiusport4'] = $a_cp[$cpzone]['radiusport4'];
181 b4792bf8 Ermal
	$pconfig['radiusacctport'] = $a_cp[$cpzone]['radiusacctport'];
182
	$pconfig['radiuskey'] = $a_cp[$cpzone]['radiuskey'];
183
	$pconfig['radiuskey2'] = $a_cp[$cpzone]['radiuskey2'];
184 ebc0e4b6 Ermal
	$pconfig['radiuskey3'] = $a_cp[$cpzone]['radiuskey3'];
185
	$pconfig['radiuskey4'] = $a_cp[$cpzone]['radiuskey4'];
186 b4792bf8 Ermal
	$pconfig['radiusvendor'] = $a_cp[$cpzone]['radiusvendor'];
187
	$pconfig['radiussession_timeout'] = isset($a_cp[$cpzone]['radiussession_timeout']);
188
	$pconfig['radiussrcip_attribute'] = $a_cp[$cpzone]['radiussrcip_attribute'];
189
	$pconfig['passthrumacadd'] = isset($a_cp[$cpzone]['passthrumacadd']);
190
	$pconfig['passthrumacaddusername'] = isset($a_cp[$cpzone]['passthrumacaddusername']);
191
	$pconfig['radmac_format'] = $a_cp[$cpzone]['radmac_format'];
192 720498a0 Michael Newton
	$pconfig['reverseacct'] = isset($a_cp[$cpzone]['reverseacct']);
193 4cc94535 Michael Newton
	$pconfig['radiusnasid'] = $a_cp[$cpzone]['radiusnasid'];
194 b4792bf8 Ermal
	$pconfig['page'] = array();
195
	if ($a_cp[$cpzone]['page']['htmltext'])
196
		$pconfig['page']['htmltext'] = $a_cp[$cpzone]['page']['htmltext'];
197
	if ($a_cp[$cpzone]['page']['errtext'])
198
		$pconfig['page']['errtext'] = $a_cp[$cpzone]['page']['errtext'];
199
	if ($a_cp[$cpzone]['page']['logouttext'])
200
		$pconfig['page']['logouttext'] = $a_cp[$cpzone]['page']['logouttext'];
201
}
202 5b237745 Scott Ullrich
203
if ($_POST) {
204
205
	unset($input_errors);
206
	$pconfig = $_POST;
207
208
	/* input validation */
209
	if ($_POST['enable']) {
210 b4792bf8 Ermal
		$reqdfields = explode(" ", "zone cinterface");
211
		$reqdfieldsn = array(gettext("Zone name"), gettext("Interface"));
212 a5c0b6c7 Scott Ullrich
213 1e9b4611 Renato Botelho
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
214 a5c0b6c7 Scott Ullrich
215 b4792bf8 Ermal
		/* make sure no interfaces are bridged or used on other zones */
216
		if (is_array($_POST['cinterface'])) {
217
			foreach ($pconfig['cinterface'] as $cpbrif) {
218 3e4f5a33 jim-p
				if (link_interface_to_bridge($cpbrif))
219
					$input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif);
220 b4792bf8 Ermal
				foreach ($a_cp as $cpkey => $cp) {
221
					if ($cpkey != $cpzone || empty($cpzone)) {
222
						if (in_array($cpbrif, explode(",", $cp['interface'])))
223
							$input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is used already on %s instance."), $cpbrif, $cp['zone']);
224
					}
225
				}
226
			}
227
		}
228 a5c0b6c7 Scott Ullrich
229 5b237745 Scott Ullrich
		if ($_POST['httpslogin_enable']) {
230 060bc78b Renato Botelho
			if (!$_POST['certref']) {
231 36f6ed35 bcyrill
				$input_errors[] = gettext("Certificate must be specified for HTTPS login.");
232 5b237745 Scott Ullrich
			}
233
			if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
234 6fde5a1e Carlos Eduardo Ramos
				$input_errors[] = gettext("The HTTPS server name must be specified for HTTPS login.");
235 5b237745 Scott Ullrich
			}
236
		}
237
	}
238 a5c0b6c7 Scott Ullrich
239 e680b2f9 Renato Botelho
	if ($_POST['timeout']) {
240
		if (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))
241
			$input_errors[] = gettext("The timeout must be at least 1 minute.");
242
		else if (isset($config['dhcpd']) && is_array($config['dhcpd'])) {
243
			foreach ($config['dhcpd'] as $dhcpd_if => $dhcpd_data) {
244
				if (!isset($dhcpd_data['enable']))
245
					continue;
246
				if (!is_array($_POST['cinterface']) || !in_array($dhcpd_if, $_POST['cinterface']))
247
					continue;
248
249
				$deftime = 7200; // Default lease time
250
				if (isset($dhcpd_data['defaultleasetime']) && is_numeric($dhcpd_data['defaultleasetime']))
251
					$deftime = $dhcpd_data['defaultleasetime'];
252
253
				if ($_POST['timeout'] > $deftime)
254
					$input_errors[] = gettext("Hard timeout must be less or equal Default lease time set on DHCP Server");
255
			}
256
		}
257 5b237745 Scott Ullrich
	}
258
	if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
259 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = gettext("The idle timeout must be at least 1 minute.");
260 5b237745 Scott Ullrich
	}
261 03552507 Erik Fonnesbeck
	if ($_POST['freelogins_count'] && (!is_numeric($_POST['freelogins_count']))) {
262 49f61a1c Erik Fonnesbeck
		$input_errors[] = gettext("The pass-through credit count must be a number or left blank.");
263
	} else if ($_POST['freelogins_count'] && is_numeric($_POST['freelogins_count']) && ($_POST['freelogins_count'] >= 1)) {
264
		if (empty($_POST['freelogins_resettimeout']) || !is_numeric($_POST['freelogins_resettimeout']) || ($_POST['freelogins_resettimeout'] <= 0)) {
265
			$input_errors[] = gettext("The waiting period to restore pass-through credits must be above 0 hours.");
266
		}
267 03552507 Erik Fonnesbeck
	}
268 5b237745 Scott Ullrich
	if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) {
269 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip']);
270 5b237745 Scott Ullrich
	}
271 0bd34ed6 Scott Ullrich
	if (($_POST['radiusip2'] && !is_ipaddr($_POST['radiusip2']))) {
272 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip2']);
273 0bd34ed6 Scott Ullrich
	}
274 ebc0e4b6 Ermal
	if (($_POST['radiusip3'] && !is_ipaddr($_POST['radiusip3']))) {
275
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip3']);
276
	}
277
	if (($_POST['radiusip4'] && !is_ipaddr($_POST['radiusip4']))) {
278
		$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['radiusip4']);
279
	}
280 5b237745 Scott Ullrich
	if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) {
281 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport']);
282 5b237745 Scott Ullrich
	}
283 0bd34ed6 Scott Ullrich
	if (($_POST['radiusport2'] && !is_port($_POST['radiusport2']))) {
284 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport2']);
285 0bd34ed6 Scott Ullrich
	}
286 ebc0e4b6 Ermal
	if (($_POST['radiusport3'] && !is_port($_POST['radiusport3']))) {
287
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport3']);
288
	}
289
	if (($_POST['radiusport4'] && !is_port($_POST['radiusport4']))) {
290
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusport4']);
291
	}
292 5b237745 Scott Ullrich
	if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) {
293 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = sprintf(gettext("A valid port number must be specified. [%s]"), $_POST['radiusacctport']);
294 0bd34ed6 Scott Ullrich
	}
295 b4792bf8 Ermal
	if ($_POST['maxproc'] && (!is_numeric($_POST['maxproc']) || ($_POST['maxproc'] < 4) || ($_POST['maxproc'] > 100))) {
296 6fde5a1e Carlos Eduardo Ramos
		$input_errors[] = gettext("The maximum number of concurrent connections per client IP address may not be larger than the global maximum.");
297 5b237745 Scott Ullrich
	}
298 89b1c40c Michael Newton
	if (trim($_POST['radiusnasid']) !== "" && !preg_match("/^[\x21-\x7e]{3,253}$/i", trim($_POST['radiusnasid']))) {
299
		$input_errors[] = gettext("The NAS-Identifier must be 3-253 characters long and should only contain ASCII characters.");
300
	}
301 5b237745 Scott Ullrich
302
	if (!$input_errors) {
303 b4792bf8 Ermal
		$newcp =& $a_cp[$cpzone];
304
		//$newcp['zoneid'] = $a_cp[$cpzone]['zoneid'];
305
		if (empty($newcp['zoneid'])) {
306 1122705e Ermal
			$newcp['zoneid'] = 2;
307 baec2b00 Ermal
			foreach ($a_cp as $keycpzone => $cp) {
308 b4792bf8 Ermal
				if ($cp['zoneid'] == $newcp['zoneid'] && $keycpzone != $cpzone)
309
					$newcp['zoneid'] += 2; /* Resreve space for SSL config if needed */
310 baec2b00 Ermal
			}
311
			$cpzoneid = $newcp['zoneid'];
312 b4792bf8 Ermal
		}
313 13e64b47 Ermal
		$oldifaces = explode(",", $newcp['interface']);
314 3e4f5a33 jim-p
		if (is_array($_POST['cinterface']))
315 b4792bf8 Ermal
			$newcp['interface'] = implode(",", $_POST['cinterface']);
316
		$newcp['maxproc'] = $_POST['maxproc'];
317
		$newcp['maxprocperip'] = $_POST['maxprocperip'] ? $_POST['maxprocperip'] : false;
318
		$newcp['timeout'] = $_POST['timeout'];
319
		$newcp['idletimeout'] = $_POST['idletimeout'];
320
		$newcp['freelogins_count'] = $_POST['freelogins_count'];
321
		$newcp['freelogins_resettimeout'] = $_POST['freelogins_resettimeout'];
322
		$newcp['freelogins_updatetimeouts'] = $_POST['freelogins_updatetimeouts'] ? true : false;
323
		if ($_POST['enable'])
324
			$newcp['enable'] = true;
325
		else
326
			unset($newcp['enable']);
327
		$newcp['auth_method'] = $_POST['auth_method'];
328 a8cb0038 Renato Botelho
		$newcp['localauth_priv'] = isset($_POST['localauth_priv']);
329 b4792bf8 Ermal
		$newcp['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
330
		$newcp['reauthenticate'] = $_POST['reauthenticate'] ? true : false;
331
		$newcp['radmac_enable'] = $_POST['radmac_enable'] ? true : false;
332
		$newcp['radmac_secret'] = $_POST['radmac_secret'] ? $_POST['radmac_secret'] : false;
333
		$newcp['reauthenticateacct'] = $_POST['reauthenticateacct'];
334 f3bea667 bcyrill
		if ($_POST['httpslogin_enable'])
335 20789ec9 bcyrill
			$newcp['httpslogin'] = true;
336
		else
337
			unset($newcp['httpslogin']);
338 b4792bf8 Ermal
		$newcp['httpsname'] = $_POST['httpsname'];
339
		$newcp['preauthurl'] = $_POST['preauthurl'];
340 2f1548d6 Renato Botelho
		$newcp['blockedmacsurl'] = $_POST['blockedmacsurl'];
341 b4792bf8 Ermal
		$newcp['peruserbw'] = $_POST['peruserbw'] ? true : false;
342 384deecb Ermal LUÇI
		if (isset($_POST['bwdefaultdn']))
343
			$newcp['bwdefaultdn'] = $_POST['bwdefaultdn'];
344
		else
345
			unset($newcp['bwdefaultdn']);
346
		if (isset($_POST['bwdefaultup']))
347
			$newcp['bwdefaultup'] = $_POST['bwdefaultup'];
348
		else
349
			unset($newcp['bwdefaultup']);
350 36f6ed35 bcyrill
		$newcp['certref'] = $_POST['certref'];
351 b7b461fc derelict-pf
		$newcp['nohttpsforwards'] = $_POST['nohttpsforwards'] ? true : false;
352 b4792bf8 Ermal
		$newcp['logoutwin_enable'] = $_POST['logoutwin_enable'] ? true : false;
353
		$newcp['nomacfilter'] = $_POST['nomacfilter'] ? true : false;
354
		$newcp['noconcurrentlogins'] = $_POST['noconcurrentlogins'] ? true : false;
355 060bc78b Renato Botelho
		$newcp['radius_protocol'] = $_POST['radius_protocol'];
356 b4792bf8 Ermal
		$newcp['redirurl'] = $_POST['redirurl'];
357 ebc0e4b6 Ermal
		if (isset($_POST['radiusip']))
358 13a45484 Cyrill Bannwart
			$newcp['radiusip'] = $_POST['radiusip'];
359 ebc0e4b6 Ermal
		else
360 5c0d5003 Ermal
			unset($newcp['radiusip']);
361 ebc0e4b6 Ermal
		if (isset($_POST['radiusip2']))
362 13a45484 Cyrill Bannwart
			$newcp['radiusip2'] = $_POST['radiusip2'];
363 ebc0e4b6 Ermal
		else
364 13a45484 Cyrill Bannwart
			unset($newcp['radiusip2']);
365 ebc0e4b6 Ermal
		if (isset($_POST['radiusip3']))
366 13a45484 Cyrill Bannwart
			$newcp['radiusip3'] = $_POST['radiusip3'];
367 ebc0e4b6 Ermal
		else
368 13a45484 Cyrill Bannwart
			unset($newcp['radiusip3']);
369 ebc0e4b6 Ermal
		if (isset($_POST['radiusip4']))
370 13a45484 Cyrill Bannwart
			$newcp['radiusip4'] = $_POST['radiusip4'];
371 ebc0e4b6 Ermal
		else
372 13a45484 Cyrill Bannwart
			unset($newcp['radiusip4']);
373 b4792bf8 Ermal
		$newcp['radiusport'] = $_POST['radiusport'];
374
		$newcp['radiusport2'] = $_POST['radiusport2'];
375 ebc0e4b6 Ermal
		if (isset($_POST['radiusport3']))
376 13a45484 Cyrill Bannwart
			$newcp['radiusport3'] = $_POST['radiusport3'];
377 ebc0e4b6 Ermal
		if (isset($_POST['radiusport4']))
378 13a45484 Cyrill Bannwart
			$newcp['radiusport4'] = $_POST['radiusport4'];
379 b4792bf8 Ermal
		$newcp['radiusacctport'] = $_POST['radiusacctport'];
380
		$newcp['radiuskey'] = $_POST['radiuskey'];
381
		$newcp['radiuskey2'] = $_POST['radiuskey2'];
382 ebc0e4b6 Ermal
		$newcp['radiuskey3'] = $_POST['radiuskey3'];
383
		$newcp['radiuskey4'] = $_POST['radiuskey4'];
384 b4792bf8 Ermal
		$newcp['radiusvendor'] = $_POST['radiusvendor'] ? $_POST['radiusvendor'] : false;
385
		$newcp['radiussession_timeout'] = $_POST['radiussession_timeout'] ? true : false;
386
		$newcp['radiussrcip_attribute'] = $_POST['radiussrcip_attribute'];
387
		$newcp['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false;
388
		$newcp['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false;
389
		$newcp['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false;
390 720498a0 Michael Newton
		$newcp['reverseacct'] = $_POST['reverseacct'] ? true : false;
391 4cc94535 Michael Newton
		$newcp['radiusnasid'] = trim($_POST['radiusnasid']);
392 b4792bf8 Ermal
		if (!is_array($newcp['page']))
393
			$newcp['page'] = array();
394 a5c0b6c7 Scott Ullrich
395 5b237745 Scott Ullrich
		/* file upload? */
396
		if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
397 b4792bf8 Ermal
			$newcp['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
398 c980716e Scott Ullrich
		if (is_uploaded_file($_FILES['errfile']['tmp_name']))
399 b4792bf8 Ermal
			$newcp['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
400 5b87b24e Ermal
		if (is_uploaded_file($_FILES['logoutfile']['tmp_name']))
401 b4792bf8 Ermal
			$newcp['page']['logouttext'] = base64_encode(file_get_contents($_FILES['logoutfile']['tmp_name']));
402 a5c0b6c7 Scott Ullrich
403 5b237745 Scott Ullrich
		write_config();
404 a5c0b6c7 Scott Ullrich
405 13e64b47 Ermal
		/* Clear up unselected interfaces */
406
		$newifaces = explode(",", $newcp['interface']);
407
		$toremove = array_diff($oldifaces, $newifaces);
408
		if (!empty($toremove)) {
409
			foreach ($toremove as $removeif) {
410
				$removeif = get_real_interface($removeif);
411 08d47f75 Ermal
				mwexec("/sbin/ipfw zone {$cpzoneid} mdel {$removeif}");
412 13e64b47 Ermal
			}
413
		}
414 b4792bf8 Ermal
		captiveportal_configure_zone($newcp);
415 13e64b47 Ermal
		unset($newcp, $newifaces, $toremove);
416 b4792bf8 Ermal
		filter_configure();
417
		header("Location: services_captiveportal_zones.php");
418 060bc78b Renato Botelho
		exit;
419 b4792bf8 Ermal
	} else {
420 3e4f5a33 jim-p
		if (is_array($_POST['cinterface']))
421
			$pconfig['cinterface'] = implode(",", $_POST['cinterface']);
422 5b237745 Scott Ullrich
	}
423
}
424 73672832 Colin Fleming
$closehead = false;
425 3d4bd975 Scott Ullrich
include("head.inc");
426 5b237745 Scott Ullrich
?>
427 91f026b0 ayvis
<script type="text/javascript">
428 73672832 Colin Fleming
//<![CDATA[
429 5b237745 Scott Ullrich
function enable_change(enable_change) {
430 0bd34ed6 Scott Ullrich
	var endis, radius_endis;
431 07bd3f83 Scott Ullrich
	endis = !(document.iform.enable.checked || enable_change);
432 a8cb0038 Renato Botelho
	localauth_endis = !((!endis && document.iform.auth_method[1].checked) || enable_change);
433 0bd34ed6 Scott Ullrich
	radius_endis = !((!endis && document.iform.auth_method[2].checked) || enable_change);
434 36f6ed35 bcyrill
	https_endis = !((!endis && document.iform.httpslogin_enable.checked) || enable_change);
435 a5c0b6c7 Scott Ullrich
436 07bd3f83 Scott Ullrich
	document.iform.cinterface.disabled = endis;
437 b4792bf8 Ermal
	//document.iform.maxproc.disabled = endis;
438 422d57b4 Scott Ullrich
	document.iform.maxprocperip.disabled = endis;
439 07bd3f83 Scott Ullrich
	document.iform.idletimeout.disabled = endis;
440 03552507 Erik Fonnesbeck
	document.iform.freelogins_count.disabled = endis;
441
	document.iform.freelogins_resettimeout.disabled = endis;
442
	document.iform.freelogins_updatetimeouts.disabled = endis;
443 07bd3f83 Scott Ullrich
	document.iform.timeout.disabled = endis;
444 f5adee3f jim-p
	document.iform.preauthurl.disabled = endis;
445 2f1548d6 Renato Botelho
	document.iform.blockedmacsurl.disabled = endis;
446 07bd3f83 Scott Ullrich
	document.iform.redirurl.disabled = endis;
447 a8cb0038 Renato Botelho
	document.iform.localauth_priv.disabled = localauth_endis;
448 0bd34ed6 Scott Ullrich
	document.iform.radiusip.disabled = radius_endis;
449
	document.iform.radiusip2.disabled = radius_endis;
450 ebc0e4b6 Ermal
	document.iform.radiusip3.disabled = radius_endis;
451
	document.iform.radiusip4.disabled = radius_endis;
452 0bd34ed6 Scott Ullrich
	document.iform.radiusport.disabled = radius_endis;
453 164a1525 Scott Ullrich
	document.iform.radiusport3.disabled = radius_endis;
454
	document.iform.radiusport4.disabled = radius_endis;
455 0bd34ed6 Scott Ullrich
	document.iform.radiusport2.disabled = radius_endis;
456
	document.iform.radiuskey.disabled = radius_endis;
457
	document.iform.radiuskey2.disabled = radius_endis;
458 ebc0e4b6 Ermal
	document.iform.radiuskey3.disabled = radius_endis;
459
	document.iform.radiuskey4.disabled = radius_endis;
460 856e58a6 Scott Ullrich
	document.iform.radacct_enable.disabled = radius_endis;
461 f5fa7d5e Ermal Luçi
	document.iform.peruserbw.disabled = endis;
462
	document.iform.bwdefaultdn.disabled = endis;
463
	document.iform.bwdefaultup.disabled = endis;
464 856e58a6 Scott Ullrich
	document.iform.reauthenticate.disabled = radius_endis;
465 7faeda46 Scott Ullrich
	document.iform.auth_method[0].disabled = endis;
466
	document.iform.auth_method[1].disabled = endis;
467
	document.iform.auth_method[2].disabled = endis;
468 b3765f4c Roberto Nunnari
	document.iform.radius_protocol[0].disabled = radius_endis;
469
	document.iform.radius_protocol[1].disabled = radius_endis;
470
	document.iform.radius_protocol[2].disabled = radius_endis;
471
	document.iform.radius_protocol[3].disabled = radius_endis;
472 0bd34ed6 Scott Ullrich
	document.iform.radmac_enable.disabled = radius_endis;
473 07bd3f83 Scott Ullrich
	document.iform.httpslogin_enable.disabled = endis;
474 d11c1f93 sullrich
	document.iform.radmac_format.disabled = radius_endis;
475 36f6ed35 bcyrill
	document.iform.httpsname.disabled = https_endis;
476
	document.iform.certref.disabled = https_endis;
477 b7b461fc derelict-pf
	document.iform.nohttpsforwards.disabled = https_endis;
478 07bd3f83 Scott Ullrich
	document.iform.logoutwin_enable.disabled = endis;
479 c980716e Scott Ullrich
	document.iform.nomacfilter.disabled = endis;
480 0bd34ed6 Scott Ullrich
	document.iform.noconcurrentlogins.disabled = endis;
481
	document.iform.radiusvendor.disabled = radius_endis;
482 2342bfb0 Ermal Lu?i
	document.iform.radiussession_timeout.disabled = radius_endis;
483 822b687b Ermal
	document.iform.radiussrcip_attribute.disabled = radius_endis;
484 07bd3f83 Scott Ullrich
	document.iform.htmlfile.disabled = endis;
485
	document.iform.errfile.disabled = endis;
486 5b87b24e Ermal
	document.iform.logoutfile.disabled = endis;
487 a5c0b6c7 Scott Ullrich
488 856e58a6 Scott Ullrich
	document.iform.radiusacctport.disabled = (radius_endis || !document.iform.radacct_enable.checked) && !enable_change;
489 a5c0b6c7 Scott Ullrich
490 856e58a6 Scott Ullrich
	document.iform.radmac_secret.disabled = (radius_endis || !document.iform.radmac_enable.checked) && !enable_change;
491 a5c0b6c7 Scott Ullrich
492 88adfa28 Warren Baker
	var radacct_dis = (radius_endis || !document.iform.radacct_enable.checked) && !enable_change;
493
	document.iform.reauthenticateacct[0].disabled = radacct_dis;
494
	document.iform.reauthenticateacct[1].disabled = radacct_dis;
495
	document.iform.reauthenticateacct[2].disabled = radacct_dis;
496 720498a0 Michael Newton
	document.iform.reverseacct.disabled = (radius_endis || !document.iform.radacct_enable.checked) && !enable_change;
497 4cc94535 Michael Newton
	document.iform.radiusnasid.disabled = radius_endis;
498 5b237745 Scott Ullrich
}
499 73672832 Colin Fleming
//]]>
500 5b237745 Scott Ullrich
</script>
501 73672832 Colin Fleming
</head>
502 93588e1a Scott Dale
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
503 ccb55b27 Darren Embry
<?php include("fbegin.inc"); ?>
504 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
505
<?php if ($savemsg) print_info_box($savemsg); ?>
506
<form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
507 73672832 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="captive portal">
508 9699028a Scott Ullrich
  <tr><td class="tabnavtbl">
509 64b85ffe Scott Ullrich
<?php
510
	$tab_array = array();
511 b4792bf8 Ermal
	$tab_array[] = array(gettext("Captive portal(s)"), true, "services_captiveportal.php?zone={$cpzone}");
512 ed8899b5 Renato Botelho
	$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
513 b4792bf8 Ermal
	$tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
514 060bc78b Renato Botelho
	$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
515 b4792bf8 Ermal
	$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php?zone={$cpzone}");
516
	$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php?zone={$cpzone}");
517 9592c132 Scott Ullrich
	display_top_tabs($tab_array, true);
518 0bd34ed6 Scott Ullrich
?>    </td></tr>
519 5b237745 Scott Ullrich
  <tr>
520 c980716e Scott Ullrich
  <td class="tabcont">
521 73672832 Colin Fleming
  <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main">
522 a5c0b6c7 Scott Ullrich
	<tr>
523 5b237745 Scott Ullrich
	  <td width="22%" valign="top" class="vtable">&nbsp;</td>
524
	  <td width="78%" class="vtable">
525 73672832 Colin Fleming
		<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
526 6fde5a1e Carlos Eduardo Ramos
		<strong><?=gettext("Enable captive portal"); ?> </strong></td>
527 5b237745 Scott Ullrich
	</tr>
528 a5c0b6c7 Scott Ullrich
	<tr>
529 6fde5a1e Carlos Eduardo Ramos
	  <td width="22%" valign="top" class="vncellreq"><?=gettext("Interfaces"); ?></td>
530 5b237745 Scott Ullrich
	  <td width="78%" class="vtable">
531 73672832 Colin Fleming
		<select name="cinterface[]" multiple="multiple" size="<?php echo count($config['interfaces']); ?>" class="formselect" id="cinterface">
532 060bc78b Renato Botelho
		  <?php
533 fbb45bb0 Ermal Luçi
		  $interfaces = get_configured_interface_with_descr();
534 17103056 Ermal
		  $cselected = explode(",", $pconfig['cinterface']);
535 c980716e Scott Ullrich
		  foreach ($interfaces as $iface => $ifacename): ?>
536 73672832 Colin Fleming
			  <option value="<?=$iface;?>" <?php if (in_array($iface, $cselected)) echo "selected=\"selected\""; ?>>
537 17103056 Ermal
			  <?=htmlspecialchars($ifacename);?>
538
			  </option>
539 5b237745 Scott Ullrich
		  <?php endforeach; ?>
540 8cd558b6 ayvis
		</select> <br />
541 16457bdd Renato Botelho
		<span class="vexpl"><?=gettext("Select the interface(s) to enable for captive portal."); ?></span></td>
542 5b237745 Scott Ullrich
	</tr>
543 4362e48a Scott Ullrich
	<tr>
544 6fde5a1e Carlos Eduardo Ramos
	  <td valign="top" class="vncell"><?=gettext("Maximum concurrent connections"); ?></td>
545 4362e48a Scott Ullrich
	  <td class="vtable">
546 73672832 Colin Fleming
		<table cellpadding="0" cellspacing="0" summary="connections">
547 4362e48a Scott Ullrich
                 <tr>
548 73672832 Colin Fleming
           			<td><input name="maxprocperip" type="text" class="formfld unknown" id="maxprocperip" size="5" value="<?=htmlspecialchars($pconfig['maxprocperip']);?>" /> <?=gettext("per client IP address (0 = no limit)"); ?></td>
549 4362e48a Scott Ullrich
                 </tr>
550
               </table>
551 6fde5a1e Carlos Eduardo Ramos
<?=gettext("This setting limits the number of concurrent connections to the captive portal HTTP(S) server. This does not set how many users can be logged in " .
552
"to the captive portal, but rather how many users can load the portal page or authenticate at the same time! " .
553 4dc04853 Ermal
"Possible setting allowed is: minimum 4 connections per client IP address, with a total maximum of 100 connections."); ?></td>
554 4362e48a Scott Ullrich
	</tr>
555 5b237745 Scott Ullrich
	<tr>
556 6fde5a1e Carlos Eduardo Ramos
	  <td valign="top" class="vncell"><?=gettext("Idle timeout"); ?></td>
557 5b237745 Scott Ullrich
	  <td class="vtable">
558 73672832 Colin Fleming
		<input name="idletimeout" type="text" class="formfld unknown" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>" />
559 8cd558b6 ayvis
<?=gettext("minutes"); ?><br />
560 16457bdd Renato Botelho
<?=gettext("Clients will be disconnected after this amount of inactivity. They may log in again immediately, though. Leave this field blank for no idle timeout."); ?></td>
561 5b237745 Scott Ullrich
	</tr>
562 a5c0b6c7 Scott Ullrich
	<tr>
563 6fde5a1e Carlos Eduardo Ramos
	  <td width="22%" valign="top" class="vncell"><?=gettext("Hard timeout"); ?></td>
564 a5c0b6c7 Scott Ullrich
	  <td width="78%" class="vtable">
565 73672832 Colin Fleming
		<input name="timeout" type="text" class="formfld unknown" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>" />
566 8cd558b6 ayvis
		<?=gettext("minutes"); ?><br />
567 16457bdd Renato Botelho
	  <?=gettext("Clients will be disconnected after this amount of time, regardless of activity. They may log in again immediately, though. Leave this field blank for no hard timeout (not recommended unless an idle timeout is set)."); ?></td>
568 5b237745 Scott Ullrich
	</tr>
569 03552507 Erik Fonnesbeck
	<tr>
570 49f61a1c Erik Fonnesbeck
	  <td width="22%" valign="top" class="vncell"><?=gettext("Pass-through credits allowed per MAC address"); ?></td>
571 03552507 Erik Fonnesbeck
	  <td width="78%" class="vtable">
572 73672832 Colin Fleming
		<input name="freelogins_count" type="text" class="formfld unknown" id="freelogins_count" size="6" value="<?=htmlspecialchars($pconfig['freelogins_count']);?>" />
573 8cd558b6 ayvis
		<?=gettext("per client MAC address (0 or blank = none)"); ?><br />
574 03552507 Erik Fonnesbeck
		<?=gettext("This setting allows passing through the captive portal without authentication a limited number of times per MAC address. Once used up, the client can only log in with valid credentials until the waiting period specified below has expired. Recommended to set a hard timeout and/or idle timeout when using this for it to be effective."); ?></td>
575
	</tr>
576
	<tr>
577 49f61a1c Erik Fonnesbeck
	  <td width="22%" valign="top" class="vncell"><?=gettext("Waiting period to restore pass-through credits"); ?></td>
578 03552507 Erik Fonnesbeck
	  <td width="78%" class="vtable">
579 73672832 Colin Fleming
		<input name="freelogins_resettimeout" type="text" class="formfld unknown" id="freelogins_resettimeout" size="6" value="<?=htmlspecialchars($pconfig['freelogins_resettimeout']);?>" />
580 8cd558b6 ayvis
		<?=gettext("hours"); ?><br />
581 49f61a1c Erik Fonnesbeck
		<?=gettext("Clients will have their available pass-through credits restored to the original count after this amount of time since using the first one. This must be above 0 hours if pass-through credits are enabled."); ?></td>
582 03552507 Erik Fonnesbeck
	</tr>
583
	<tr>
584 49f61a1c Erik Fonnesbeck
	  <td width="22%" valign="top" class="vncell"><?=gettext("Reset waiting period on attempted access"); ?></td>
585 03552507 Erik Fonnesbeck
	  <td width="78%" class="vtable">
586 73672832 Colin Fleming
		<input name="freelogins_updatetimeouts" type="checkbox" class="formfld" id="freelogins_updatetimeouts" value="yes" <?php if($pconfig['freelogins_updatetimeouts']) echo "checked=\"checked\""; ?> />
587 8cd558b6 ayvis
		<strong><?=gettext("Enable waiting period reset on attempted access"); ?></strong><br />
588 49f61a1c Erik Fonnesbeck
		<?=gettext("If enabled, the waiting period is reset to the original duration if access is attempted when all pass-through credits have already been exhausted."); ?></td>
589 03552507 Erik Fonnesbeck
	</tr>
590 a5c0b6c7 Scott Ullrich
	<tr>
591 6fde5a1e Carlos Eduardo Ramos
	  <td width="22%" valign="top" class="vncell"><?=gettext("Logout popup window"); ?></td>
592 a5c0b6c7 Scott Ullrich
	  <td width="78%" class="vtable">
593 73672832 Colin Fleming
		<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked=\"checked\""; ?> />
594 8cd558b6 ayvis
		<strong><?=gettext("Enable logout popup window"); ?></strong><br />
595 16457bdd Renato Botelho
	  <?=gettext("If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs."); ?></td>
596 5b237745 Scott Ullrich
	</tr>
597 a00e1d89 Scott Ullrich
	<tr>
598
      <td valign="top" class="vncell"><?=gettext("Pre-authentication redirect URL"); ?> </td>
599
      <td class="vtable">
600 73672832 Colin Fleming
        <input name="preauthurl" type="text" class="formfld url" id="preauthurl" size="60" value="<?=htmlspecialchars($pconfig['preauthurl']);?>" /><br />
601 060bc78b Renato Botelho
		<?php printf(gettext("Use this field to set \$PORTAL_REDIRURL\$ variable which can be accessed using your custom captive portal index.php page or error pages."));?>
602 a00e1d89 Scott Ullrich
	  </td>
603
	</tr>
604 5b237745 Scott Ullrich
	<tr>
605 ecc19349 Scott Ullrich
	  <td valign="top" class="vncell"><?=gettext("After authentication Redirection URL"); ?></td>
606 5b237745 Scott Ullrich
	  <td class="vtable">
607 73672832 Colin Fleming
		<input name="redirurl" type="text" class="formfld url" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>" />
608 8cd558b6 ayvis
		<br />
609 6fde5a1e Carlos Eduardo Ramos
<?=gettext("If you provide a URL here, clients will be redirected to that URL instead of the one they initially tried " .
610 16457bdd Renato Botelho
"to access after they've authenticated."); ?></td>
611 5b237745 Scott Ullrich
	</tr>
612 2f1548d6 Renato Botelho
	<tr>
613
		<td valign="top" class="vncell"><?=gettext("Blocked MAC address redirect URL"); ?> </td>
614
		<td class="vtable">
615 73672832 Colin Fleming
			<input name="blockedmacsurl" type="text" class="formfld url" id="blockedmacsurl" size="60" value="<?=htmlspecialchars($pconfig['blockedmacsurl']);?>" /><br />
616 2f1548d6 Renato Botelho
			<?php printf(gettext("If you provide a URL here, MAC addresses set to be blocked will be redirect to that URL when attempt to access anything."));?>
617
		</td>
618
	</tr>
619 5b237745 Scott Ullrich
	<tr>
620 6fde5a1e Carlos Eduardo Ramos
      <td valign="top" class="vncell"><?=gettext("Concurrent user logins"); ?></td>
621 0bd34ed6 Scott Ullrich
      <td class="vtable">
622 73672832 Colin Fleming
	<input name="noconcurrentlogins" type="checkbox" class="formfld" id="noconcurrentlogins" value="yes" <?php if ($pconfig['noconcurrentlogins']) echo "checked=\"checked\""; ?> />
623 8cd558b6 ayvis
	<strong><?=gettext("Disable concurrent logins"); ?></strong><br />
624 16457bdd Renato Botelho
	<?=gettext("If this option is set, only the most recent login per username will be active. Subsequent logins will cause machines previously logged in with the same username to be disconnected."); ?></td>
625 0bd34ed6 Scott Ullrich
	</tr>
626
	<tr>
627 6fde5a1e Carlos Eduardo Ramos
      <td valign="top" class="vncell"><?=gettext("MAC filtering"); ?> </td>
628 c980716e Scott Ullrich
      <td class="vtable">
629 73672832 Colin Fleming
        <input name="nomacfilter" type="checkbox" class="formfld" id="nomacfilter" value="yes" <?php if ($pconfig['nomacfilter']) echo "checked=\"checked\""; ?> />
630 8cd558b6 ayvis
        <strong><?=gettext("Disable MAC filtering"); ?></strong><br />
631 6fde5a1e Carlos Eduardo Ramos
    <?=gettext("If this option is set, no attempts will be made to ensure that the MAC address of clients stays the same while they're logged in." .
632 16457bdd Renato Botelho
    "This is required when the MAC address of the client cannot be determined (usually because there are routers between"); ?> <?php echo $g['product_name'] ?> <?=gettext("and the clients)."); ?>
633
    <?=gettext("If this is enabled, RADIUS MAC authentication cannot be used."); ?></td>
634 7e587bdb Scott Ullrich
	</tr>
635
	<tr>
636 6fde5a1e Carlos Eduardo Ramos
      <td valign="top" class="vncell"><?=gettext("Pass-through MAC Auto Entry"); ?></td>
637 6ce61a8f Ermal
      <td class="vtable">
638 73672832 Colin Fleming
        <input name="passthrumacadd" type="checkbox" class="formfld" id="passthrumacadd" value="yes" <?php if ($pconfig['passthrumacadd']) echo "checked=\"checked\""; ?> />
639 8cd558b6 ayvis
        <strong><?=gettext("Enable Pass-through MAC automatic additions"); ?></strong><br />
640 060bc78b Renato Botelho
    <?=gettext("If this option is set, a MAC passthrough entry is automatically added after the user has successfully authenticated. Users of that MAC address will never have to authenticate again."); ?>
641 ed8899b5 Renato Botelho
    <?=gettext("To remove the passthrough MAC entry you either have to log in and remove it manually from the"); ?> <a href="services_captiveportal_mac.php"><?=gettext("MAC tab"); ?></a> <?=gettext("or send a POST from another system to remove it."); ?>
642 16457bdd Renato Botelho
    <?=gettext("If this is enabled, RADIUS MAC authentication cannot be used. Also, the logout window will not be shown."); ?>
643 8cd558b6 ayvis
	<br /><br />
644 73672832 Colin Fleming
        <input name="passthrumacaddusername" type="checkbox" class="formfld" id="passthrumacaddusername" value="yes" <?php if ($pconfig['passthrumacaddusername']) echo "checked=\"checked\""; ?> />
645 8cd558b6 ayvis
        <strong><?=gettext("Enable Pass-through MAC automatic addition with username"); ?></strong><br />
646 16457bdd Renato Botelho
    <?=gettext("If this option is set, with the automatically MAC passthrough entry created the username, used during authentication, will be saved."); ?>
647 ed8899b5 Renato Botelho
    <?=gettext("To remove the passthrough MAC entry you either have to log in and remove it manually from the"); ?> <a href="services_captiveportal_mac.php"><?=gettext("MAC tab"); ?></a> <?=gettext("or send a POST from another system to remove it."); ?>
648 1c291e64 Ermal
	</td>
649 6ce61a8f Ermal
	</tr>
650
	<tr>
651 6fde5a1e Carlos Eduardo Ramos
      <td valign="top" class="vncell"><?=gettext("Per-user bandwidth restriction"); ?></td>
652 7e587bdb Scott Ullrich
      <td class="vtable">
653 73672832 Colin Fleming
        <input name="peruserbw" type="checkbox" class="formfld" id="peruserbw" value="yes" <?php if ($pconfig['peruserbw']) echo "checked=\"checked\""; ?> />
654 8cd558b6 ayvis
        <strong><?=gettext("Enable per-user bandwidth restriction"); ?></strong><br /><br />
655 73672832 Colin Fleming
        <table cellpadding="0" cellspacing="0" summary="bandwidth">
656 7e587bdb Scott Ullrich
        <tr>
657 6fde5a1e Carlos Eduardo Ramos
        <td><?=gettext("Default download"); ?></td>
658 73672832 Colin Fleming
        <td><input type="text" class="formfld unknown" name="bwdefaultdn" id="bwdefaultdn" size="10" value="<?=htmlspecialchars($pconfig['bwdefaultdn']);?>" /> <?=gettext("Kbit/s"); ?></td>
659 7e587bdb Scott Ullrich
        </tr>
660
        <tr>
661 6fde5a1e Carlos Eduardo Ramos
        <td><?=gettext("Default upload"); ?></td>
662 73672832 Colin Fleming
        <td><input type="text" class="formfld unknown" name="bwdefaultup" id="bwdefaultup" size="10" value="<?=htmlspecialchars($pconfig['bwdefaultup']);?>" /> <?=gettext("Kbit/s"); ?></td>
663 7e587bdb Scott Ullrich
        </tr></table>
664 8cd558b6 ayvis
        <br />
665 16457bdd Renato Botelho
        <?=gettext("If this option is set, the captive portal will restrict each user who logs in to the specified default bandwidth. RADIUS can override the default settings. Leave empty or set to 0 for no limit."); ?> </td>
666 7e587bdb Scott Ullrich
	</tr>
667 a5c0b6c7 Scott Ullrich
	<tr>
668 6fde5a1e Carlos Eduardo Ramos
	  <td width="22%" valign="top" class="vncell"><?=gettext("Authentication"); ?></td>
669 a5c0b6c7 Scott Ullrich
	  <td width="78%" class="vtable">
670 73672832 Colin Fleming
		<table cellpadding="0" cellspacing="0" summary="authentication">
671 c980716e Scott Ullrich
		<tr>
672 73672832 Colin Fleming
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="none" onclick="enable_change(false)" <?php if($pconfig['auth_method']!="local" && $pconfig['auth_method']!="radius") echo "checked=\"checked\""; ?> />
673 6fde5a1e Carlos Eduardo Ramos
  <?=gettext("No Authentication"); ?></td>
674 a8cb0038 Renato Botelho
		</tr>
675 c980716e Scott Ullrich
		<tr>
676 73672832 Colin Fleming
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="local" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="local") echo "checked=\"checked\""; ?> />
677 58f963d0 Scott Ullrich
  <?=gettext("Local"); ?> <a href="system_usermanager.php"><?=gettext("User Manager"); ?></a> / <?=gettext("Vouchers"); ?></td>
678 a8cb0038 Renato Botelho
		</tr>
679 73672832 Colin Fleming
		<tr>
680 a8cb0038 Renato Botelho
		  <td>&nbsp;</td>
681
		  <td>&nbsp;</td>
682
		</tr>
683 c980716e Scott Ullrich
		<tr>
684 a8cb0038 Renato Botelho
		  <td>&nbsp;</td>
685 73672832 Colin Fleming
		  <td><input name="localauth_priv" type="checkbox" id="localauth_priv" value="yes" onclick="enable_change(false)" <?php if($pconfig['localauth_priv']=="yes") echo "checked=\"checked\""; ?> />
686 a8cb0038 Renato Botelho
  <?=gettext("Allow only users/groups with 'Captive portal login' privilege set"); ?></td>
687
		</tr><tr>
688 73672832 Colin Fleming
		  <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="radius" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="radius") echo "checked=\"checked\""; ?> />
689 6fde5a1e Carlos Eduardo Ramos
  <?=gettext("RADIUS Authentication"); ?></td>
690 a8cb0038 Renato Botelho
		</tr><tr>
691 c980716e Scott Ullrich
		  <td>&nbsp;</td>
692
		  <td>&nbsp;</td>
693 a8cb0038 Renato Botelho
                </tr>
694 73672832 Colin Fleming
<tr>
695 b3765f4c Roberto Nunnari
                  <td width="22%" valign="top" class="vncell"><?=gettext("Radius Protocol"); ?></td>
696
                  <td width="78%" class="vtable">
697 73672832 Colin Fleming
                    <table cellpadding="0" cellspacing="0" summary="radius">
698 b3765f4c Roberto Nunnari
                    <tr>
699 73672832 Colin Fleming
                      <td colspan="2"><input name="radius_protocol" type="radio" id="radius_protocol" value="PAP" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="radius" && $pconfig['radius_protocol']!="CHAP_MD5" && $pconfig['radius_protocol']!="MSCHAPv1" && $pconfig['radius_protocol']!="MSCHAPv2") echo "checked=\"checked\""; ?> />
700 b3765f4c Roberto Nunnari
      <?=gettext("PAP"); ?></td>
701
                      </tr>
702
                    <tr>
703 73672832 Colin Fleming
                      <td colspan="2"><input name="radius_protocol" type="radio" id="radius_protocol" value="CHAP_MD5" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="radius" && $pconfig['radius_protocol']=="CHAP_MD5") echo "checked=\"checked\""; ?> />
704 b3765f4c Roberto Nunnari
      <?=gettext("CHAP_MD5"); ?></td>
705
                      </tr>
706
                    <tr>
707 73672832 Colin Fleming
                      <td colspan="2"><input name="radius_protocol" type="radio" id="radius_protocol" value="MSCHAPv1" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="radius" && $pconfig['radius_protocol']=="MSCHAPv1") echo "checked=\"checked\""; ?> />
708 b3765f4c Roberto Nunnari
      <?=gettext("MSCHAPv1"); ?></td>
709
                      </tr>
710
                    <tr>
711 73672832 Colin Fleming
                      <td colspan="2"><input name="radius_protocol" type="radio" id="radius_protocol" value="MSCHAPv2" onclick="enable_change(false)" <?php if($pconfig['auth_method']=="radius" && $pconfig['radius_protocol']=="MSCHAPv2") echo "checked=\"checked\""; ?> />
712 b3765f4c Roberto Nunnari
      <?=gettext("MSCHAPv2"); ?></td>
713
                      </tr><tr>
714
                      <td>&nbsp;</td>
715
                      <td>&nbsp;</td>
716
                      </tr>
717
                    </table>
718 73672832 Colin Fleming
                  </td>
719 b3765f4c Roberto Nunnari
                  </tr><tr>
720
                  <td>&nbsp;</td>
721
                  <td>&nbsp;</td>
722
                  </tr>
723
                </table>
724 73672832 Colin Fleming
		<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="primary athentication">
725 e12c63db Darren Embry
			<tr>
726
				<td colspan="2" valign="top" class="listtopic">Primary Authentication Source</td>
727
			</tr>
728
			<tr>
729
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Primary RADIUS server"); ?></td>
730 0bd34ed6 Scott Ullrich
			</tr>
731
			<tr>
732 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
733 73672832 Colin Fleming
				<td class="vtable"><input name="radiusip" type="text" class="formfld unknown" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>" /><br />
734 16457bdd Renato Botelho
				<?=gettext("Enter the IP address of the RADIUS server which users of the captive portal have to authenticate against."); ?></td>
735 0bd34ed6 Scott Ullrich
			</tr>
736
			<tr>
737 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
738 73672832 Colin Fleming
				<td class="vtable"><input name="radiusport" type="text" class="formfld unknown" id="radiusport" size="5" value="<?=htmlspecialchars($pconfig['radiusport']);?>" /><br />
739 16457bdd Renato Botelho
				 <?=gettext("Leave this field blank to use the default port (1812)."); ?></td>
740 0bd34ed6 Scott Ullrich
			</tr>
741
			<tr>
742 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
743 73672832 Colin Fleming
				<td class="vtable"><input name="radiuskey" type="text" class="formfld unknown" id="radiuskey" size="16" value="<?=htmlspecialchars($pconfig['radiuskey']);?>" /><br />
744 16457bdd Renato Botelho
				<?=gettext("Leave this field blank to not use a RADIUS shared secret (not recommended)."); ?></td>
745 0bd34ed6 Scott Ullrich
			</tr>
746 a5c0b6c7 Scott Ullrich
			<tr>
747 0bd34ed6 Scott Ullrich
			  <td colspan="2" class="list" height="12"></td>
748
			</tr>
749
			<tr>
750 6fde5a1e Carlos Eduardo Ramos
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Secondary RADIUS server"); ?></td>
751 0bd34ed6 Scott Ullrich
			</tr>
752
			<tr>
753 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
754 73672832 Colin Fleming
				<td class="vtable"><input name="radiusip2" type="text" class="formfld unknown" id="radiusip2" size="20" value="<?=htmlspecialchars($pconfig['radiusip2']);?>" /><br />
755 16457bdd Renato Botelho
				<?=gettext("If you have a second RADIUS server, you can activate it by entering its IP address here."); ?></td>
756 0bd34ed6 Scott Ullrich
			</tr>
757
			<tr>
758 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
759 73672832 Colin Fleming
				<td class="vtable"><input name="radiusport2" type="text" class="formfld unknown" id="radiusport2" size="5" value="<?=htmlspecialchars($pconfig['radiusport2']);?>" /></td>
760 0bd34ed6 Scott Ullrich
			</tr>
761
			<tr>
762 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
763 73672832 Colin Fleming
				<td class="vtable"><input name="radiuskey2" type="text" class="formfld unknown" id="radiuskey2" size="16" value="<?=htmlspecialchars($pconfig['radiuskey2']);?>" /></td>
764 0bd34ed6 Scott Ullrich
			</tr>
765
			<tr>
766
			  <td colspan="2" class="list" height="12"></td>
767
			</tr>
768 ebc0e4b6 Ermal
			<tr>
769 e12c63db Darren Embry
				<td colspan="2" valign="top" class="listtopic">Secondary Authentication Source</td>
770
			</tr>
771
			<tr>
772
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Primary RADIUS server"); ?></td>
773 ebc0e4b6 Ermal
			</tr>
774
			<tr>
775
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
776 73672832 Colin Fleming
				<td class="vtable"><input name="radiusip3" type="text" class="formfld unknown" id="radiusip3" size="20" value="<?=htmlspecialchars($pconfig['radiusip3']);?>" /><br />
777 d568e38d Scott Ullrich
				<?=gettext("If you have a third RADIUS server, you can activate it by entering its IP address here."); ?></td>
778 ebc0e4b6 Ermal
			</tr>
779
			<tr>
780
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
781 73672832 Colin Fleming
				<td class="vtable"><input name="radiusport3" type="text" class="formfld unknown" id="radiusport3" size="5" value="<?=htmlspecialchars($pconfig['radiusport3']);?>" /></td>
782 ebc0e4b6 Ermal
			</tr>
783
			<tr>
784
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
785 73672832 Colin Fleming
				<td class="vtable"><input name="radiuskey3" type="text" class="formfld unknown" id="radiuskey3" size="16" value="<?=htmlspecialchars($pconfig['radiuskey3']);?>" /></td>
786 ebc0e4b6 Ermal
			</tr>
787
			<tr>
788
			  <td colspan="2" class="list" height="12"></td>
789
			</tr>
790
			<tr>
791 e12c63db Darren Embry
				<td colspan="2" valign="top" class="optsect_t2"><?=gettext("Secondary RADIUS server"); ?></td>
792 ebc0e4b6 Ermal
			</tr>
793
			<tr>
794
				<td class="vncell" valign="top"><?=gettext("IP address"); ?></td>
795 73672832 Colin Fleming
				<td class="vtable"><input name="radiusip4" type="text" class="formfld unknown" id="radiusip4" size="20" value="<?=htmlspecialchars($pconfig['radiusip4']);?>" /><br />
796 d568e38d Scott Ullrich
				<?=gettext("If you have a fourth RADIUS server, you can activate it by entering its IP address here."); ?></td>
797 ebc0e4b6 Ermal
			</tr>
798
			<tr>
799
				<td class="vncell" valign="top"><?=gettext("Port"); ?></td>
800 73672832 Colin Fleming
				<td class="vtable"><input name="radiusport4" type="text" class="formfld unknown" id="radiusport4" size="5" value="<?=htmlspecialchars($pconfig['radiusport4']);?>" /></td>
801 ebc0e4b6 Ermal
			</tr>
802
			<tr>
803
				<td class="vncell" valign="top"><?=gettext("Shared secret"); ?>&nbsp;&nbsp;</td>
804 73672832 Colin Fleming
				<td class="vtable"><input name="radiuskey4" type="text" class="formfld unknown" id="radiuskey4" size="16" value="<?=htmlspecialchars($pconfig['radiuskey4']);?>" /></td>
805 ebc0e4b6 Ermal
			</tr>
806
			<tr>
807
			  <td colspan="2" class="list" height="12"></td>
808
			</tr>
809 e12c63db Darren Embry
			<tr>
810 4cc94535 Michael Newton
				<td colspan="2" valign="top" class="listtopic"><?=gettext("Accounting"); ?></td>
811 856e58a6 Scott Ullrich
			</tr>
812
			<tr>
813
				<td class="vncell">&nbsp;</td>
814 73672832 Colin Fleming
				<td class="vtable"><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" onclick="enable_change(false)" <?php if($pconfig['radacct_enable']) echo "checked=\"checked\""; ?> />
815 8cd558b6 ayvis
				<strong><?=gettext("send RADIUS accounting packets"); ?></strong><br />
816 16457bdd Renato Botelho
				<?=gettext("If this is enabled, RADIUS accounting packets will be sent to the primary RADIUS server."); ?></td>
817 856e58a6 Scott Ullrich
			</tr>
818
			<tr>
819 6fde5a1e Carlos Eduardo Ramos
			  <td class="vncell" valign="top"><?=gettext("Accounting port"); ?></td>
820 73672832 Colin Fleming
			  <td class="vtable"><input name="radiusacctport" type="text" class="formfld unknown" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>" /><br />
821 16457bdd Renato Botelho
			  <?=gettext("Leave blank to use the default port (1813)."); ?></td>
822 856e58a6 Scott Ullrich
			  </tr>
823
			<tr>
824
			  <td colspan="2" class="list" height="12"></td>
825
			</tr>
826
			<tr>
827 6fde5a1e Carlos Eduardo Ramos
			  <td class="vncell" valign="top"><?=gettext("Accounting updates"); ?></td>
828 856e58a6 Scott Ullrich
			  <td class="vtable">
829 73672832 Colin Fleming
			  <input name="reauthenticateacct" type="radio" value="" <?php if(!$pconfig['reauthenticateacct']) echo "checked=\"checked\""; ?> /> <?=gettext("no accounting updates"); ?><br />
830
			  <input name="reauthenticateacct" type="radio" value="stopstart" <?php if($pconfig['reauthenticateacct'] == "stopstart") echo "checked=\"checked\""; ?> /> <?=gettext("stop/start accounting"); ?><br />
831
			  <input name="reauthenticateacct" type="radio" value="interimupdate" <?php if($pconfig['reauthenticateacct'] == "interimupdate") echo "checked=\"checked\""; ?> /> <?=gettext("interim update"); ?>
832 856e58a6 Scott Ullrich
			  </td>
833
			</tr>
834
			<tr>
835
			  <td colspan="2" class="list" height="12"></td>
836
			</tr>
837 0bd34ed6 Scott Ullrich
			<tr>
838 d7fe2e7a Michael Newton
				<td colspan="2" valign="top" class="listtopic"><?=gettext("RADIUS options"); ?></td>
839 0bd34ed6 Scott Ullrich
			</tr>
840
			<tr>
841 d7fe2e7a Michael Newton
				<td class="vncell"><?=gettext("Reauthentication"); ?></td>
842 73672832 Colin Fleming
				<td class="vtable"><input name="reauthenticate" type="checkbox" id="reauthenticate" value="yes" onclick="enable_change(false)" <?php if($pconfig['reauthenticate']) echo "checked=\"checked\""; ?> />
843 8cd558b6 ayvis
				<strong><?=gettext("Reauthenticate connected users every minute"); ?></strong><br />
844 d7fe2e7a Michael Newton
				<?=gettext("If reauthentication is enabled, Access-Requests will be sent to the RADIUS server for each user that is " .
845
				"logged in every minute. If an Access-Reject is received for a user, that user is disconnected from the captive portal immediately."); ?></td>
846
			</tr>
847
			<tr>
848
				<td class=""><?=gettext("RADIUS MAC authentication"); ?></td>
849
				<td class="">
850 73672832 Colin Fleming
				<input name="radmac_enable" type="checkbox" id="radmac_enable" value="yes" onclick="enable_change(false)" <?php if ($pconfig['radmac_enable']) echo "checked=\"checked\""; ?> /><strong><?=gettext("Enable RADIUS MAC authentication"); ?></strong><br />
851 6fde5a1e Carlos Eduardo Ramos
				<?=gettext("If this option is enabled, the captive portal will try to authenticate users by sending their MAC address as the username and the password " .
852 16457bdd Renato Botelho
				"entered below to the RADIUS server."); ?></td>
853 0bd34ed6 Scott Ullrich
			</tr>
854
			<tr>
855 d7fe2e7a Michael Newton
				<td class="vncell"><?=gettext("MAC authentication secret"); ?></td>
856 73672832 Colin Fleming
				<td class="vtable"><input name="radmac_secret" type="text" class="formfld unknown" id="radmac_secret" size="16" value="<?=htmlspecialchars($pconfig['radmac_secret']);?>" /></td>
857 0bd34ed6 Scott Ullrich
			</tr>
858 822b687b Ermal
			<tr>
859 d440e668 Chris Buechler
				<td class="vncell" valign="top"><?=gettext("RADIUS NAS IP attribute"); ?></td>
860 720498a0 Michael Newton
				<td class="vtable">
861 822b687b Ermal
				<select name="radiussrcip_attribute" id="radiussrcip_attribute">
862
				<?php $iflist = get_configured_interface_with_descr();
863
					foreach ($iflist as $ifdesc => $ifdescr) {
864
						$ipaddr = get_interface_ip($ifdesc);
865
						if (is_ipaddr($ipaddr)) {
866
							$selected = "";
867 50779708 Ermal
							if ($ifdesc == $pconfig['radiussrcip_attribute'])
868 73672832 Colin Fleming
								$selected= "selected=\"selected\"";
869 822b687b Ermal
							echo "<option value='{$ifdesc}' {$selected}>{$ifdescr} - {$ipaddr}</option>\n";
870
						}
871
					}
872 34e9ca60 Ermal
					if (is_array($config['virtualip']['vip'])) {
873 060bc78b Renato Botelho
						foreach ($config['virtualip']['vip'] as $sn) {
874
							if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
875
								$start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
876
								$end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
877
								$len = $end - $start;
878
879
								for ($i = 0; $i <= $len; $i++) {
880
									$snip = long2ip32($start+$i);
881
									echo "<option value='{$snip}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$snip}") . "></option>\n";
882 34e9ca60 Ermal
								}
883
							} else
884 060bc78b Renato Botelho
								echo "<option value='{$sn['subnet']}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$sn['subnet']}") . "></option>\n";
885 34e9ca60 Ermal
						}
886
					}
887 822b687b Ermal
				?>
888 8cd558b6 ayvis
				</select><br />
889 375828d9 Chris Buechler
				<?=gettext("Choose the IP to use for calling station attribute."); ?>
890 822b687b Ermal
				</td>
891
			</tr>
892
893 0bd34ed6 Scott Ullrich
			<tr>
894 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Session-Timeout"); ?></td>
895 73672832 Colin Fleming
				<td class="vtable"><input name="radiussession_timeout" type="checkbox" id="radiussession_timeout" value="yes" <?php if ($pconfig['radiussession_timeout']) echo "checked=\"checked\""; ?> /><strong><?=gettext("Use RADIUS Session-Timeout attributes"); ?></strong><br />
896 16457bdd Renato Botelho
				<?=gettext("When this is enabled, clients will be disconnected after the amount of time retrieved from the RADIUS Session-Timeout attribute."); ?></td>
897 0bd34ed6 Scott Ullrich
			</tr>
898 cf0542ac Scott Ullrich
899 0bd34ed6 Scott Ullrich
			<tr>
900 6fde5a1e Carlos Eduardo Ramos
				<td class="vncell" valign="top"><?=gettext("Type"); ?></td>
901 0bd34ed6 Scott Ullrich
				<td class="vtable"><select name="radiusvendor" id="radiusvendor">
902 eafb21b3 Phil Davis
				<option value="default"><?php echo gettext("default"); ?></option>
903 a5c0b6c7 Scott Ullrich
				<?php
904 0bd34ed6 Scott Ullrich
				$radiusvendors = array("cisco");
905
				foreach ($radiusvendors as $radiusvendor){
906
					if ($pconfig['radiusvendor'] == $radiusvendor)
907 73672832 Colin Fleming
						echo "<option selected=\"selected\" value=\"$radiusvendor\">$radiusvendor</option>\n";
908 0bd34ed6 Scott Ullrich
					else
909
						echo "<option value=\"$radiusvendor\">$radiusvendor</option>\n";
910
				}
911 8cd558b6 ayvis
				?></select><br />
912 3b7f0f53 Erik Fonnesbeck
				<?php printf(gettext("If RADIUS type is set to Cisco, in Access-Requests the value of Calling-Station-Id will be set to the client's IP address and " .
913
				"the Called-Station-Id to the client's MAC address. Default behavior is Calling-Station-Id = client's MAC address and Called-Station-Id = %s's WAN IP address."),
914 16457bdd Renato Botelho
					$g['product_name']);?></td>
915 0bd34ed6 Scott Ullrich
			</tr>
916 720498a0 Michael Newton
917
			<tr>
918
				<td class="vncell" valign="top"><?=gettext("Accounting Style"); ?></td>
919 73672832 Colin Fleming
				<td class="vtable"><input name="reverseacct" type="checkbox" id="reverseacct" value="yes" <?php if ($pconfig['reverseacct']) echo "checked=\"checked\""; ?> /><strong><?=gettext("Invert Acct-Input-Octets and Acct-Output-Octets"); ?></strong><br />
920 720498a0 Michael Newton
				<?=gettext("When this is enabled, data counts for RADIUS accounting packets will be taken from the client perspective, not the NAS. Acct-Input-Octets will represent download, and Acct-Output-Octets will represent upload."); ?></td>
921
			</tr>
922 4cc94535 Michael Newton
923
			<tr>
924
				<td class="vncell" valign="top"><?=gettext("NAS Identifier"); ?></td>
925 73672832 Colin Fleming
				<td class="vtable"><input name="radiusnasid" type="text" maxlength="253" class="formfld unknown" id="radiusnasid" value="<?=htmlspecialchars($pconfig['radiusnasid']);?>" /><br />
926 89b1c40c Michael Newton
					<?=gettext("Specify a NAS identifier to override the default value") . " (" . php_uname("n") . ")"; ?></td>
927 4cc94535 Michael Newton
			</tr>
928 d7fe2e7a Michael Newton
			<tr>
929
				<td class="vncell" valign="top"><?=gettext("MAC address format"); ?></td>
930
				<td class="vtable">
931
					<select name="radmac_format" id="radmac_format">
932
						<option value="default"><?php echo gettext("default"); ?></option>
933
						<?php
934
						$macformats = array("singledash","ietf","cisco","unformatted");
935
						foreach ($macformats as $macformat) {
936
							if ($pconfig['radmac_format'] == $macformat) {
937 73672832 Colin Fleming
								echo "<option selected=\"selected\" value=\"$macformat\">",gettext($macformat),"</option>\n";
938 d7fe2e7a Michael Newton
							} else {
939
								echo "<option value=\"$macformat\">",gettext($macformat),"</option>\n";
940
							}
941
						}
942
						?>
943 8cd558b6 ayvis
					</select><br />
944 d7fe2e7a Michael Newton
					<?=gettext("This option changes the MAC address format used in the whole RADIUS system. Change this if you also"); ?>
945 8cd558b6 ayvis
					<?=gettext("need to change the username format for RADIUS MAC authentication."); ?><br />
946
					<?=gettext("default:"); ?> 00:11:22:33:44:55<br />
947
					<?=gettext("singledash:"); ?> 001122-334455<br />
948
					<?=gettext("ietf:"); ?> 00-11-22-33-44-55<br />
949
					<?=gettext("cisco:"); ?> 0011.2233.4455<br />
950 d7fe2e7a Michael Newton
					<?=gettext("unformatted:"); ?> 001122334455
951
				</td>
952
			</tr>
953 0bd34ed6 Scott Ullrich
		</table>
954 73672832 Colin Fleming
		</td>
955 5b237745 Scott Ullrich
	</tr>
956
	<tr>
957 d7fe2e7a Michael Newton
		<td valign="top" class="vncell"><?=gettext("HTTPS login"); ?></td>
958
		<td class="vtable">
959 73672832 Colin Fleming
			<input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" onclick="enable_change(false)" <?php if($pconfig['httpslogin_enable']) echo "checked=\"checked\""; ?> />
960 8cd558b6 ayvis
			<strong><?=gettext("Enable HTTPS login"); ?></strong><br />
961 d7fe2e7a Michael Newton
			<?=gettext("If enabled, the username and password will be transmitted over an HTTPS connection to protect against eavesdroppers. A server name and certificate must also be specified below."); ?></td>
962 36f6ed35 bcyrill
	</tr>
963 5b237745 Scott Ullrich
	<tr>
964 d7fe2e7a Michael Newton
		<td valign="top" class="vncell"><?=gettext("HTTPS server name"); ?> </td>
965
		<td class="vtable">
966 73672832 Colin Fleming
			<input name="httpsname" type="text" class="formfld unknown" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>" /><br />
967 d7fe2e7a Michael Newton
			<?php printf(gettext("This name will be used in the form action for the HTTPS POST and should match the Common Name (CN) in your certificate (otherwise, the client browser will most likely display a security warning). Make sure captive portal clients can resolve this name in DNS and verify on the client that the IP resolves to the correct interface IP on %s."), $g['product_name']);?> </td>
968 36f6ed35 bcyrill
	</tr>
969 adca02c4 bcyrill
	<tr id="ssl_opts">
970
		<td width="22%" valign="top" class="vncell"><?=gettext("SSL Certificate"); ?></td>
971
		<td width="78%" class="vtable">
972
			<?php if (count($a_cert)): ?>
973
			<select name="certref" id="certref" class="formselect">
974
				<?php
975
					foreach($a_cert as $cert):
976
						$selected = "";
977
						if ($pconfig['certref'] == $cert['refid'])
978 fbe0c5ff Colin Fleming
							$selected = " selected=\"selected\"";
979 adca02c4 bcyrill
				?>
980
				<option value="<?=$cert['refid'];?>"<?=$selected;?>><?=$cert['descr'];?></option>
981
			<?php endforeach; ?>
982
			</select>
983
			<?php else: ?>
984 8cd558b6 ayvis
				<b><?=gettext("No Certificates defined."); ?></b> <br />Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
985 adca02c4 bcyrill
			<?php endif; ?>
986
		</td>
987
	</tr>
988 b7b461fc derelict-pf
	<tr>
989
		<td valign="top" class="vncell"><?=gettext("Disable HTTPS forwards"); ?></td>
990
		<td class="vtable">
991 fbe0c5ff Colin Fleming
			<input name="nohttpsforwards" type="checkbox" class="formfld" id="nohttpsforwards" value="yes" <?php if ($pconfig['nohttpsforwards']) echo "checked=\"checked\""; ?> />
992
			<strong><?=gettext("Disable HTTPS forwards"); ?></strong><br/>
993 b7b461fc derelict-pf
			<?=gettext("If this option is set, attempts to connect to SSL/HTTPS (Port 443) sites will not be forwarded to the captive portal.  This prevents certificate errors from being presented to the user even if HTTPS logins are enabled.  Users must attempt a connecton to an HTTP (Port 80) site to get forwarded to the captive portal. If HTTPS logins are enabled, the user will be redirected to the HTTPS login page."); ?></td>
994
	</tr>
995 a5c0b6c7 Scott Ullrich
	<tr>
996 adca02c4 bcyrill
		<td width="22%" valign="top" class="vncell"><?=gettext("Portal page contents"); ?></td>
997
		<td width="78%" class="vtable">
998 73672832 Colin Fleming
		<?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld file" id="htmlfile" /><br />
999 16f5fe76 Scott Ullrich
		<?php
1000
			list($host) = explode(":", $_SERVER['HTTP_HOST']);
1001 470d24a3 Darren Embry
			$zoneid = $pconfig['zoneid'] ? $pconfig['zoneid'] : 8000;
1002 36f6ed35 bcyrill
			if ($pconfig['httpslogin_enable']) {
1003 5b4ed0e1 Chris Buechler
				$port = $pconfig['listenporthttps'] ? $pconfig['listenporthttps'] : ($zoneid + 8001);
1004 470d24a3 Darren Embry
				$href = "https://{$host}:{$port}";
1005 16f5fe76 Scott Ullrich
			} else {
1006 5b4ed0e1 Chris Buechler
				$port = $pconfig['listenporthttp']  ? $pconfig['listenporthttp']  : ($zoneid + 8000);
1007 470d24a3 Darren Embry
				$href = "http://{$host}:{$port}";
1008 a5c0b6c7 Scott Ullrich
			}
1009 16f5fe76 Scott Ullrich
		?>
1010 b4792bf8 Ermal
		<?php if ($pconfig['page']['htmltext']): ?>
1011 73672832 Colin Fleming
		<a href="<?=$href?>" target="_blank"><?=gettext("View current page"); ?></a>
1012 aa87cf11 Renato Botelho
		<br />
1013
		<a href="?zone=<?=$cpzone?>&amp;act=gethtmlhtml" target="_blank"><?=gettext("Download current page"); ?></a>
1014 92603e27 Renato Botelho
		<br />
1015
		<a href="?zone=<?=$cpzone?>&amp;act=delhtmlhtml" onclick="return confirm('Do you really want to restore default page?')" target="_blank">
1016
			<?=gettext("Restore default portal page"); ?>
1017
		</a>
1018 8cd558b6 ayvis
		  <br />
1019
		  <br />
1020 5b237745 Scott Ullrich
		<?php endif; ?>
1021 3b7f0f53 Erik Fonnesbeck
			<?php
1022 16457bdd Renato Botelho
				printf(
1023 3b7f0f53 Erik Fonnesbeck
					gettext('Upload an HTML/PHP file for the portal page here (leave blank to keep the current one). ' .
1024
							'Make sure to include a form (POST to %1$s) with a submit button (%2$s) and a hidden field with %3$s and %4$s. ' .
1025
							'Include the %5$s and %6$s and/or %7$s input fields if authentication is enabled, otherwise it will always fail.'),
1026 cfec8558 Renato Botelho
					'&quot;$PORTAL_ACTION$&quot;',
1027 16457bdd Renato Botelho
					"name=&quot;accept&quot;",
1028
					"name=&quot;redirurl&quot;",
1029 cfec8558 Renato Botelho
					'value=&quot;$PORTAL_REDIRURL$&quot;',
1030 16457bdd Renato Botelho
					"&quot;auth_user&quot;",
1031
					"&quot;auth_pass&quot;",
1032
					"&quot;auth_voucher&quot;");
1033
			?>
1034 8cd558b6 ayvis
			<?=gettext("Example code for the form:"); ?><br />
1035
		  <br />
1036
		  <tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br />
1037
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br />
1038
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_pass&quot; type=&quot;password&quot;&gt;<br />
1039
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_voucher&quot; type=&quot;text&quot;&gt;<br />
1040
		  &nbsp;&nbsp;&nbsp;&lt;input name=&quot;redirurl&quot; type=&quot;hidden&quot; value=&quot;$PORTAL_REDIRURL$&quot;&gt;<br />
1041
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;accept&quot; type=&quot;submit&quot; value=&quot;Continue&quot;&gt;<br />
1042 5b237745 Scott Ullrich
		  &lt;/form&gt;</tt></td>
1043
	</tr>
1044
	<tr>
1045 8cd558b6 ayvis
	  <td width="22%" valign="top" class="vncell"><?=gettext("Authentication"); ?><br />
1046
		<?=gettext("error page"); ?><br />
1047 6fde5a1e Carlos Eduardo Ramos
		<?=gettext("contents"); ?></td>
1048 5b237745 Scott Ullrich
	  <td class="vtable">
1049 73672832 Colin Fleming
		<input name="errfile" type="file" class="formfld file" id="errfile" /><br />
1050 b4792bf8 Ermal
		<?php if ($pconfig['page']['errtext']): ?>
1051 a636682d bcyrill
		<a href="?zone=<?=$cpzone?>&amp;act=viewerrhtml" target="_blank"><?=gettext("View current page"); ?></a>
1052 aa87cf11 Renato Botelho
		<br />
1053
		<a href="?zone=<?=$cpzone?>&amp;act=geterrhtml" target="_blank"><?=gettext("Download current page"); ?></a>
1054 92603e27 Renato Botelho
		<br />
1055
		<a href="?zone=<?=$cpzone?>&amp;act=delerrhtml" onclick="return confirm('Do you really want to restore default page?')" target="_blank">
1056
			<?=gettext("Restore default error page"); ?>
1057
		</a>
1058 8cd558b6 ayvis
		  <br />
1059
		  <br />
1060 5b237745 Scott Ullrich
		<?php endif; ?>
1061 6fde5a1e Carlos Eduardo Ramos
<?=gettext("The contents of the HTML/PHP file that you upload here are displayed when an authentication error occurs. " .
1062 16457bdd Renato Botelho
"You may include"); ?> &quot;$PORTAL_MESSAGE$&quot;, <?=gettext("which will be replaced by the error or reply messages from the RADIUS server, if any."); ?></td>
1063 5b87b24e Ermal
	</tr>
1064
	<tr>
1065 8cd558b6 ayvis
	  <td width="22%" valign="top" class="vncell"><?=gettext("Logout"); ?><br />
1066
		<?=gettext("page"); ?><br />
1067 6fde5a1e Carlos Eduardo Ramos
		<?=gettext("contents"); ?></td>
1068 5b87b24e Ermal
	  <td class="vtable">
1069 73672832 Colin Fleming
		<input name="logoutfile" type="file" class="formfld file" id="logoutfile" /><br />
1070 b4792bf8 Ermal
		<?php if ($pconfig['page']['logouttext']): ?>
1071 a636682d bcyrill
		<a href="?zone=<?=$cpzone?>&amp;act=viewlogouthtml" target="_blank"><?=gettext("View current page"); ?></a>
1072 aa87cf11 Renato Botelho
		<br />
1073
		<a href="?zone=<?=$cpzone?>&amp;act=getlogouthtml" target="_blank"><?=gettext("Download current page"); ?></a>
1074 92603e27 Renato Botelho
		<br />
1075
		<a href="?zone=<?=$cpzone?>&amp;act=dellogouthtml" onclick="return confirm('Do you really want to restore default page?')" target="_blank">
1076
			<?=gettext("Restore default logout page"); ?>
1077
		</a>
1078 8cd558b6 ayvis
		  <br />
1079
		  <br />
1080 5b87b24e Ermal
		<?php endif; ?>
1081 a36e98ff Erik Fonnesbeck
<?=gettext("The contents of the HTML/PHP file that you upload here are displayed on authentication success when the logout popup is enabled."); ?></td>
1082 5b237745 Scott Ullrich
	</tr>
1083 a5c0b6c7 Scott Ullrich
	<tr>
1084 5b237745 Scott Ullrich
	  <td width="22%" valign="top">&nbsp;</td>
1085 a5c0b6c7 Scott Ullrich
	  <td width="78%">
1086 73672832 Colin Fleming
		<?php echo "<input name='zone' id='zone' type='hidden' value='" . htmlspecialchars($cpzone) . "' />"; ?>
1087
		<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
1088
		<a href="services_captiveportal_zones.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="enable_change(true)" /></a>
1089 5b237745 Scott Ullrich
	  </td>
1090
	</tr>
1091 a5c0b6c7 Scott Ullrich
	<tr>
1092 5b237745 Scott Ullrich
	  <td width="22%" valign="top">&nbsp;</td>
1093 8cd558b6 ayvis
	  <td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br />
1094 16457bdd Renato Botelho
		</strong></span><?=gettext("Changing any settings on this page will disconnect all clients! Don't forget to enable the DHCP server on your captive portal interface! Make sure that the default/maximum DHCP lease time is higher than the timeout entered on this page. Also, the DNS forwarder needs to be enabled for DNS lookups by unauthenticated clients to work."); ?> </span></td>
1095 5b237745 Scott Ullrich
	</tr>
1096
  </table>
1097
  </td>
1098
  </tr>
1099
  </table>
1100
</form>
1101 91f026b0 ayvis
<script type="text/javascript">
1102 73672832 Colin Fleming
//<![CDATA[
1103 5b237745 Scott Ullrich
enable_change(false);
1104 73672832 Colin Fleming
//]]>
1105 5b237745 Scott Ullrich
</script>
1106
<?php include("fend.inc"); ?>
1107 93588e1a Scott Dale
</body>
1108 b7b461fc derelict-pf
</html>