Project

General

Profile

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