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

    One Voucher Per Device

    Scheduled Pinned Locked Moved Captive Portal
    147 Posts 12 Posters 38.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.
    • C
      colleytech @Gertjan
      last edited by

      @Gertjan said in One Voucher Per Device:

      Using vouchers ?
      Don't think so. That means changing the code - > more php editing in this case.

      But I'm doing exactly that right know at my work : a hotel.
      Classic login users (not vouchers) - and a unique password for each room.
      And freeradius, that limit just fine each user at 2 max logins.

      @Gertjan would you mind sharing your progress and code when you successfully get it to work on 2 devices per user.. regards

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

        No progress, no code needed.

        As said, you need Freeradius. The package.

        On the first user you declare in Freeradius, you add this in the advanced section :

        6a317413-f815-4408-b038-95a61872e4eb-image.png

        All further user will use this setting : not more then 2 logins per account.

        How to set up Freeradius ?
        That's not a question. This thing is huge and needs to be studied. It's like a mail server or web server, there is no such thing as "a click here and click therr and your up".

        I advise that you start looking at the videos from Netgate on Youtube.

        Not that it really matters, but I'm using a MySQL (Maria) DB server for the Freeradius storage needs. That just a choice, none is needed actually, Freeradius can also work with a flat file data base, stored on the pfSense drive.

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

        C 2 Replies Last reply Reply Quote 0
        • C
          colleytech @Gertjan
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • C
            colleytech @Gertjan
            last edited by

            @Gertjan said in One Voucher Per Device:

            No progress, no code needed.

            As said, you need Freeradius. The package.

            On the first user you declare in Freeradius, you add this in the advanced section :

            6a317413-f815-4408-b038-95a61872e4eb-image.png

            All further user will use this setting : not more then 2 logins per account.

            @Gertjan ...ok.. i have added this above line in the freeRadius, with option 3 (First sessions per username / voucher) selected in non concurrent login, but only one device can log in, the second device comes wit the error "reuse of id not allowed'
            am i missing something??

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

              @colleytech said in One Voucher Per Device:

              the second device comes wit the error "reuse of id not allowed'
              am i missing something??

              Ah, so you're using my code that changes somewhat the way how vouchers login :

              1. many
              2. only last
              3. only first

              Right ?
              You can't change that behavior, except if you are will to "play"with the code (PHP script).

              If you are willing to drop voucher usage, and step over to the classic user/password,
              and
              you use FreeRadius
              then
              you could have something like
              " Simultaneous-Use := 3 "
              (maximum 2 user per login now )

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

              C 2 Replies Last reply Reply Quote 0
              • C
                colleytech @Gertjan
                last edited by

                @Gertjan said in One Voucher Per Device:

                @colleytech said in One Voucher Per Device:

                the second device comes wit the error "reuse of id not allowed'
                am i missing something??

                Ah, so you're using my code that changes somewhat the way how vouchers login :

                1. many
                2. only last
                3. only first

                Right ?
                You can't change that behavior, except if you are will to "play"with the code (PHP script).

                If you are willing to drop voucher usage, and step over to the classic user/password,
                and
                you use FreeRadius
                then
                you could have something like
                " Simultaneous-Use := 3 "
                (maximum 2 user per login now )

                @Gertjan your code works with freeRadius users, thats what i use it for.. i dont mind going without vouchers..
                if you use the default pfsense php code, the simultaneous-use =3 will work, but it wil always disconnect the logged in user, to make way for the new login...
                just like what your code is doing, stopping reuse of id without disconnecting the current user,, is there a way to achieve that with freeRadius.. whereby, after two devices logs in, the third one will be dropped, instead of the already logged in devices..
                Regards

                1 Reply Last reply Reply Quote 0
                • C
                  colleytech @Gertjan
                  last edited by

                  you use FreeRadius

                  then
                  you could have something like
                  " Simultaneous-Use := 3 "
                  (maximum 2 user per login now )

                  @Gertjan i am still battling with this๐Ÿ˜๐Ÿ˜... is there a way i could use this and stil not get my two connected devices disconnected when a third login attempt is done..
                  the goal is to get two devices per user, then a third login will be dropped instead of it, disconnecting an already connected device..

                  thanks in advance

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

                    @colleytech said in One Voucher Per Device:

                    @Gertjan i am still battling with this... is there a way i could use this and stil not get my two connected devices disconnected when a third login attempt is done..
                    the goal is to get two devices per user, then a third login will be dropped instead of it, disconnecting an already connected device..

                    That what's I'm doing right now. With FreeRadius.
                    Without it : I guess not.

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

                    C 1 Reply Last reply Reply Quote 0
                    • C
                      colleytech @Gertjan
                      last edited by

                      @Gertjan

                      @Gertjan said in One Voucher Per Device:

                      @colleytech said in One Voucher Per Device:

                      @Gertjan i am still battling with this... is there a way i could use this and stil not get my two connected devices disconnected when a third login attempt is done..
                      the goal is to get two devices per user, then a third login will be dropped instead of it, disconnecting an already connected device..

                      That what's I'm doing right now. With FreeRadius.
                      Without it : I guess not.

                      @Gertjan ,
                      kindly indulge me, whenever i do it with freeradius, two devices will connect, but a third device attempting to log in will always disconnect one of the already logged in devices, thats what i am trying to avoid,,, if there is any additional setting or line of code to be added, kindly point me to it,

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

                        @colleytech said in One Voucher Per Device:

                        whenever i do it with freeradius, two devices will connect, but a third device attempting to log in will always disconnect one of the already logged in devices

                        ??
                        That's not my experience.

                        The " Simultaneous-Use := 2 " statement will not allow a third login.
                        It doesn't kick out one of the two already logged in users.

                        Example :

                        6dab1bee-9514-442d-ab62-6dd2f698f9bc-image.png

                        Room number (== uiser) 116 : 2 parents and 3 kids.
                        2 iPads, 3 iPhones, some Samsung device, a Kindle and some other wifi device (a portable PC ?).

                        The first two logins for user "116" work fine, a third one get authenticated (same user = "116" and password) but gets thrown out a couple of seconds during the REAUTHENTICATION process : the max user threshold was reached.

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

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          colleytech @Gertjan
                          last edited by

                          @Gertjan said in One Voucher Per Device:

                          @colleytech said in One Voucher Per Device:

                          whenever i do it with freeradius, two devices will connect, but a third device attempting to log in will always disconnect one of the already logged in devices

                          ??
                          That's not my experience.

                          The " Simultaneous-Use := 2 " statement will not allow a third login.
                          It doesn't kick out one of the two already logged in users.

                          Example :

                          6dab1bee-9514-442d-ab62-6dd2f698f9bc-image.png

                          Room number (== uiser) 116 : 2 parents and 3 kids.
                          2 iPads, 3 iPhones, some Samsung device, a Kindle and some other wifi device (a portable PC ?).

                          The first two logins for user "116" work fine, a third one get authenticated (same user = "116" and password) but gets thrown out a couple of seconds during the REAUTHENTICATION process : the max user threshold was reached.

                          @Gertjan i must be missing something,,,
                          i have restored the box to factory and setup captive portal fresh, with no concurrent checked, and Simultaneous-Use := 3 placed in the freeRad user, i can get just one user connected, other subsequent users disconnects the first user "not what i want"..............

                          no concurrent unchecked and Simultaneous-Use := 3 placed in the freeRad user, i can log in with multiple devices, "not what i want"

                          applying your patch to select
                          1.many
                          2. only last
                          3. only first
                          and Simultaneous-Use := 3 placed in the freeRad user, doesnt still get the job done,,,,
                          what can i post here for you to check

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

                            @colleytech said in One Voucher Per Device:

                            applying your patch to select
                            1.many
                            2. only last
                            3. only first

                            That patch has nothing to do with FreeRadius.

                            @colleytech said in One Voucher Per Device:

                            her subsequent users disconnects the first user "not what i want"..............

                            I have to check things tomorrow, when I'm on site.
                            Look at my image = log again.
                            See (bottom) the oldest login. Just above (log is reverse) some OTHER 116 user is disconnected ... etc.

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

                            C 2 Replies Last reply Reply Quote 0
                            • C
                              colleytech @Gertjan
                              last edited by colleytech

                              That patch has nothing to do with FreeRadius.
                              @Gertjan maybe u didn't test the patch,, that patch overrides every setting, anything u apply on freeRadius doesnt reflect, as far as the patch is there.. the patch is so powerful ๐Ÿ˜€

                              I have to check things tomorrow, when I'm on site.
                              Look at my image = log again.
                              See (bottom) the oldest login. Just above (log is reverse) some OTHER 116 user is disconnected ... etc.

                              @Gertjan please do,, i wil be so grateful if i accomplish my goal

                              1 Reply Last reply Reply Quote 0
                              • C
                                colleytech @Gertjan
                                last edited by

                                @Gertjan said in One Voucher Per Device:

                                I have to check things tomorrow, when I'm on site.

                                @Gertjan , any luck?

                                1 Reply Last reply Reply Quote 0
                                • R
                                  rayyanthameem @Gertjan
                                  last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rayyanthameem @Gertjan
                                    last edited by

                                    @Gertjan said in One Voucher Per Device:

                                    Captive portal users get message you are connected but there is no internet

                                    I was trying to apply this patch and I'm getting below error:

                                    Patch can NOT be applied cleanly (detail)
                                    Patch can NOT be reverted cleanly (detail)

                                    I can apply the patch by editing the below files,

                                    src/etc/inc/captiveportal.inc
                                    src/etc/inc/system.inc
                                    src/usr/local/captiveportal/index.php

                                    but I'm using your version of 'src/etc/inc/captiveportal.inc'

                                    What is the solution for this?

                                    Thanks in advance

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

                                      @rayyanthameem said in One Voucher Per Device:

                                      I was trying to apply this patch and I'm getting below error:
                                      Patch can NOT be applied cleanly (detail)
                                      Patch can NOT be reverted cleanly (detail)

                                      So :

                                      @Gertjan said in One Voucher Per Device:

                                      See the 'other' thread that handles that subject.
                                      See also here : https://github.com/pfsense/pfsense/pull/4042 the solution is in feedback stage. The patch can be imported 'official' (again, see other other thread for details how to do so).

                                      This thread handles an entire other issue.

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

                                      R 1 Reply Last reply Reply Quote 0
                                      • R
                                        rayyanthameem @Gertjan
                                        last edited by

                                        @Gertjan Thanks for your help, I hope this is the patch I've to apply: https://patch-diff.githubusercontent.com/raw/pfsense/pfsense/pull/4042.diff

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

                                          @rayyanthameem said in One Voucher Per Device:

                                          https://patch-diff.githubusercontent.com/raw/pfsense/pfsense/pull/4042.diff

                                          That's the one.
                                          As you noticed, the patch can't be applied against a 2.4.4-p3 on your device.
                                          This is because the actual version of pfSense on github is more recent (like a 2.4.4-p4) then the version you have (2.4.4-p3).
                                          So, first, you have to retrieve from github the most recent files for :
                                          /etc/inc/captiveportal.inc
                                          /usr/local/captiveportal/index.php
                                          /etc/inc/system.inc

                                          Then the patch can be applied.

                                          I using it right now :

                                          43a21d06-4afb-4f7f-84d2-e8efcfaded1a-image.png

                                          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
                                          • R
                                            rayyanthameem @Gertjan
                                            last edited by

                                            @Gertjan said in One Voucher Per Device:

                                            Here we go:
                                            This is the new /etc/inc/captiveportal.inc file:
                                            https://pastebin.com/V6uWHNz5

                                            Now I am using your version of 'captiveportal.inc'

                                            Are you suggesting except 'captiveportal.inc' use everything els and apply patch?

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