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

    One Voucher Per Device

    Captive Portal
    12
    147
    34.6k
    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.
    • 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
                        • W
                          wazim4u
                          last edited by

                          In Middle East we have labor camps having 1000-15000 users and everywhere people get internet with very low rate 0.25 Cents per day. So selling internet is a big business here and there are 1000 of labor camp.
                          i wanted to make Captive portal with FreeRadius it works but i didn't get any option to create bulk users adding 2000 to 3000 plus users from PF GUI. adding one by one user is very difficult.
                          Also get issue if any changes you make in live system under captive portal users get message you are connected but there is no internet. Using hardtime out & idle time will not require voucher to enter again ? it will re authenticate vouchers automatically.? currently i have no hardtime or idle time set, suggest me your recommended values ( vouchers are for one month time period always )

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

                            @wazim4u said in One Voucher Per Device:

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

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

                            I advise you that you install this patch right away.
                            At least, you can edit your settings (do you have to edit your settings ?) without all connected users being thrown out.
                            Right now, after an edit you have to purge the connected user list - if you don't, connected users will hit the "You are already connected" text.

                            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
                            • 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:

                                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.

                                @Gertjan this worked great for me, as i wanted, but one challenge i have, just one,,,, instead of one login per user, i wanted 2logins per user, so that a guest could log in with laptop and phone, after the two devices, every subsequent logins with the same credential will be dropped..
                                kindly guide me through if it is possible..

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

                                  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.

                                  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:

                                    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 , not for voucher, but usernames and passwords...almost same environment.. users can log in with room number and surname as username and password..... then vouchers can be for conference guests... where a particular voucher can be adjusted for the amount of conference participants

                                    1 Reply Last reply Reply Quote 0
                                    • DerelictD
                                      Derelict LAYER 8 Netgate
                                      last edited by

                                      A voucher can be for one device or anyone with the code. There is no numeric limit that can be applied.

                                      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
                                      • 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
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.