Captive Portal authentication from mysql


  • We are making a project that the usernames and passwords for captive portal is from mysql database that is online. How can I authenticate the users we are searching and googling for the answers but no luck. Maybe someone can help us  :( Thank you Guys


  • There is no way to authenticate directly to MySQL, but FreeRADIUS can use a MySQL back end and you can auth captive portal to RADIUS.


  • Yes we will use RADIUS but the problem is that how can we authenticate users from database like mysql? Is there a way can we do this? thank you for the reply


  • @luigel:

    Yes we will use RADIUS ….

    You are aware that Radius (can) use(s) MySQL ?


  • To save you a ton of coding (and from re-inventing the wheel in so doing)…

    http://www.daloradius.com/


  • @luigel:

    We are making a project that the usernames and passwords for captive portal is from mysql database that is online. ….

    I just remember something.
    Years ago, when the PHP MYSQL client was 'integrated'' by default in the PHP that pfSense was using, I added a couple of lines to the captive portal so it would check against a MySQL server (our hotel room managing system) before the client could logging.
    From what I remember, this wasn't a "project", but more a "write up some PHP lines and done" solution.


  • @Gertjan:

    @luigel:

    We are making a project that the usernames and passwords for captive portal is from mysql database that is online. ….

    I just remember something.
    Years ago, when the PHP MYSQL client was 'integrated'' by default in the PHP that pfSense was using, I added a couple of lines to the captive portal so it would check against a MySQL server (our hotel room managing system) before the client could logging.
    From what I remember, this wasn't a "project", but more a "write up some PHP lines and done" solution.

    Is PHP MYSQL client already installed in pfSense or we still need to install it to pfSense? You said checking against a MYSQL server before logging in is possible, how will it be implemented using PHP, MySQL and FreeRadius? and btw thanks for the reply, it is greatly appreciated. :)


  • Well, back then, the PHP extension 'MySQL' was easy to activate, so all PHP's MySQL function commands were accessible.
    After that, it's very easy to connect to a MySQL database, do a query on a table (or more tables) and parse the result.

    Some recent thread on this forum show you how to activate MySQL on recent pfSense versions.
    All this means that you modify some what the pfSense GUI …..


  • @Gertjan:

    Well, back then, the PHP extension 'MySQL' was easy to activate, so all PHP's MySQL function commands were accessible.
    After that, it's very easy to connect to a MySQL database, do a query on a table (or more tables) and parse the result.

    Some recent thread on this forum show you how to activate MySQL on recent pfSense versions.
    All this means that you modify some what the pfSense GUI …..

    Thank you sir. We'll see what we can do today that we have idea for the php mysql thing. Can we contact you when we need help here in pfsense? Thanks


  • @Gertjan:

    @luigel:

    We are making a project that the usernames and passwords for captive portal is from mysql database that is online. ….

    I just remember something.
    Years ago, when the PHP MYSQL client was 'integrated'' by default in the PHP that pfSense was using, I added a couple of lines to the captive portal so it would check against a MySQL server (our hotel room managing system) before the client could logging.
    From what I remember, this wasn't a "project", but more a "write up some PHP lines and done" solution.

    Hi kindly give a sample php where the captive portal will authenticate using an existing MySQL Database.

    Thanks in advance


  • @AYSMAN:

    give a sample php where the captive portal will authenticate using an existing MySQL Database.

    This was -years- ago.
    And of course, I'm not such an approach anymore.

    So, first : activate MySQL in the PHP setup (your call).
    Then : understand where to add the "couple of lines" (some insight knowledge about how the captive portal auth is done).
    Then : know how to connect to a MySQL database.
    Know how to extract some data from a database -> table - and close the database.
    If there was ONE matching result, then grant access.

    Understand : you're are asking to patch the pfSense code (no problem, it can be done) - in that case YOU should be able to read that code, and why you are patching. The final phase : write up and test the patch is just a formality.