Check username and password from database for login captive portal
-
We made a program that will generate username and password for users and store it in the database. When logging in the captive portal it will check the username and password for the user in the database. When the user's username is password is valid then it will give internet access, else stay in the captive portal login page. Someone help us please. We are using mysql server. Thank you.
-
pfsense uses a small PHP database engin, SQLLite3.
I advise you to start reading /usr/local/captiveportal/index.php
You'll be needing also /etc/inc/captiveportal.inc where you can find easily how the user-management is done, and how sessions are records. That's where you add your check to your external database (MySQL).
Look up in this forum how to activate PHP's MySQL client support. -
My advice is to set up a FreeRADIUS server, have it backended by MySQL, and just use the already-built-in RADIUS in pfSense captive portal. Then you're not dreading every pfSense upgrade that will clobber all your customizations.
-
Your right.
pfSense with Radius authentication is mentioned a lot over here https://forum.pfsense.org/index.php?board=2.0
Still, luigel is asking for help.
I deducted that he wants to communicate directly with MySQL …. -
My advice is to set up a FreeRADIUS server, have it backended by MySQL, and just use the already-built-in RADIUS in pfSense captive portal. Then you're not dreading every pfSense upgrade that will clobber all your customizations.
I have only knowledge about the basic of php. I was reading the captiveportal.inc but so cant understand so much. Can someone help me where is the authentication happen in captiveportal.inc? thank you for the reply
-
Your right.
pfSense with Radius authentication is mentioned a lot over here https://forum.pfsense.org/index.php?board=2.0
Still, luigel is asking for help.
I deducted that he wants to communicate directly with MySQL ….Hi sir why i cant install this in the pfsense? can you help me with this?
-
pkg install mysql56-server
-
pkg install compat9x-amd64
-
pkg install php56-mysql
-
-
There is no mysql-server package in the pfSense repository. It is a firewall not a database server.
Like I said, get RADIUS running, point that at your (external) mysql server, and just use the already-existing RADIUS capabilities in captive portal.
Why reinvent the wheel??
-
There is no mysql-server package in the pfSense repository. It is a firewall not a database server.
Like I said, get RADIUS running, point that at your (external) mysql server, and just use the already-existing RADIUS capabilities in captive portal.
Why reinvent the wheel??
We already did that. So how can we check the username and password for the captive portal? thank you.
-
Set captive portal to use RADIUS to check the username and password and point it at the RADIUS server.
-
We already did that. So how can we check the username and password for the captive portal? thank you.
It is best to split into two steps process.
Step one, setup freeradius with sql DB (based on freeradius DB schema). Make sure pfsense can authenticate CP user using RADIUS. With this you verified pfsense CP -> radius -> sql DB is properly configured and working.
Step two, modify your program to populate the user data based on freeradius DB schema. Freeradius expect DB data in certain format, it is best to follow these as you can get the experience & help from freeradius community. Trying to get freeradius to work with your DB schema, you're mostly on your own.
Trying to get pfsense CP + radius + sql DB (based on your DB schema) to work in one go, there are just too many points of mis-configuration / failure.
-
Maybe this might help:
http://mgyinngetay.blogspot.co.uk/2014/04/how-to-configure-pfsense-captive-portal.html