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

    [HOWTO] Captive portal + FreeRADIUS + local MySQL user friendly single step

    Scheduled Pinned Locked Moved Captive Portal
    154 Posts 47 Posters 104.2k 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.
    • K
      krotin
      last edited by

      Hi Deajan, Thank you for sharing your work.
      My mistake I messed up mysql password during 'secure installation'.

      How can I reset it to carry on with your [How To]

      Thank you again.

      Krotin

      1 Reply Last reply Reply Quote 0
      • D
        deajan
        last edited by

        @krotin google is your friend http://www.pastbedti.me/2008/11/resetrecover-mysql-root-password-in-freebsd/

        NetPOWER.fr - some opensource stuff for IT people

        1 Reply Last reply Reply Quote 0
        • K
          krotin
          last edited by

          Thank you, I know google is my friend but i'm not trusting every source granted i'm new to freebsd.

          At least I know I can safely follow those instructions with your recommendations.

          Thank you for your kindness Sir.

          Krotin.

          1 Reply Last reply Reply Quote 0
          • B
            bassc
            last edited by

            Hello. Is your work runnig both 32bit and 64bit platforms? Coz i noticed that some installation commands end with "amd64". So it means that installation package is for 64bit platform? When i wanna use 32bit platform do i have to use 32bit installion package?

            1 Reply Last reply Reply Quote 0
            • M
              mastrus
              last edited by

              Hi, I try to instal but when i try to instal mysql56-server, or mysql57-server go in conflict with the library libevent2-2.0.22_1 and libevent-2.1.8 in 64 bit version.

              To no one else does the same?

              1 Reply Last reply Reply Quote 0
              • M
                mastrus
                last edited by

                I resolved the situation by using the development version 2.3.4-DEVELOPMENT (amd64), that does'nt have library conflict.

                Also I have a problem with freeradius version 1.7.8 that don't allow to input into the interface the ip 127.0.0.1 so after installing freeradius I modificate the file /usr/local/pkg/freeradius.inc at line 4384 from

                if (!is_ipaddr_configured($post['varinterfaceip'])) {

                to

                if (!is_ipaddr_configured($post['varinterfaceip']) && $post['varinterfaceip'] != "127.0.0.1") {

                I found the information in tha post https://forum.pfsense.org/index.php?topic=127875.0

                the last problem with freeradius version 1.7.8 is that need in the EAP section on "certificates for tls" all the voice with a hit

                in the first you need to create a CA certificate, in the second a revacation list for the certificate and in the thir a ssl server certificate

                @mastrus:

                Hi, I try to instal but when i try to instal mysql56-server, or mysql57-server go in conflict with the library libevent2-2.0.22_1 and libevent-2.1.8 in 64 bit version.

                To no one else does the same?

                1 Reply Last reply Reply Quote 0
                • D
                  deajan
                  last edited by

                  @mastrus:

                  Also I have a problem with freeradius version 1.7.8 that don't allow to input into the interface the ip 127.0.0.1 so after installing freeradius I modificate the file /usr/local/pkg/freeradius.inc at line 4384 from

                  if (!is_ipaddr_configured($post['varinterfaceip'])) {

                  to

                  if (!is_ipaddr_configured($post['varinterfaceip']) && $post['varinterfaceip'] != "127.0.0.1") {

                  I found the information in tha post https://forum.pfsense.org/index.php?topic=127875.0

                  Thanks for sharing. I have to setup a new pfSense test platform these days because of some changes I recently made on the mysql code. I'll update the howto then.

                  NetPOWER.fr - some opensource stuff for IT people

                  1 Reply Last reply Reply Quote 0
                  • M
                    mastrus
                    last edited by

                    You have not updated this documentation page at this time

                    http://netpower.fr/sites/default/files/soft/html-doc/pfSense-cp-auth-onestep_0.html

                    1 Reply Last reply Reply Quote 0
                    • D
                      deajan
                      last edited by

                      @mastrus:

                      You have not updated this documentation page at this time

                      http://netpower.fr/sites/default/files/soft/html-doc/pfSense-cp-auth-onestep_0.html

                      I'm aware of that :) Still have to redo the whole howto on a recent pfSense build in order to rewrite it properly and address new issues, but as always, time is a b****, and I was more eager to rewrite the portal itself for security reasons than the manual.

                      NetPOWER.fr - some opensource stuff for IT people

                      1 Reply Last reply Reply Quote 0
                      • P
                        patpa11
                        last edited by

                        Hi deajan, thanks a lot for this project.
                        Is it possible to use this Captive Portal for self registration on a unencrypted WLAN SSID with username and password, and use these credentials to authenticate on a encrypted WPA2 Enterprise SSID (with PEAP authentification or something like that)?

                        1 Reply Last reply Reply Quote 0
                        • D
                          deajan
                          last edited by

                          @patpa11:

                          Hi deajan, thanks a lot for this project.
                          Is it possible to use this Captive Portal for self registration on a unencrypted WLAN SSID with username and password, and use these credentials to authenticate on a encrypted WPA2 Enterprise SSID (with PEAP authentification or something like that)?

                          Hi,

                          I'm not really sure what's your usecase here, but if I understand right, you want users to self sign in on a first wireless network, then have them connect on the secured wireless network with the credentials they created earlier.
                          You would have to modify the code of the captive portal to add a password option (let's say instead of the room number or so).
                          Then you'd need to add the pfSense FreeRADIUS server to your WPA2 setup.
                          Could you elaborate a bit please ?

                          NetPOWER.fr - some opensource stuff for IT people

                          1 Reply Last reply Reply Quote 0
                          • P
                            patpa11
                            last edited by

                            @deajan:

                            Hi,

                            I'm not really sure what's your usecase here, but if I understand right, you want users to self sign in on a first wireless network, then have them connect on the secured wireless network with the credentials they created earlier.
                            You would have to modify the code of the captive portal to add a password option (let's say instead of the room number or so).
                            Then you'd need to add the pfSense FreeRADIUS server to your WPA2 setup.
                            Could you elaborate a bit please ?

                            That's exactly what I want to implement.
                            I've got three LANCOM L-322agn Access Points, one LANCOM WLC-4006+ Controller and a pfSense Setup. This will be used for a public WLAN in a small industrial area. The idea is to provide these two SSIDs with the access points at the same time. I do not want to use a "normal" WPA with pre shared key to provide more security when using the WLAN without VPN. I Think 802.1x/EAP with MSCHAPv2 or somethink like that would be better. What would be the best way to do that with your Captive portal solution? My PHP and JavaScript knowledge is unfortunately limited  :-\

                            1 Reply Last reply Reply Quote 0
                            • A
                              asbonet
                              last edited by

                              Is there any way with this setup to limit the amount of data one user can use at one time? say i want user bob to only have a max download limit of 1 GB for the duration of his time at the hotel?

                              1 Reply Last reply Reply Quote 0
                              • D
                                deajan
                                last edited by

                                Especially for Bob ? or All Bobs ? :)

                                NetPOWER.fr - some opensource stuff for IT people

                                1 Reply Last reply Reply Quote 0
                                • A
                                  asbonet
                                  last edited by

                                  @deajan:

                                  Especially for Bob ? or All Bobs ? :)

                                  All Bobs lets say have a max download each of 1gb and all daves have max download of 500mbs

                                  i have tried this
                                  INSERT INTO radcheck (id, username, attribute, op, value)VALUES (NULL, 'bob', 'Acct-Output-Octets', ':<', '5242880');
                                  INSERT INTO radcheck (id, username, attribute, op, value)VALUES (NULL, 'bob', 'Acct-Output-Octets', ':=', '5242880');
                                  INSERT INTO radcheck (id, username, attribute, op, value)VALUES (NULL, 'bob', 'Acct-Output-Octets', ':!=', '5242880');
                                  INSERT INTO radcheck (id, username, attribute, op, value)VALUES (NULL, 'test3', 'Max-forever-Octets', ':=', '5242880');

                                  I guess im not supposed to do this as Freenas documentation says i cant use < as a operator for check…. any idear ?

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    deajan
                                    last edited by

                                    You should check FreeRADIUS docu for this: https://wiki.freeradius.org/modules/Rlm_sqlcounter
                                    Also, check that rlm_sqlcounter module is present in pfSense :)

                                    NetPOWER.fr - some opensource stuff for IT people

                                    1 Reply Last reply Reply Quote 0
                                    • G
                                      giovani.junior
                                      last edited by

                                      Hi Deajan!
                                      I am trying to implement your solution at a hotel.
                                      So also Freeradius and MySQL are working fine, but the Captive Portal didn't.
                                      I tried twice, building two VMs in Virtual Box and pfSense 2.3 (last stable version).  The first machine, after fill the form and accept the terms of use, when I click on confirm button appears 404 error.  After hours and hours looking for what could be happening I gave up and decided to start over again, building a new VM.
                                      In the second VM I took the same case: MySql and Freeradius are working fine, but now when I click on confirm button appears a blank page without any error.  In browser address bar appears the Server IP + /$ symbol.
                                      Can you advice me to find a solution?  I had past entire Sunday doing this!
                                      My best regards!
                                                              Giovani

                                      PS: I found in my downloads a 2.2 pfSense version.  I was thougthing in do a downgrade.

                                      1 Reply Last reply Reply Quote 0
                                      • GertjanG
                                        Gertjan
                                        last edited by

                                        @giovani.junior:

                                        ….  when I click on confirm button appears 404 error.  After hours and hours looking for what could be happening I gave up and decided to start over again, building a new VM.
                                        In the second VM I took the same case: MySql and Freeradius are working fine, but now when I click on confirm button appears a blank page without any error.  In browser address bar appears the Server IP + /$ symbol.
                                        ....

                                        (The captive portal) web server log didn't mention what happened ??
                                        Are you using the default built-in captive portal page ?

                                        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
                                          deajan
                                          last edited by

                                          @giovani.junior: Don't use the integrated view button as behavior changed in 2.3.2+, see https://forum.pfsense.org/index.php?topic=132106.0
                                          Also, have you configured the redirection address for the CP ?

                                          NetPOWER.fr - some opensource stuff for IT people

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            mastrus
                                            last edited by

                                            Hi everyone, I modified the template for adding profilation and for ask a question to a clients.

                                            Here is the file

                                            https://github.com/mastrus/pfSense-cp-auth-onestep

                                            Now I want to ask if is possible to have first autentication after 2 hours and one autentication after 8 hours with a different form page.

                                            You can say how Do it?

                                            I have also automated by shell script the creation of the machine with captive portal (after also i post the code).

                                            Thanks in advance

                                            Alessandro

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.