Captive Portal to capture user information
-
I've been using PFSense for a while (love it) - Mostly to offer public WiFi access in specific areas. I've been trying to use the captive portal to capture information from the user (age, gender, etc.) but can't figure out a way to do it.
Has anyone here been able to implement a similar solution or knows how to do it?
I would appreciate it!
-
I have a system like this in place.
Our captive portal uses a radius database for authentication. Its freeradius using a MySQL database hosted on an Ubuntu server.
Our users have to self register (there are far to many to input manually), on the main captive portal page there is a link to another page (also hosted on pfsense), where users can create an account. Its a HTML/PHP form that validates the input (we capture email addresses) and then writes it to the MySQL database.
There is a PHP script that resides on the pfsense machine that contains all the functions that the PHP forms call. I'll post the bit that writes the user account to the radius database:
function addUserDetails() { $conn = mysql_connect(IPADDRESS,USERNAME,PASSWORD); if (!$conn) { die('Error 1 ' . mysql_error()); } mysql_select_db("radius", $conn); $radcheck_sql = "INSERT INTO radcheck(UserName, Value) VALUES ('$_POST[user_id]', '$_POST[pass1]')"; $radusergroup_sql = "INSERT INTO radusergroup(UserName) VALUES ('$_POST[user_id]')"; if(!mysql_query($radcheck_sql, $conn)) { die('Error 3 ' . mysql_error()); } if(!mysql_query($radusergroup_sql, $conn)) { die('Error 4 ' . mysql_error()); } }
Hope that helps!
Edit
You should also enable HTTPS on your captive portal, if you haven't already, since you are dealing with peoples personal information.
-
I have a system like this in place.
Our captive portal uses a radius database for authentication. Its freeradius using a MySQL database hosted on an Ubuntu server.
Our users have to self register (there are far to many to input manually), on the main captive portal page there is a link to another page (also hosted on pfsense), where users can create an account. Its a HTML/PHP form that validates the input (we capture email addresses) and then writes it to the MySQL database.
There is a PHP script that resides on the pfsense machine that contains all the functions that the PHP forms call. I'll post the bit that writes the user account to the radius database:
Edit
You should also enable HTTPS on your captive portal, if you haven't already, since you are dealing with peoples personal information.
Thank you very much Fred!
The Ubuntu server is at your place? Is there a way to host this on the same pfSense server? or a way to have this service on the cloud? I'm deploying this in a few places and would like to reduce cost at the edge of system.
The FreeRadius's function is to store that information for when the user revisits?
I will enable the HTTPS, thanks for the heads-up.
Thanks again!
-
Thank you very much Fred!
No Problem.
The Ubuntu server is at your place?
Yes
Is there a way to host this on the same pfSense server? or a way to have this service on the cloud?
There is a freeradius package that can be added to pfsense (System -> Packages then click the available packages tab) but I can't help you with that as I've not used it myself, the same goes for cloud hosting.
The FreeRadius's function is to store that information for when the user revisits?
Yep, the login will be preserved as long as it is not removed from the MySQL database.