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

    How to Captive Portal Self Registration Using Free radius & Mysql (Tutorial)

    Scheduled Pinned Locked Moved Captive Portal
    59 Posts 28 Posters 148.5k 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.
    • S
      sash99
      last edited by

      well rebuilt pfsense amd64 firewall again , with full web host abilities and mysql. ( basically the same as doing it for i386 just change the i386 to amd86 ie:

      pkg_info -r http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/8.1-RELEASE/packages/All/php52-mysql-5.2.13_3.tbz

      to

      pkg_info -r http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/8.1-RELEASE/packages/All/php52-mysql-5.2.13_3.tbz

      but still no go with the self register. no entries added into the  database.  mysql server/client working  with in pfsense fine as I can build websites with mysql database in them ( ie joolma etc ) plus phpmyadmin is working fine too on the pfsense machine..

      it probably something simple I just do not know what going wrong and where..

      where can I manual add a user into the data base and its format.  atleast then I would be able to narrow down the problem, by verify that that login works via the database. I know that the page talks to the data base as it was popping up the error earlier due to the missing table (reg_users). now I want to see if it reads the database. then at least I will know that it only a write problem.

      thank you for your time
      sash

      1 Reply Last reply Reply Quote 0
      • S
        sash99
        last edited by

        okay this has me stumped for now..
        I reinstalled  the computer as i386 pfsense instead of amd64
        and what I have learned
        for some strange reason the error page works on the I386  version and not the amd64 version

        radtest  seams to work  fine it sends data to mysql so  freeradius and mysql are working fine as it enter mysql data entries into it automatically

        if I install the radius data base with out  reg_user table  the self registration  captive portal page see that it missing table  and fails on  registration .so    captive portal seems to be configure correctly as the  self registration webpage has access to the radius database because  of the table error

        if If have the reg_user  table imported.  into radius database  I no longer  get an error.

        But it does not write anything into reg_user table upon completion of registration  ( so it tells me i have  no write capability or  some sort un seen  mysql error happening  that prevents it from writing)

        if I manual enter in a  user via insert in phpmyadmin into the  reg_users . I also have  have no access and the  self registration  web page  flags that as an unknown user.. so it  it can not read reg_user table for some reason either ..

        it a funny problems and I know very little of mysql to be able debug it easily  – well lets see if any one can successfully get  this self registration page to work.. as at this point I can not  , or at least on a single  pfsense machine  firewall/web serve/database machine anyways..

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

          if I manual enter in a  user via insert in phpmyadmin into the  reg_users . I also have  have no access and the  self registration  web page  flags that as an unknown user.. so it  it can not read reg_user table for some reason either ..

          actually "reg_users" table is not necessary for captive portal this table is for monitoring user registration with extra field & cheks mac based security. free radius checks only "radcheck" for user & password. you can manually enter there.

          But it does not write anything into reg_user table upon completion of registration  ( so it tells me i have  no write capability or  some sort un seen  mysql error happening  that prevents it from writing)

          from your configuration i think you dont have permition to write in mysql database. this can be caused if  you dont have permission to write in that folder/disk. or your mysql user privilege is not enough.

          can u please send me your mysql server details.

          my system is running with 20 registered user & increasing every day.

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

            @sash99

            I have tested your config in vmware 9 environment with 2.0.2-RELEASE (i386). what i did
            1. installed pfsense.
            2. installed mysql & vhost according to your post.
            3. installed php52-mysql as i mentioned before.
            4. installed free radius2.
            5. config them all
            6. uploaded all the captive portal file.

            but everything seems ok for me. i can register & data also available in database.

            if u are interested i can upload the vmware image.

            sorry to mention before….. i file (main css "bootrtrap.min.css") missing in my captiveportal file list, for which design was not perfect. added in this post.

            can any moderator would be kind to attach this file in my main post please??

            captiveportal-bootstrap.min.css.txt

            1 Reply Last reply Reply Quote 0
            • S
              sash99
              last edited by

              sure I will try your vmware image. hopefully it run in my vm machine  ( I am not using Vmware but usually not to much  problem with different  Vmdisk images from other  programs )

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

                Sorry For my delayed reply. i have uploaded virtual image as open virtual format in Google drive. link

                https://docs.google.com/file/d/0B7TKCwKoq_lNdDRmVERaT0ZaeU0/edit

                first network adapter is WAN
                2nd network adapter is LAN

                webgui:

                https://192.168.26.1:1337/index.php

                username : admin
                password: pfsense

                phpmyadmin:

                192.168.26.1:8001/phpmyadmin/

                username: root
                password: pfsense

                best of luck. don forget to update ur result. let me know if face any error.

                1 Reply Last reply Reply Quote 0
                • T
                  thenomad
                  last edited by

                  I am on an VMWare exi5.1.0 server … fo some reason I cannot get either network interfaces in you vm to come up.  It looks to be there but no traffic passes... any ideas??

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

                    @thenomad:

                    I am on an VMWare exi5.1.0 server … fo some reason I cannot get either network interfaces in you vm to come up.  It looks to be there but no traffic passes... any ideas??

                    what is your virtual network settings? i used wan bridged with my netbook wifi and lan as a host only network.l

                    1 Reply Last reply Reply Quote 0
                    • T
                      thenomad
                      last edited by

                      I fixed it I think… the interface mappings got flipped somehow ... thanks for your reply It got me in the right direction !

                      1 Reply Last reply Reply Quote 0
                      • T
                        thenomad
                        last edited by

                        Ok it IS working as advertised ;D

                        but I have one question (from a NON FreeBSD admin) What is the path for the portal php files  does it just sit in /var/etc ??

                        1 Reply Last reply Reply Quote 0
                        • T
                          thenomad
                          last edited by

                          Well I THOUGHT it was working …
                          User cannot log in

                          error message from the portal

                          Your Email & Password Doesnot Match. If you Dont Have Any please Register

                          If you think This is an Error Of This System Please Contact Us.

                          This is right after the user creates himself through registration.
                          Peeking at the database the information (including the password is there)

                          BTW phpmyadmin is NOT installed as was indicated used webmin

                          If you attempt to re register it tells you that you already have a account under the username

                          message is : You are already registered. with <what ever="" the="" name="" user="" registered="" with="">Hellp  :'(</what>

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

                            @thenomad:

                            Well I THOUGHT it was working …
                            User cannot log in

                            error message from the portal

                            Your Email & Password Doesnot Match. If you Dont Have Any please Register

                            If you think This is an Error Of This System Please Contact Us.

                            This is right after the user creates himself through registration.
                            Peeking at the database the information (including the password is there)

                            What is your log in system in portal auth log?
                            anyway i just test it to selfregistration didnt checked full functionality. please adjust the shared secret in free radius nas & captive portal page.

                            BTW phpmyadmin is NOT installed as was indicated used webmin

                            of course i have installed phpmyadmin. after your comment i have dloaded from google drive and checked again.

                            If you attempt to re register it tells you that you already have a account under the username

                            message is : You are already registered. with<what ever="" the="" name="" user="" registered="" with=""></what>

                            i have designed this pages for a hotspot solution. so i add some mac based security, like a client with a mac can only register 1 account. if u want to create multiple account change ur mac address. or delete previous account from sqlserver via phpmyadmin

                            did Anybody got this tutorial helpful? bcos i have seen more then 10 download of my cp pages. only 2 of them replied.

                            1 Reply Last reply Reply Quote 0
                            • S
                              sash99
                              last edited by

                              HI khan..
                              tried your Vmware image. I can not get it work for me.. the virtualimage works and all but the  root partion in  not set at drive position 0  (ad0s1a) in pfsense    but at the 3rd disk  (ad3s1a).  and your ovf is incompatible.  i tried with a couple virtual machine always the same error  non compliant ovf.  even tried it in Vmplayer same difference….  and when I force it to boot ad0s1a  ( with the mountroot> ufs:/dev/ad0s1a )  in other virtual machines.  pfsense is all broken.. and/or vmware  server just  make it really incompatible with anything other then itself..

                              I even open it up in live boot BSD (frenzy) and edited as much as could but it still refuses to work for me

                              perhaps if you like to to make a vm appliance with virtualbox or simular

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

                                @sash99:

                                perhaps if you like to to make a vm appliance with virtualbox or simular

                                ok i am creating a oracle virtual box image. need some time.

                                1 Reply Last reply Reply Quote 0
                                • W
                                  whoei
                                  last edited by

                                  Thnx! I would like to test with a virtualbox image!

                                  1 Reply Last reply Reply Quote 0
                                  • N
                                    novicenaja
                                    last edited by

                                    ไม่มีใช้กับ captive portal บ้างเหรอครับ ทำไมมีแต่ free radius

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

                                      Sorry for delayed reply.

                                      I have uploaded file for virtual machine created with oracle virtual box. Double checked. rar file with recovery record.

                                      https://docs.google.com/file/d/0B7TKCwKoq_lNYjJ3cE53T013Y28/edit

                                      first network adapter is WAN (192.168.0.0/23 subnet) change as your requirement.
                                      2nd network adapter is LAN (192.168.100.0/24 subnet)

                                      Webgui:

                                      http://192.168.100.1:1337

                                      Username: admin
                                      Password: pfsense

                                      phpmyadmin:

                                      http://192.168.100.1:8001/phpmyadmin/

                                      Username: root
                                      Password: pfsense

                                      Captiveportal

                                      http://192.168.100.1:8000

                                      Mac based security is enable. so if u need multiple account from one mac please login to phpmyadmin change mac value in reg_user table first.

                                      I am writing a step by step "how to ". but need some time.
                                      anyway post your comment.

                                      1 Reply Last reply Reply Quote 0
                                      • N
                                        neewbie
                                        last edited by

                                        yes and be running

                                        1 Reply Last reply Reply Quote 0
                                        • W
                                          whoei
                                          last edited by

                                          I'm testing with the virtualbox image but I get exactly the same message as Thenomand:

                                          _Your Email & Password Doesnot Match. If you Dont Have Any please Register

                                          If you think This is an Error Of This System Please Contact Us._

                                          This is also right after the user creates himself through registration.
                                          Peeking at the database the information (including the password is there)

                                          If you attempt to re register it tells you that you already have a account under the username

                                          message is : You are already registered. with <what ever="" the="" name="" user="" registered="" with="">Anyone how to solve this?</what>

                                          1 Reply Last reply Reply Quote 0
                                          • W
                                            whoei
                                            last edited by

                                            After replacing 127.0.0.1 for 192.168.100.1 @ radius settings by captive portal and nas /client en interface settings by FreeRadius it works!

                                            Is there any solution that multiple users can register from one PC without changing the mac address in DirectAdmin?

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