• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Check username and password from database for login captive portal

Scheduled Pinned Locked Moved Captive Portal
11 Posts 5 Posters 5.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L
    luigel
    last edited by Jul 15, 2016, 3:42 AM

    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.

    1 Reply Last reply Reply Quote 0
    • G
      Gertjan
      last edited by Jul 15, 2016, 6:17 AM

      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.

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      • D
        Derelict LAYER 8 Netgate
        last edited by Jul 15, 2016, 6:32 AM

        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.

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        1 Reply Last reply Reply Quote 0
        • G
          Gertjan
          last edited by Jul 15, 2016, 7:03 AM

          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 ….

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          • L
            luigel
            last edited by Jul 15, 2016, 4:45 PM

            @Derelict:

            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

            1 Reply Last reply Reply Quote 0
            • L
              luigel
              last edited by Jul 16, 2016, 3:31 PM

              @Gertjan:

              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

              1 Reply Last reply Reply Quote 0
              • D
                Derelict LAYER 8 Netgate
                last edited by Jul 16, 2016, 3:39 PM

                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??

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

                1 Reply Last reply Reply Quote 0
                • L
                  luigel
                  last edited by Jul 16, 2016, 3:46 PM

                  @Derelict:

                  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.

                  1 Reply Last reply Reply Quote 0
                  • D
                    Derelict LAYER 8 Netgate
                    last edited by Jul 16, 2016, 5:42 PM

                    Set captive portal to use RADIUS to check the username and password and point it at the RADIUS server.

                    Chattanooga, Tennessee, USA
                    A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                    DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                    Do Not Chat For Help! NO_WAN_EGRESS(TM)

                    1 Reply Last reply Reply Quote 0
                    • D
                      demco
                      last edited by Jul 18, 2016, 8:19 AM

                      @luigel:

                      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.

                      1 Reply Last reply Reply Quote 0
                      • M
                        muswellhillbilly
                        last edited by Jul 18, 2016, 1:01 PM

                        Maybe this might help:

                        http://mgyinngetay.blogspot.co.uk/2014/04/how-to-configure-pfsense-captive-portal.html

                        1 Reply Last reply Reply Quote 0
                        11 out of 11
                        • First post
                          11/11
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                          This community forum collects and processes your personal information.
                          consent.not_received