• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.
  • G
    Gertjan
    last edited by Apr 17, 2019, 4:12 PM

    Yup - that's what I proposed earlier in this thread - a day or so ago.
    But : I have some code to play with that does just what @ajmaltms wants.

    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
      Derelict LAYER 8 Netgate
      last edited by Apr 17, 2019, 4:13 PM

      Then that would be a pull request for that feature request :)

      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
      • A
        ajmaltms @Gertjan
        last edited by Apr 17, 2019, 4:26 PM

        @Gertjan yes..Voucher being used ones not usable for a next (concurrent) login..is it possible ?

        1 Reply Last reply Reply Quote 0
        • G
          Gertjan
          last edited by Apr 17, 2019, 4:41 PM

          @Derelict well, maybe I should write it out again .... I'll have a try.

          He we go : the GUI part first :

          @ajmaltms :
          This looks good for you :

          login-to-view

          Btw : writing this up will take some time for me.
          I'm writing this on a "live" system, and I'm not using Vouchers, but FreeRadius.

          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 Apr 17, 2019, 4:59 PM Reply Quote 1
          • D
            Derelict LAYER 8 Netgate
            last edited by Apr 17, 2019, 4:48 PM

            This is not the forum for feature and pull requests.

            https://redmine.pfsense.org/
            https://github.com/pfsense/pfsense/

            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
            • G
              Gertjan
              last edited by Apr 17, 2019, 4:51 PM

              Don't worry, won't publish any PHP stuff here.
              Just want to be sure I'm writing something useful.

              When done and tested, I'll locate a feature request if one exists, and add my implementation as a pull request / review.

              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
                Derelict LAYER 8 Netgate
                last edited by Apr 17, 2019, 4:55 PM

                No problem posting it. It's just that it probably won't get looked at by the right people unless it is put in the right places.

                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
                • A
                  ajmaltms @Gertjan
                  last edited by Apr 17, 2019, 4:59 PM

                  @Gertjan which version is this ? i am using 2.4.4 i cant see that 3 options in my version...

                  1 Reply Last reply Reply Quote 0
                  • G
                    Gertjan
                    last edited by Gertjan Apr 17, 2019, 5:04 PM Apr 17, 2019, 5:03 PM

                    I already went through the Forum => Redmine => Github phase twice, I guess.

                    @ajmaltms :
                    I'm using the same version as you. pfSense 2.4.4p2

                    I just have edited the code on my own pfSense setup.

                    Does the image looks good to you ?
                    As @Derelict stated, there is a whole procedure to respect when one want to change the 'official' code.
                    As said, this will take some time.

                    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 Apr 17, 2019, 5:08 PM Reply Quote 0
                    • A
                      ajmaltms @Gertjan
                      last edited by Apr 17, 2019, 5:08 PM

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

                      1 Reply Last reply Reply Quote 0
                      • G
                        Gertjan
                        last edited by Apr 17, 2019, 5:13 PM

                        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
                        • D
                          Derelict LAYER 8 Netgate
                          last edited by Apr 17, 2019, 7:13 PM

                          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)

                          G 1 Reply Last reply Apr 17, 2019, 10:55 PM Reply Quote 0
                          • G
                            Gertjan @Derelict
                            last edited by Apr 17, 2019, 10:55 PM

                            @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
                            • G
                              Gertjan
                              last edited by Apr 18, 2019, 9:40 AM

                              login-to-view

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

                              D L 2 Replies Last reply Apr 18, 2019, 3:46 PM Reply Quote 0
                              • D
                                Derelict LAYER 8 Netgate @Gertjan
                                last edited by Apr 18, 2019, 3:46 PM

                                @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
                                • G
                                  Gertjan
                                  last edited by Gertjan Apr 18, 2019, 6:02 PM Apr 18, 2019, 5:27 PM

                                  @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 Apr 18, 2019, 7:31 PM Reply Quote 0
                                  • A
                                    ajmaltms @Gertjan
                                    last edited by Apr 18, 2019, 7:31 PM

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

                                    G 1 Reply Last reply Apr 18, 2019, 8:17 PM Reply Quote 0
                                    • G
                                      Gertjan @ajmaltms
                                      last edited by Gertjan Apr 18, 2019, 8:21 PM Apr 18, 2019, 8:17 PM

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

                                      login-to-view

                                      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 Apr 18, 2019, 8:26 PM Reply Quote 0
                                      • A
                                        ajmaltms @Gertjan
                                        last edited by Apr 18, 2019, 8:26 PM

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

                                        G 1 Reply Last reply Apr 18, 2019, 9:19 PM Reply Quote 0
                                        • G
                                          Gertjan @ajmaltms
                                          last edited by Gertjan Apr 19, 2019, 8:30 AM Apr 18, 2019, 9:19 PM

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

                                          login-to-view

                                          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 Apr 28, 2019, 10:40 AM Reply Quote 0
                                          44 out of 147
                                          • First post
                                            44/147
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.