summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2004-12-05 19:31:44 +0000
committerScott Ullrich <sullrich@pfsense.org>2004-12-05 19:31:44 +0000
commit07bd3f83b401d8e9e9de3938e0a26c6e452660af (patch)
tree7f6913b347dc994dc57fa524f85a5436ff151f54 /usr/local/www/services_captiveportal.php
parent2ed803e736d9256aafae7a29ae0bb84aaf746c5f (diff)
downloadpfsense-07bd3f83b401d8e9e9de3938e0a26c6e452660af.zip
pfsense-07bd3f83b401d8e9e9de3938e0a26c6e452660af.tar.gz
Synchornize with m0n0wall 1.2b3. These files have not really been
modified too much so a straight copy works. 9 files remain to be patched by hand.
Diffstat (limited to 'usr/local/www/services_captiveportal.php')
-rwxr-xr-xusr/local/www/services_captiveportal.php126
1 files changed, 54 insertions, 72 deletions
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index bdd161e..f2366c4 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -1,22 +1,22 @@
#!/usr/local/bin/php
-<?php
+<?php
/*
services_captiveportal.php
part of m0n0wall (http://m0n0.ch/wall)
-
+
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -71,9 +71,9 @@ if ($_POST) {
if ($_POST['enable']) {
$reqdfields = explode(" ", "cinterface");
$reqdfieldsn = explode(",", "Interface");
-
+
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
+
/* make sure no interfaces are bridged */
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
$coptif = &$config['interfaces']['opt' . $i];
@@ -82,7 +82,7 @@ if ($_POST) {
break;
}
}
-
+
if ($_POST['httpslogin_enable']) {
if (!$_POST['cert'] || !$_POST['key']) {
$input_errors[] = "Certificate and key must be specified for HTTPS login.";
@@ -92,13 +92,13 @@ if ($_POST) {
if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
$input_errors[] = "This key does not appear to be valid.";
}
-
+
if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
$input_errors[] = "The HTTPS server name must be specified for HTTPS login.";
}
}
}
-
+
if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
$input_errors[] = "The timeout must be at least 1 minute.";
}
@@ -132,15 +132,15 @@ if ($_POST) {
$config['captiveportal']['radiusport'] = $_POST['radiusport'];
$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
-
+
/* file upload? */
if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
if (is_uploaded_file($_FILES['errfile']['tmp_name']))
$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
-
+
write_config();
-
+
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
config_lock();
@@ -162,47 +162,30 @@ if ($_POST) {
function radacct_change() {
if (document.iform.radacct_enable.checked) {
document.iform.logoutwin_enable.checked = 1;
- }
+ }
}
function enable_change(enable_change) {
- if (document.iform.enable.checked || enable_change) {
- document.iform.radiusacctport.disabled = 0;
- document.iform.cinterface.disabled = 0;
- document.iform.idletimeout.disabled = 0;
- document.iform.timeout.disabled = 0;
- document.iform.redirurl.disabled = 0;
- document.iform.radiusip.disabled = 0;
- document.iform.radiusport.disabled = 0;
- document.iform.radiuskey.disabled = 0;
- document.iform.radacct_enable.disabled = 0;
- document.iform.httpslogin_enable.disabled = 0;
- document.iform.httpsname.disabled = 0;
- document.iform.cert.disabled = 0;
- document.iform.key.disabled = 0;
- document.iform.logoutwin_enable.disabled = 0;
- document.iform.nomacfilter.disabled = 0;
- document.iform.htmlfile.disabled = 0;
- document.iform.errfile.disabled = 0;
- } else {
- document.iform.radiusacctport.disabled = 1;
- document.iform.cinterface.disabled = 1;
- document.iform.idletimeout.disabled = 1;
- document.iform.timeout.disabled = 1;
- document.iform.redirurl.disabled = 1;
- document.iform.radiusip.disabled = 1;
- document.iform.radiusport.disabled = 1;
- document.iform.radiuskey.disabled = 1;
- document.iform.radacct_enable.disabled = 1;
- document.iform.httpslogin_enable.disabled = 1;
- document.iform.httpsname.disabled = 1;
- document.iform.cert.disabled = 1;
- document.iform.key.disabled = 1;
- document.iform.logoutwin_enable.disabled = 1;
- document.iform.nomacfilter.disabled = 1;
- document.iform.htmlfile.disabled = 1;
- document.iform.errfile.disabled = 1;
- }
+ var endis;
+ endis = !(document.iform.enable.checked || enable_change);
+
+ document.iform.cinterface.disabled = endis;
+ document.iform.idletimeout.disabled = endis;
+ document.iform.timeout.disabled = endis;
+ document.iform.redirurl.disabled = endis;
+ document.iform.radiusip.disabled = endis;
+ document.iform.radiusport.disabled = endis;
+ document.iform.radiuskey.disabled = endis;
+ document.iform.radacct_enable.disabled = endis;
+ document.iform.httpslogin_enable.disabled = endis;
+ document.iform.httpsname.disabled = endis;
+ document.iform.cert.disabled = endis;
+ document.iform.key.disabled = endis;
+ document.iform.logoutwin_enable.disabled = endis;
+ document.iform.nomacfilter.disabled = endis;
+ document.iform.htmlfile.disabled = endis;
+ document.iform.errfile.disabled = endis;
+
if (enable_change && document.iform.radacct_enable.checked) {
document.iform.logoutwin_enable.checked = 1;
}
@@ -228,13 +211,13 @@ function enable_change(enable_change) {
<tr>
<td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
+ <tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
<td width="78%" class="vtable">
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
<strong>Enable captive portal </strong></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Interface</td>
<td width="78%" class="vtable">
<select name="cinterface" class="formfld" id="cinterface">
@@ -244,7 +227,7 @@ function enable_change(enable_change) {
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
}
foreach ($interfaces as $iface => $ifacename): ?>
- <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
+ <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php endforeach; ?>
@@ -258,16 +241,16 @@ function enable_change(enable_change) {
minutes<br>
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>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Hard timeout</td>
- <td width="78%" class="vtable">
- <input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
+ <td width="78%" class="vtable">
+ <input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
minutes<br>
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>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Logout popup window</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
<strong>Enable logout popup window</strong><br>
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>
@@ -287,9 +270,9 @@ to access after they've authenticated.</td>
<strong>Disable MAC filtering</strong><br>
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>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">RADIUS server</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<table cellpadding="0" cellspacing="0">
<tr>
<td>IP address:</td>
@@ -339,18 +322,17 @@ to access after they've authenticated.</td>
<br>
Paste an RSA private key in PEM format here.</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Portal page contents</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
<?php if ($config['captiveportal']['page']['htmltext']): ?>
- <a href="?act=viewhtml" target="_blank">View current page</a>
+ <a href="?act=viewhtml" target="_blank">View current page</a>
<br>
<br>
<?php endif; ?>
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;)
-with a submit button (name=&quot;accept&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 these input elements.
-When using HTTPS login, a hidden field with name=&quot;redirurl&quot; and value=&quot;$PORTAL_REDIRURL$&quot; has to be included as well. Example code for the form:<br>
+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>
<br>
<tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
@@ -366,19 +348,19 @@ When using HTTPS login, a hidden field with name=&quot;redirurl&quot; and value=
<td class="vtable">
<input name="errfile" type="file" class="formfld" id="errfile"><br>
<?php if ($config['captiveportal']['page']['errtext']): ?>
- <a href="?act=viewerrhtml" target="_blank">View current page</a>
+ <a href="?act=viewerrhtml" target="_blank">View current page</a>
<br>
<br>
<?php endif; ?>
The contents of the HTML file that you upload here are displayed when a RADIUS authentication error occurs.</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
</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>
OpenPOWER on IntegriCloud