Captive Portal redirection fails since last update..
-
Hello,
Since the last update "Built On: Sun May 13 02:42:10 EDT 2012" our captive portal doesn't work anymore.
The redirection URL seems to be wrong.
Instead of a thing like : "10.0.54.1:8000/index.php?zone=zonename&…"
We have
"firewallHostnameDomainName/index.php?zone=1&…" ( moreover there's a dot missing between the hostname and the domain name in the redirect url)
So Pfsense seems not being able to find the correct zonename of the portal and the correct ip of the interface...
Nobody is experiencing the same trouble ?
EDIT : I upgraded pfsense to the last (14 may) version, and the problem is still here.
Here, the redirect URL I get :
pfsense hostname : mypfsense
pfsense domain : internal.mycorp.comAnd I use the default config of the captive portal.
http://mypfsenseinternal.mycorp.com/index.php?zone=1&redirurl=http%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fmypfsenseinternal.mycorp.comhttp%3A%2F%2Fwww.google.com%2F
Thanks
Math
-
A colleague found a temporary fix
Original /etc/inc/captiveportal.inc
function portal_ip_from_client_ip($cliip) { global $config, $cpzone; $interfaces = explode(",", $config['captiveportal'][$cpzone]['interface']); foreach ($interfaces as $cpif) { $ip = get_interface_ip($cpif); $sn = get_interface_subnet($cpif); if (ip_in_subnet($cliip, "{$ip}/{$sn}")) return $ip; }
New one
function portal_ip_from_client_ip($cliip) { global $config, $cpzone; foreach ($config['captiveportal'] as $cpkey => $cp) { $cpzone = $cpkey; $interfaces = explode(",", $config['captiveportal'][$cpzone]['interface']); foreach ($interfaces as $cpif) { $ip = get_interface_ip($cpif); $sn = get_interface_subnet($cpif); if (ip_in_subnet($cliip, "{$ip}/{$sn}")) return $ip; } }
Original /usr/local/captiveportal/index.php
$cpzone = $_REQUEST['zone']; $cpcfg = $config['captiveportal'][$cpzone]; $orig_host = $_ENV['HTTP_HOST']; $orig_request = $_REQUEST['redirurl']; $clientip = $_SERVER['REMOTE_ADDR']; if (!$clientip) { /* not good - bail out */ log_error("Captive portal could not determine client's IP address."); $error_message = "An error occurred. Please check the system logs for more information."; portal_reply_page($redirurl, "error", $errormsg); exit; }
New One
$orig_host = $_ENV['HTTP_HOST']; $orig_request = $_REQUEST['redirurl']; $clientip = $_SERVER['REMOTE_ADDR']; global $cpzone; #$cpzone = $_REQUEST['zone']; $ifip = portal_ip_from_client_ip($clientip); $cpcfg = $config['captiveportal'][$cpzone]; if (!$clientip) { /* not good - bail out */ log_error("Captive portal could not determine client's IP address."); $error_message = "An error occurred. Please check the system logs for more information."; portal_reply_page($redirurl, "error", $errormsg); exit; }
Can we have a feedback on this ? Thanks :)
-
same problem…
after you patch CaptivePortal is work.
but after authorization to the client the speed is set 2,05 Kbits/s.
"Per-user bandwith restriction" - enable/disable/set bandwith - no effect.
what am I doing wrong? -
Dev feedback here :
https://redmine.pfsense.org/issues/2454