Project

General

Profile

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