Logout Option with captive portal + free radius
-
Hello,
I am using pfsense 2.2.6 with Captive portal with freeradius authentication and https webgui. I would like to provide users with logout option. As I read in the forum enabling logout option doesn't work if popups are blocked in browser. So what is the best way to achieve this. I have a mixed bag of devices connecting to my network…. apple, windows, androids..... its a coworking space.
Some time back there was a discussion in the forum... but it's all confusing me.
Can any one help me in this.
Thank you
Ashima -
Hi,
@ashima:…
Some time back there was a discussion in the forum... but it's all confusing me.I'm probably talking about the same subject (forum tread) here : https://forum.pfsense.org/index.php?topic=122406.msg677921#msg677921 - right ?
The solution proposed over there works, but not (at the time) for iDevices (Apple). -
Thanks Gretjan for your reply. I am sorry for the late reply.
I have gone through the forum to find a solution.
https://forum.pfsense.org/index.php?topic=77143.75
I have read through the 6 pages. I am left with all confusion. ( I am not a php programmer).
I tried the option of redirecting to logout.html after logging in. I have copied logout.html in /usr/local/www and in the captive portal redirection after authentication I have give http://my_pfsense_boxIP/logout.html
This take me to logout.html but when I click logout button I get 404 Not Found and on the tiltle bar I get
https://192.168.4.1/
and I am not logged out of the CP.
Can you please point out where am I going wrong. My logout.html is same as provided by you.
<title>Logout</title>
Click the button below to disconnect
Regards,
Ashims -
This subject:
@ashima:https://forum.pfsense.org/index.php?topic=77143.75
implies that you know how to modify certain PHP "pfSense" files - and what the interaction will be.
You need to know what happens, and why.The subject was aborted because the cookie storage didn't works well (some browsers did not keep the cookie, making that solution quit worthless).
-
Thank you Gertjan for your reply. It is working for me now… this is what I have done.
Enable logout pop-up window in Captive portal. Create logout.html as suggested by Gertjan. Change the default logout page to new logout.html in Captive Portal.
I have tested it in a test environment... with android, mac, windows...couldn't test on iphone.
Also I am able to display client-ip, clientmacid on the logout page.
I was just wondering If I can display the username too....it'll be perfect. I tried with $user in logout page but I guess that info is not passed on to logout.html. How do I enable that ? Any Pointers ?
Thanks
Ashima -
Well …
If you have the IP and the MAC of the device (client) visiting the logout page,
according to https://github.com/pfsense/pfsense/blob/master/src/etc/inc/captiveportal.inc#L1546 - where you can see what's in the internal 'pfsense' database you could write your own function, something like http://pastebin.com/CFatytZ9 - function is being used here (at the bottom) already_connected - to extract the session ID, the user login name, whatever.
Put it (them) in a variable(s), and use it like some here https://github.com/pfsense/pfsense/blob/master/src/etc/inc/captiveportal.inc#L2002 -
Hello,
Its working for me. I just inserted
Hello , Welcome to MYCOMPANY NAME, Click the button below to disconnect. Your Ip Address is . Your Mac Id is
in the logout.html and the username, clientip and client mac is displayed.
Thank you for your support.
Ashima
-
here you go… its my modified code.feel free to use (displays cliet ip address for easier fault diagonosis):
<title>Logout</title>
Login Successful,To log outclick here:
Change password: click here
For college website click here
Your Local IP is: <h21 id="list">-</h21>
-
its greate i also created using your code but i need a separate ipv6 address.. not both together could you help me with the code seprate for ip address as well as ipv6
-
The "Captive portal" isn't "IPv6" ready.
It can't handle any communication based on IPv6. -
Ohh i am a new to it soo i need some help. it would be great if some can help ok i need my log out page to display some things one is username of the logined in account second is the mac address third how much data the user used
im am doing in a vmware soo till now no issue i dont know coding so hope you guys can help me out i modified a templet so dont think i designed it .. i have a issue in firefox also i need it to display it not like a pop up in firefox showing this network requires you to login can any one help me out whit this too will test with chrome also hope it show without any issue