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 34.9k 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.
    • A
      ajmaltms @Gertjan
      last edited by

      @Gertjan yes..thats what i want...first login..

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

        Good !

        I'll post back here when I have a Feature request.
        Attached to the feature request I'll be posting a pull request. At that moment, with the System_Patches package you can then retrieve the proposed pull request into your own pfSense to test drive the new code.
        Eventually, if the pull request gets granted - IF this happensbolded text, the feature will be build into al new pfSense version.
        This will take time - as most attention goes to "2.5.0" these days.

        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
        • DerelictD
          Derelict LAYER 8 Netgate
          last edited by

          It is unclear how someone would just allow all concurrent logins there.

          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)

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

            @Derelict said in One Voucher Per Device:

            It is unclear how someone would just allow all concurrent logins there.

            I agree.
            "Disabled" isn't the correct description.

            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
            • GertjanG
              Gertjan
              last edited by

              cfbf5d94-fdd0-4e51-8f27-d26521a813f1-image.png

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

              DerelictD L 2 Replies Last reply Reply Quote 0
              • DerelictD
                Derelict LAYER 8 Netgate @Gertjan
                last edited by

                @Gertjan that seems more clear.

                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
                • GertjanG
                  Gertjan
                  last edited by Gertjan

                  @ajmaltms : could not 'chat' all this to you, there is a 1000 char limit - so here it is :

                  Ready for the first try ?
                  Before you start, throw out all connected users. People that were logged in using Vouchers, in your case, that aren’t expired yet will be able to reconnect afterwards.

                  Make backup copies of the two files that will get modified.
                  I advise you to use the console access, option 8.
                  And/or SFTP access is also advisable – FileZilla does that just fine – Note : use SFTP, NOT to be confused with FTP.

                  Make a backup copy of this file

                  cp /etc/inc/captiveportal.inc  /etc/inc/captiveportal.inc.original
                  

                  Another file to make a copy from :

                  cp /usr/local/www/services_captiveportal.php /usr/local/www/services_captiveportal.php.original
                  

                  Thus, now you have spare copies of the 2 files that will be changed.

                  Here we go:
                  This is the new /etc/inc/captiveportal.inc file:
                  https://pastebin.com/V6uWHNz5
                  This is the new /usr/local/www/services_captiveportal.php file.
                  https://pastebin.com/QLhNhgAW

                  When these two files are in place, visit the portal config page, check your “Concurrent user login” settings: check one option out of the 3. I guess it will be “First” for you ^^ (see image above).

                  If there are any troubles, just copy your backup files back in place, like this (copy – paste these 2 commands will do that ) :

                  cp /usr/local/www/services_captiveportal.php.original /usr/local/www/services_captiveportal.php
                  cp /etc/inc/captiveportal.inc.original /etc/inc/captiveportal.inc
                  

                  You’ll be seeing messages in your captive portal log file like:

                  .... CONCURRENT VOUCHER LOGIN - NOT ALLOWED - KEEPING OLD SESSION …
                  

                  Which informs you that the same voucher was used a second time – the connection was refused.

                  I do not pretend that everything works perfect right now. This is just a first test.

                  I tested all 3 settings of “concurrent login” myself using Vouchers AND the classic Local manger user logins – both behave now as I want:

                  • Multiple sessions per username / voucher
                  • Last sessions per username / voucher
                  • First sessions per username / voucher

                  The last one is the one you want to test.

                  Take your time to test – read the log file – send it over to me if question (use pastebin.org – not here in the forum)

                  Good luck.

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

                  A R C 5 Replies Last reply Reply Quote 0
                  • A
                    ajmaltms @Gertjan
                    last edited by

                    @Gertjan not showing the three types of concurrent logins..but not working..still voucher can use same time..

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

                      @ajmaltms said in One Voucher Per Device:

                      not showing the three types of concurrent logins..but not working

                      Not showing but not working ?
                      Check this file /usr/local/www/services_captiveportal.php (in your pfSense)- for example lines 709 up until line 711 - you should see :

                      c5e39894-9568-4532-b9f9-e249cc1ed630-image.png

                      To assure you : the file I upload, is the file I'm using right now. "services_captiveportal.php" is part of the Captive portal settings GUI.
                      I tend to say : if you don't see anything change (only the "Concurrent user logins" item) you didn't copy the file.

                      edit : same thing for the file /etc/inc/captiveportal.inc - check line 2323. You should see this comment :

                      /* Implicit 'first' : refuse the new login - 'username' is already logged in */
                      

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

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        ajmaltms @Gertjan
                        last edited by

                        @Gertjan sorry..showing 3 types..but not working

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

                          @ajmaltms

                          Well, show a test case.
                          Use a voucher on a device.
                          Use the same voucher on another device.
                          Show the log.

                          edit : run this

                          grep 'noconcurrentlogins' /conf/config.xml
                          

                          What is the output ?

                          edit 2019-04-19 :

                          This is what I see when I set " Concurrent user logins" " to "First".
                          I have a voucher "TYUURMVP423SB" and use it on a device :

                          Apr 19 10:20:56 	logportalauth 	52629 	Zone: cpzone1 - Voucher login good for 5 min.: TYUURMVP423SB, b0:70:2d:44:fc:da, 192.168.2.217
                          

                          Now I use the same voucher on another device :

                          Apr 19 10:23:10 	logportalauth 	63782 	Zone: cpzone1 - CONCURRENT VOUCHER LOGIN - NOT ALLOWED KEEPING OLD SESSION : TYUURMVP423SB, b0:70:2d:44:fc:da, 192.168.2.217
                          

                          and I see a message in red on my captive portal "error" login page :

                          a8d6c7a3-5529-4ab8-8f08-ba29e7c15be9-image.png

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

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            ajmaltms @Gertjan
                            last edited by

                            @Gertjan which pfsense version u are using?

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

                              2.4.4-p2

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

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                ajmaltms @Gertjan
                                last edited by ajmaltms

                                @Gertjan am using 2.3.5 may be thats the issue

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

                                  Sure.
                                  pfSense portal code on 2.4.4-p2 is different.
                                  There is no development for the 2.3.5 anymore - I don't have it.

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

                                  A 1 Reply Last reply Reply Quote 0
                                  • A
                                    ajmaltms @Gertjan
                                    last edited by

                                    @Gertjan ok..let me chekit out with 2.4.4 p2

                                    1 Reply Last reply Reply Quote 1
                                    • A
                                      ajmaltms @Gertjan
                                      last edited by

                                      @Gertjan thanks a lot..finally worked with 2.4.4 p2

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

                                        Ok, great !

                                        I updated these a week or so :
                                        @Gertjan said in One Voucher Per Device:

                                        This is the new /etc/inc/captiveportal.inc file:
                                        https://pastebin.com/V6uWHNz5
                                        This is the new /usr/local/www/services_captiveportal.php file.
                                        https://pastebin.com/QLhNhgAW

                                        I'll post back here when I make more edits.

                                        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 1
                                        • W
                                          wazim4u
                                          last edited by

                                          Hi Gerjan,

                                          I have tried your code it was working fine, when i tried it in live system up to 3000 Captive portal users i got a lot of issue giving message to reuse of identification not allowed . it works only when you manually disconnect user and sometimes after few days again it give same error and not let use to login. i get back to original system ( default PFsense ) using version latest 2.4.4-p3

                                          this is very great feature i think it need more stability. this feature should be by default a part of pfsense

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

                                            Hi,

                                            @wazim4u said in One Voucher Per Device:

                                            it works only when you manually disconnect user

                                            What do you mean by manually disconnecting ?
                                            Why should you ?
                                            What is your idle timeout ? hard timout ?.

                                            Keep in mind, users are disconnected from the portal after one of these two becomes "true".
                                            Users can reauth again of course, as long as their voucher isn't expired.

                                            f276eac8-4973-4117-a1cf-e698c3ccc5a3-image.png

                                            This means that while a user has an active session with his voucher, other reuse attemps are

                                            1. accepted - multiple users will get connected with the same vouchers,
                                            2. the initial user is thrown out, only the last login persists,
                                              or, new (my patch):
                                            3. subsequent users are not allowed to login.

                                            Point 1 & 2 is the behaviour pfSense currently offers.
                                            Point 3 is what my patch should offer.

                                            Point 3 has a caveat : the user with a valid voucher should be 'logged in' all time onto the captive portal, so subsequent logins can be refused. If not, the 'initial' login with voucher always wins, even if it is a new device ...
                                            This can be enforced with a (example) hard timeout of "0" and a soft time out of at least the maximum voucher time.
                                            This way, vouchers users stay logged, even if there is no activity. Subsequent login attempts will get refused.
                                            Finally, the vouchers expires, and the portal will flush their firewall rules / login info .

                                            @wazim4u said in One Voucher Per Device:

                                            after few days again it give same error

                                            What error ?

                                            @wazim4u said in One Voucher Per Device:

                                            i think it need more stability

                                            True it was just an idea.
                                            The thing is, for good development, I should use github and working with a pull request, and thus basing myself on the latest dev version = some 2.5.0.xxxxx file version.
                                            This means that I should have a "2.5.0" somewhere - but not on my work, where I use pfSense already, using Captive Portal coupled to FreeRadius.
                                            Keep in mind that I'm not actively use vouchers myself. The idea of "selling" Internet time doesn't really exists any more (Europe). I can throttle down a user if abuse is detected, that's enough for me.

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

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