1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
07bd3f83
|
Scott Ullrich
|
<?php
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
services_captiveportal.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
07bd3f83
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
07bd3f83
|
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 |
07bd3f83
|
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 |
07bd3f83
|
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 |
07bd3f83
|
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 |
|
|
|
32 |
|
|
require("guiconfig.inc");
|
33 |
|
|
|
34 |
|
|
if (!is_array($config['captiveportal'])) {
|
35 |
|
|
$config['captiveportal'] = array();
|
36 |
|
|
$config['captiveportal']['page'] = array();
|
37 |
|
|
$config['captiveportal']['timeout'] = 60;
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
if ($_GET['act'] == "viewhtml") {
|
41 |
|
|
echo base64_decode($config['captiveportal']['page']['htmltext']);
|
42 |
|
|
exit;
|
43 |
|
|
} else if ($_GET['act'] == "viewerrhtml") {
|
44 |
|
|
echo base64_decode($config['captiveportal']['page']['errtext']);
|
45 |
|
|
exit;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
$pconfig['cinterface'] = $config['captiveportal']['interface'];
|
49 |
|
|
$pconfig['timeout'] = $config['captiveportal']['timeout'];
|
50 |
|
|
$pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
|
51 |
|
|
$pconfig['enable'] = isset($config['captiveportal']['enable']);
|
52 |
|
|
$pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
|
53 |
|
|
$pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
|
54 |
|
|
$pconfig['httpsname'] = $config['captiveportal']['httpsname'];
|
55 |
|
|
$pconfig['cert'] = base64_decode($config['captiveportal']['certificate']);
|
56 |
|
|
$pconfig['key'] = base64_decode($config['captiveportal']['private-key']);
|
57 |
|
|
$pconfig['logoutwin_enable'] = isset($config['captiveportal']['logoutwin_enable']);
|
58 |
|
|
$pconfig['nomacfilter'] = isset($config['captiveportal']['nomacfilter']);
|
59 |
|
|
$pconfig['redirurl'] = $config['captiveportal']['redirurl'];
|
60 |
|
|
$pconfig['radiusip'] = $config['captiveportal']['radiusip'];
|
61 |
|
|
$pconfig['radiusport'] = $config['captiveportal']['radiusport'];
|
62 |
|
|
$pconfig['radiusacctport'] = $config['captiveportal']['radiusacctport'];
|
63 |
|
|
$pconfig['radiuskey'] = $config['captiveportal']['radiuskey'];
|
64 |
|
|
|
65 |
|
|
if ($_POST) {
|
66 |
|
|
|
67 |
|
|
unset($input_errors);
|
68 |
|
|
$pconfig = $_POST;
|
69 |
|
|
|
70 |
|
|
/* input validation */
|
71 |
|
|
if ($_POST['enable']) {
|
72 |
|
|
$reqdfields = explode(" ", "cinterface");
|
73 |
|
|
$reqdfieldsn = explode(",", "Interface");
|
74 |
07bd3f83
|
Scott Ullrich
|
|
75 |
5b237745
|
Scott Ullrich
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
76 |
07bd3f83
|
Scott Ullrich
|
|
77 |
5b237745
|
Scott Ullrich
|
/* make sure no interfaces are bridged */
|
78 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
79 |
|
|
$coptif = &$config['interfaces']['opt' . $i];
|
80 |
|
|
if (isset($coptif['enable']) && $coptif['bridge']) {
|
81 |
|
|
$input_errors[] = "The captive portal cannot be used when one or more interfaces are bridged.";
|
82 |
|
|
break;
|
83 |
|
|
}
|
84 |
|
|
}
|
85 |
07bd3f83
|
Scott Ullrich
|
|
86 |
5b237745
|
Scott Ullrich
|
if ($_POST['httpslogin_enable']) {
|
87 |
|
|
if (!$_POST['cert'] || !$_POST['key']) {
|
88 |
|
|
$input_errors[] = "Certificate and key must be specified for HTTPS login.";
|
89 |
|
|
} else {
|
90 |
|
|
if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
|
91 |
|
|
$input_errors[] = "This certificate does not appear to be valid.";
|
92 |
|
|
if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
|
93 |
|
|
$input_errors[] = "This key does not appear to be valid.";
|
94 |
|
|
}
|
95 |
07bd3f83
|
Scott Ullrich
|
|
96 |
5b237745
|
Scott Ullrich
|
if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
|
97 |
|
|
$input_errors[] = "The HTTPS server name must be specified for HTTPS login.";
|
98 |
|
|
}
|
99 |
|
|
}
|
100 |
|
|
}
|
101 |
07bd3f83
|
Scott Ullrich
|
|
102 |
5b237745
|
Scott Ullrich
|
if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
|
103 |
|
|
$input_errors[] = "The timeout must be at least 1 minute.";
|
104 |
|
|
}
|
105 |
|
|
if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
|
106 |
|
|
$input_errors[] = "The idle timeout must be at least 1 minute.";
|
107 |
|
|
}
|
108 |
|
|
if (($_POST['radiusip'] && !is_ipaddr($_POST['radiusip']))) {
|
109 |
|
|
$input_errors[] = "A valid IP address must be specified. [".$_POST['radiusip']."]";
|
110 |
|
|
}
|
111 |
|
|
if (($_POST['radiusport'] && !is_port($_POST['radiusport']))) {
|
112 |
|
|
$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
|
113 |
|
|
}
|
114 |
|
|
if (($_POST['radiusacctport'] && !is_port($_POST['radiusacctport']))) {
|
115 |
|
|
$input_errors[] = "A valid port number must be specified. [".$_POST['radiusport']."]";
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
if (!$input_errors) {
|
119 |
|
|
$config['captiveportal']['interface'] = $_POST['cinterface'];
|
120 |
|
|
$config['captiveportal']['timeout'] = $_POST['timeout'];
|
121 |
|
|
$config['captiveportal']['idletimeout'] = $_POST['idletimeout'];
|
122 |
|
|
$config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
|
123 |
|
|
$config['captiveportal']['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
|
124 |
|
|
$config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
|
125 |
|
|
$config['captiveportal']['httpsname'] = $_POST['httpsname'];
|
126 |
|
|
$config['captiveportal']['certificate'] = base64_encode($_POST['cert']);
|
127 |
|
|
$config['captiveportal']['private-key'] = base64_encode($_POST['key']);
|
128 |
|
|
$config['captiveportal']['logoutwin_enable'] = $_POST['logoutwin_enable'] ? true : false;
|
129 |
|
|
$config['captiveportal']['nomacfilter'] = $_POST['nomacfilter'] ? true : false;
|
130 |
|
|
$config['captiveportal']['redirurl'] = $_POST['redirurl'];
|
131 |
|
|
$config['captiveportal']['radiusip'] = $_POST['radiusip'];
|
132 |
|
|
$config['captiveportal']['radiusport'] = $_POST['radiusport'];
|
133 |
|
|
$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
|
134 |
|
|
$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
|
135 |
07bd3f83
|
Scott Ullrich
|
|
136 |
5b237745
|
Scott Ullrich
|
/* file upload? */
|
137 |
|
|
if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
|
138 |
|
|
$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
|
139 |
|
|
if (is_uploaded_file($_FILES['errfile']['tmp_name']))
|
140 |
|
|
$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
|
141 |
07bd3f83
|
Scott Ullrich
|
|
142 |
5b237745
|
Scott Ullrich
|
write_config();
|
143 |
07bd3f83
|
Scott Ullrich
|
|
144 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
145 |
|
|
if (!file_exists($d_sysrebootreqd_path)) {
|
146 |
|
|
config_lock();
|
147 |
|
|
$retval = captiveportal_configure();
|
148 |
|
|
config_unlock();
|
149 |
|
|
}
|
150 |
|
|
$savemsg = get_std_save_message($retval);
|
151 |
|
|
}
|
152 |
|
|
}
|
153 |
|
|
?>
|
154 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
155 |
|
|
<html>
|
156 |
|
|
<head>
|
157 |
|
|
<title><?=gentitle("Services: Captive portal");?></title>
|
158 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
159 |
|
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
160 |
|
|
<script language="JavaScript">
|
161 |
|
|
<!--
|
162 |
|
|
function radacct_change() {
|
163 |
|
|
if (document.iform.radacct_enable.checked) {
|
164 |
|
|
document.iform.logoutwin_enable.checked = 1;
|
165 |
07bd3f83
|
Scott Ullrich
|
}
|
166 |
5b237745
|
Scott Ullrich
|
}
|
167 |
|
|
|
168 |
|
|
function enable_change(enable_change) {
|
169 |
07bd3f83
|
Scott Ullrich
|
var endis;
|
170 |
|
|
endis = !(document.iform.enable.checked || enable_change);
|
171 |
|
|
|
172 |
|
|
document.iform.cinterface.disabled = endis;
|
173 |
|
|
document.iform.idletimeout.disabled = endis;
|
174 |
|
|
document.iform.timeout.disabled = endis;
|
175 |
|
|
document.iform.redirurl.disabled = endis;
|
176 |
|
|
document.iform.radiusip.disabled = endis;
|
177 |
|
|
document.iform.radiusport.disabled = endis;
|
178 |
|
|
document.iform.radiuskey.disabled = endis;
|
179 |
|
|
document.iform.radacct_enable.disabled = endis;
|
180 |
|
|
document.iform.httpslogin_enable.disabled = endis;
|
181 |
|
|
document.iform.httpsname.disabled = endis;
|
182 |
|
|
document.iform.cert.disabled = endis;
|
183 |
|
|
document.iform.key.disabled = endis;
|
184 |
|
|
document.iform.logoutwin_enable.disabled = endis;
|
185 |
|
|
document.iform.nomacfilter.disabled = endis;
|
186 |
|
|
document.iform.htmlfile.disabled = endis;
|
187 |
|
|
document.iform.errfile.disabled = endis;
|
188 |
|
|
|
189 |
5b237745
|
Scott Ullrich
|
if (enable_change && document.iform.radacct_enable.checked) {
|
190 |
|
|
document.iform.logoutwin_enable.checked = 1;
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
//-->
|
194 |
|
|
</script>
|
195 |
|
|
</head>
|
196 |
|
|
|
197 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
198 |
|
|
<?php include("fbegin.inc"); ?>
|
199 |
|
|
<p class="pgtitle">Services: Captive portal</p>
|
200 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
201 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
202 |
|
|
<form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
|
203 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
204 |
|
|
<tr><td>
|
205 |
|
|
<ul id="tabnav">
|
206 |
|
|
<li class="tabact">Captive portal</li>
|
207 |
|
|
<li class="tabinact"><a href="services_captiveportal_mac.php">Pass-through MAC</a></li>
|
208 |
|
|
<li class="tabinact"><a href="services_captiveportal_ip.php">Allowed IP addresses</a></li>
|
209 |
|
|
</ul>
|
210 |
|
|
</td></tr>
|
211 |
|
|
<tr>
|
212 |
|
|
<td class="tabcont">
|
213 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
214 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
215 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vtable"> </td>
|
216 |
|
|
<td width="78%" class="vtable">
|
217 |
|
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
218 |
|
|
<strong>Enable captive portal </strong></td>
|
219 |
|
|
</tr>
|
220 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
221 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
222 |
|
|
<td width="78%" class="vtable">
|
223 |
|
|
<select name="cinterface" class="formfld" id="cinterface">
|
224 |
|
|
<?php $interfaces = array('lan' => 'LAN');
|
225 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
226 |
|
|
if (isset($config['interfaces']['opt' . $i]['enable']))
|
227 |
|
|
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
|
228 |
|
|
}
|
229 |
|
|
foreach ($interfaces as $iface => $ifacename): ?>
|
230 |
07bd3f83
|
Scott Ullrich
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
|
231 |
5b237745
|
Scott Ullrich
|
<?=htmlspecialchars($ifacename);?>
|
232 |
|
|
</option>
|
233 |
|
|
<?php endforeach; ?>
|
234 |
|
|
</select> <br>
|
235 |
|
|
<span class="vexpl">Choose which interface to run the captive portal on.</span></td>
|
236 |
|
|
</tr>
|
237 |
|
|
<tr>
|
238 |
|
|
<td valign="top" class="vncell">Idle timeout</td>
|
239 |
|
|
<td class="vtable">
|
240 |
|
|
<input name="idletimeout" type="text" class="formfld" id="idletimeout" size="6" value="<?=htmlspecialchars($pconfig['idletimeout']);?>">
|
241 |
|
|
minutes<br>
|
242 |
|
|
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>
|
243 |
|
|
</tr>
|
244 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
245 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">Hard timeout</td>
|
246 |
07bd3f83
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
247 |
|
|
<input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
|
248 |
5b237745
|
Scott Ullrich
|
minutes<br>
|
249 |
|
|
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>
|
250 |
|
|
</tr>
|
251 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
252 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">Logout popup window</td>
|
253 |
07bd3f83
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
254 |
5b237745
|
Scott Ullrich
|
<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
|
255 |
|
|
<strong>Enable logout popup window</strong><br>
|
256 |
|
|
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. When RADIUS accounting is enabled, this option is implied.</td>
|
257 |
|
|
</tr>
|
258 |
|
|
<tr>
|
259 |
|
|
<td valign="top" class="vncell">Redirection URL</td>
|
260 |
|
|
<td class="vtable">
|
261 |
|
|
<input name="redirurl" type="text" class="formfld" id="redirurl" size="60" value="<?=htmlspecialchars($pconfig['redirurl']);?>">
|
262 |
|
|
<br>
|
263 |
|
|
If you provide a URL here, clients will be redirected to that URL instead of the one they initially tried
|
264 |
|
|
to access after they've authenticated.</td>
|
265 |
|
|
</tr>
|
266 |
|
|
<tr>
|
267 |
|
|
<td valign="top" class="vncell">MAC filtering </td>
|
268 |
|
|
<td class="vtable">
|
269 |
|
|
<input name="nomacfilter" type="checkbox" class="formfld" id="nomacfilter" value="yes" <?php if ($pconfig['nomacfilter']) echo "checked"; ?>>
|
270 |
|
|
<strong>Disable MAC filtering</strong><br>
|
271 |
|
|
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. This is required when the MAC address of cannot be determined (usually because there are routers between m0n0wall and the clients).</td>
|
272 |
|
|
</tr>
|
273 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
274 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncell">RADIUS server</td>
|
275 |
07bd3f83
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
276 |
5b237745
|
Scott Ullrich
|
<table cellpadding="0" cellspacing="0">
|
277 |
|
|
<tr>
|
278 |
|
|
<td>IP address:</td>
|
279 |
|
|
<td><input name="radiusip" type="text" class="formfld" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>"></td>
|
280 |
|
|
</tr><tr>
|
281 |
|
|
<td>Port:</td>
|
282 |
|
|
<td><input name="radiusport" type="text" class="formfld" id="radiusport" size="5" value="<?=htmlspecialchars($pconfig['radiusport']);?>"></td>
|
283 |
|
|
</tr><tr>
|
284 |
|
|
<td>Shared secret: </td>
|
285 |
|
|
<td><input name="radiuskey" type="text" class="formfld" id="radiuskey" size="16" value="<?=htmlspecialchars($pconfig['radiuskey']);?>"> </td>
|
286 |
|
|
</tr>
|
287 |
|
|
<tr>
|
288 |
|
|
<td>Accounting: </td>
|
289 |
|
|
<td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?> onClick="radacct_change()"></td>
|
290 |
|
|
</tr>
|
291 |
|
|
<tr>
|
292 |
|
|
<td>Accounting port: </td>
|
293 |
|
|
<td><input name="radiusacctport" type="text" class="formfld" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"></td>
|
294 |
|
|
</tr></table>
|
295 |
|
|
<br>
|
296 |
|
|
Enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against. Leave blank to disable RADIUS authentication. Leave port number blank to use the default port (1812). Leave the RADIUS shared secret blank to not use a RADIUS shared secret. RADIUS accounting packets will also be sent to the RADIUS server if accounting is enabled (default port is 1813).
|
297 |
|
|
</tr>
|
298 |
|
|
<tr>
|
299 |
|
|
<td valign="top" class="vncell">HTTPS login</td>
|
300 |
|
|
<td class="vtable">
|
301 |
|
|
<input name="httpslogin_enable" type="checkbox" class="formfld" id="httpslogin_enable" value="yes" <?php if($pconfig['httpslogin_enable']) echo "checked"; ?>>
|
302 |
|
|
<strong>Enable HTTPS login</strong><br>
|
303 |
|
|
If enabled, the username and password will be transmitted over an HTTPS connection to protect against eavesdroppers. This option only applies when RADIUS authentication is used. A server name, certificate and matching private key must also be specified below.</td>
|
304 |
|
|
</tr>
|
305 |
|
|
<tr>
|
306 |
|
|
<td valign="top" class="vncell">HTTPS server name </td>
|
307 |
|
|
<td class="vtable">
|
308 |
|
|
<input name="httpsname" type="text" class="formfld" id="httpsname" size="30" value="<?=htmlspecialchars($pconfig['httpsname']);?>"><br>
|
309 |
|
|
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. </td>
|
310 |
|
|
</tr>
|
311 |
|
|
<tr>
|
312 |
|
|
<td valign="top" class="vncell">HTTPS certificate</td>
|
313 |
|
|
<td class="vtable">
|
314 |
|
|
<textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
|
315 |
|
|
<br>
|
316 |
|
|
Paste a signed certificate in X.509 PEM format here.</td>
|
317 |
|
|
</tr>
|
318 |
|
|
<tr>
|
319 |
|
|
<td valign="top" class="vncell">HTTPS private key</td>
|
320 |
|
|
<td class="vtable">
|
321 |
|
|
<textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
|
322 |
|
|
<br>
|
323 |
|
|
Paste an RSA private key in PEM format here.</td>
|
324 |
|
|
</tr>
|
325 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
326 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top" class="vncellreq">Portal page contents</td>
|
327 |
07bd3f83
|
Scott Ullrich
|
<td width="78%" class="vtable">
|
328 |
5b237745
|
Scott Ullrich
|
<input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
|
329 |
|
|
<?php if ($config['captiveportal']['page']['htmltext']): ?>
|
330 |
07bd3f83
|
Scott Ullrich
|
<a href="?act=viewhtml" target="_blank">View current page</a>
|
331 |
5b237745
|
Scott Ullrich
|
<br>
|
332 |
|
|
<br>
|
333 |
|
|
<?php endif; ?>
|
334 |
|
|
Upload an HTML file for the portal page here (leave blank to keep the current one). Make sure to include a form (POST to "$PORTAL_ACTION$")
|
335 |
07bd3f83
|
Scott Ullrich
|
with a submit button (name="accept") and a hidden field with name="redirurl" and value="$PORTAL_REDIRURL$". Include the "auth_user" and "auth_pass" input elements if RADIUS authentication is enabled. If RADIUS is enabled and no "auth_user" is present, authentication will always fail. If RADIUS is not enabled, you can omit both of these input elements. Example code for the form:<br>
|
336 |
5b237745
|
Scott Ullrich
|
<br>
|
337 |
|
|
<tt><form method="post" action="$PORTAL_ACTION$"><br>
|
338 |
|
|
<input name="auth_user" type="text"><br>
|
339 |
|
|
<input name="auth_pass" type="password"><br>
|
340 |
|
|
<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$"><br>
|
341 |
|
|
<input name="accept" type="submit" value="Continue"><br>
|
342 |
|
|
</form></tt></td>
|
343 |
|
|
</tr>
|
344 |
|
|
<tr>
|
345 |
|
|
<td width="22%" valign="top" class="vncell">Authentication<br>
|
346 |
|
|
error page<br>
|
347 |
|
|
contents</td>
|
348 |
|
|
<td class="vtable">
|
349 |
|
|
<input name="errfile" type="file" class="formfld" id="errfile"><br>
|
350 |
|
|
<?php if ($config['captiveportal']['page']['errtext']): ?>
|
351 |
07bd3f83
|
Scott Ullrich
|
<a href="?act=viewerrhtml" target="_blank">View current page</a>
|
352 |
5b237745
|
Scott Ullrich
|
<br>
|
353 |
|
|
<br>
|
354 |
|
|
<?php endif; ?>
|
355 |
|
|
The contents of the HTML file that you upload here are displayed when a RADIUS authentication error occurs.</td>
|
356 |
|
|
</tr>
|
357 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
358 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
359 |
07bd3f83
|
Scott Ullrich
|
<td width="78%">
|
360 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
|
361 |
5b237745
|
Scott Ullrich
|
</td>
|
362 |
|
|
</tr>
|
363 |
07bd3f83
|
Scott Ullrich
|
<tr>
|
364 |
5b237745
|
Scott Ullrich
|
<td width="22%" valign="top"> </td>
|
365 |
|
|
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
|
366 |
|
|
</strong></span>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>
|
367 |
|
|
</tr>
|
368 |
|
|
</table>
|
369 |
|
|
</td>
|
370 |
|
|
</tr>
|
371 |
|
|
</table>
|
372 |
|
|
</form>
|
373 |
|
|
<script language="JavaScript">
|
374 |
|
|
<!--
|
375 |
|
|
enable_change(false);
|
376 |
|
|
//-->
|
377 |
|
|
</script>
|
378 |
|
|
<?php include("fend.inc"); ?>
|
379 |
|
|
</body>
|
380 |
|
|
</html>
|