coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
518 stars 260 forks source link

Wrong redirection for json/status on chilli 1.3.1.3 #95

Closed EasyNetDev closed 8 years ago

EasyNetDev commented 9 years ago

Hi all,

I found a strange behavior of Chilli 1.3.1.3 in conjunction with RadiusDesk Dynamic Login Pages. After Chilli redirects to the external login page the RD dynamic login pages it says "Fetching connection status..." and after a while it says "Error Failed to get status from CoovaChilli". After I took a look in the browser with development tools I saw that is trying to query this link:

http://10.1.0.1:3990/json/status?_dc=1443802869694&callback=Ext.data.JsonP.callback1

When I try to query this link directly in the browser the Coova Chilli is redirect to RD login page.

Chilli logs:

coova-chilli[11813]: The path: json/status coova-chilli[11813]: -->> Setting userurl=[http://10.1.0.1:3990/json/status?_dc=1443803059684&callback=Ext.data.JsonP.callback13] coova-chilli[11813]: redir_accept: Original request host=10.1.0.1:3990 coova-chilli[11813]: redir_wispr2_reply coova-chilli[11497]: caught 17 via selfpipe coova-chilli[11497]: child 11813 terminated coova-chilli[11497]: Freed child process 11813 [[redir]] coova-chilli[11814]: The path: www/coova.html coova-chilli[11814]: Serving file coova.html coova-chilli[11497]: caught 17 via selfpipe coova-chilli[11497]: child 11814 terminated coova-chilli[11497]: Freed child process 11814 [[redir]]

My Setup:

10.1.0.0/24 -> Chilli router -> WAN -> INTERNET -> RD server (FreeRadius

Chilli config:

HS_WANIF=eth0 # WAN Interface toward the Internet HS_LANIF=eth1 # Subscriber Interface for client devices HS_NETWORK=10.1.0.0 # HotSpot Network (must include HS_UAMLISTEN) HS_NETMASK=255.255.255.0 # HotSpot Network Netmask HS_UAMLISTEN=10.1.0.1 # HotSpot IP Address (on subscriber network) HS_UAMPORT=3990 # HotSpot UAM Port (on subscriber network) HS_UAMUIPORT=4990 # HotSpot UAM "UI" Port (on subscriber network, for embedded portal) HS_COAPORT=3799 HS_DYNIP=10.1.0.10 HS_DYNIP_MASK=255.255.255.0 HS_DNS_DOMAIN=MyDomain.ro HS_DNS1=MyDNS1 HS_DNS2=MyDNS2 HS_NASID=NAS-01 HS_RADIUS=radiusdesk.MyDomain.ro HS_RADIUS2=radiusdesk.MyDomain.ro HS_RADSECRET=myradiussecret # Set to be your RADIUS shared secret HS_UAMSECRET=myuamsecret # Set to be your UAM secret HS_UAMALIASNAME=chilli HS_UAMDOMAINS=".paypal.com,.paypalobjects.com,.MyDomain.ro" HS_SSID="MyDomain-SSID" HS_UAMSERVER=$HS_UAMLISTEN HS_UAMFORMAT=http://radiusdesk.MyDomain.ro/cake2/rd_cake/dynamic_details/chilli_browser_detect/ HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html HS_TCP_PORTS="80 443" HS_UDP_PORTS="1701" HS_MODE=hotspot HS_TYPE=coovachilli HS_RADAUTH=1812 HS_RADACCT=1813 HS_WWWDIR=/etc/chilli/www HS_WWWBIN=/etc/chilli/wwwsh HS_PROVIDER=MyDomain HS_PROVIDER_LINK=http://www.MyDomain.ro/ HS_LOC_NAME="My HotSpot" # WISPr Location Name and used in portal HS_LOC_NETWORK="My Network" # Network name HS_REDIRSSL=on

Chilli version: coova-chilli[11939]: (Re)processing options [/var/run/chilli.11939.cfg.bin] coova-chilli[11940]: running chilli_opt on /var/run/chilli.11939.cfg.bin coova-chilli 1.3.1.3

OS: stretch/sid

I've changed the UAM secrete also in dynamic login pages.

Using the same configuration file with Chilli 1.3.0 this issue is not appears. I've used 1.3.1.3 because 1.3.0 I had to do some changes to the code to compile it correctly (changes which seems to be done in 1.3.1.3).

Tried Coova Chilli 1.3.0 on Debian OS and also on OpenWRT with a TP-LINK TL-MR3420. Coova Chilli 1.3.1.3 I've tried only on Debian OS.

Anybody has any idea what is the issue?

Kind regards, Adrian

wlanmac commented 9 years ago

Be sure to enable json with ./configure --enable-json during build time.

EasyNetDev commented 9 years ago

Thanks! Worked flawless.

Here is the patch for Debian rules to fix this issue. I needed also --enable-libjson

root@HotSpot:~# diff -Nur coova-chilli-1.3.1.3-orig/debian/rules coova-chilli-1.3.1.3/debian/rules --- coova-chilli-1.3.1.3-orig/debian/rules 2015-09-17 22:23:33.000000000 +0300 +++ coova-chilli-1.3.1.3/debian/rules 2015-10-06 11:22:56.736726205 +0300 @@ -24,7 +24,8 @@ --enable-chilliproxy --enable-binstatusfile --enable-chilliscript \ --enable-chilliradsec --enable-dnslog --enable-layer3 --enable-eapol \ --enable-uamdomainfile --enable-redirdnsreq --enable-modules \

I hope you will add to the sources to fix Debian build.

Kind regards, Adrian