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

    Captive Portal Hard Limits

    Scheduled Pinned Locked Moved Captive Portal
    20 Posts 4 Posters 1.7k 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.
    • GertjanG
      Gertjan @tmtechonline
      last edited by

      @tmtechonline said in Captive Portal Hard Limits:

      unauthenticated users

      Who are these ?
      Are the shown on the captive portal page ?

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

      T 1 Reply Last reply Reply Quote 0
      • T
        tmtechonline @Gertjan
        last edited by tmtechonline

        @Gertjan yes, those users will be shown in Captive Portal status Active Users.

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

          You are using :

          8fd869f8-09da-4aec-b30c-be2b061d6c04-image.png

          ?

          edit : if so .... open /etc/inc/captiveportal.inc - locate 3600 (there are two of them) - change them for 60. Now the "Wating periode to restore ..." will be in minutes, not hours.
          Btw : I didn't test.

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

          T 1 Reply Last reply Reply Quote 0
          • T
            tmtechonline @Gertjan
            last edited by

            @Gertjan said in Captive Portal Hard Limits:

            You are using :

            8fd869f8-09da-4aec-b30c-be2b061d6c04-image.png

            ?

            edit : if so .... open /etc/inc/captiveportal.inc - locate 3600 (there are two of them) - change them for 60. Now the "Wating periode to restore ..." will be in minutes, not hours.
            Btw : I didn't test.

            Hi @Gertjan That is for the reset of the unauthenticated account which means after an unauthenticated user has reached the limit, user will just have to wait minutes and they will have access again.

            What I need is to:

            1. Determine who are the unauthenticated users
            2. Get the login times of those unauthenticated users
            3. once the login times equals or more than 15 minutes, then I will run a command, batch or script which will disconnect those unauthenticated users.

            This is nowhere available in CP settings.

            My current settings are:

            Idle Time: = 15 (minutes)
            Hard Time out = 0 (hour/hours meaning disabled, if enabled by inputting 1 or more hours, that would mean after that hour, all users (Authenticated, Unauthenticated and Voucher Users will all be diconnected so I have to put 0 since I don't want all to be disconnected.

            Pass-through credits per MAC address = 1 ( I just need unauthenticated users to be allowed to access once and after that they will be prompted to use username/password or voucher key.

            Waiting period to restore pass-through credits = 24 hours (since I wanted an unauthenticated user to be able to access the CP without authenticating after 24 hours.

            Hope this make sense :)

            So to tackle, first, what command in console I use to find unauthenticated users in CP? I have tried IPFW LIST ALL but it shows all connected users but only showing MAC info where user unauthenticated or authenticated is not shown.

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

              @tmtechonline said in Captive Portal Hard Limits:

              IPFW LIST ALL

              will not work.
              Command line commands can't be all capitals : check here :
              https://docs.netgate.com/pfsense/en/latest/captiveportal/captive-portal-troubleshooting.html#ipfw-tables

              Try :

              ipfw table all list
              

              I'm pretty sure these 'clients' are in the table called "xxxx_pipe_mac" where xxxxx is your captive portal zone name.

              Also : there are close to none CLI commands to do what you want. pfSense is GUI based.
              There are no (or very (few) CLI possibilities.

              But, with some scripting there is no limit about what can be done.

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

              T 1 Reply Last reply Reply Quote 0
              • T
                tmtechonline @Gertjan
                last edited by

                @Gertjan Thanks for your quick reply and really appreciate your help here.

                I tried that command too but as mentioned I cannot determine which is unauthenticated using that.

                Not that good in scripts, will you be able to draft me just a general function to search the unauthenticated and I can probably find my way in between?

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

                  The good news :
                  The captive portal is just two files.
                  /usr/local/captiveportal/index.php
                  and
                  /etc/inc/captiveportal.inc

                  The bad news : you have to read and understand the whole thing - only then you will know what needs to be done that fits your needs..

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

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    tmtechonline @Gertjan
                    last edited by

                    @Gertjan Got it! So as my last hope to finding a solution to my needs, can you help me out how will I be able to query CP DB and list its contents using console?

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

                      Yep.

                      Make a file with this in it :

                      #!/usr/local/bin/php -q
                      <?php
                      	require_once("/etc/inc/util.inc");
                      	require_once("/etc/inc/functions.inc");
                      	require_once("/etc/inc/captiveportal.inc");
                      
                      	/* Read in captive portal db */
                      	/* Determine number of logged in users for all zones */
                      
                      	$count_cpusers = 0;
                      	/* Is portal activated ? */
                      	if (is_array($config['captiveportal']))
                      		/* For every zone, do */
                      		foreach ($config['captiveportal'] as $cpkey => $cp)
                      			/* Sanity check */
                      			if (is_array($config['captiveportal'][$cpkey])) 
                      				/* Is zone enabled ? */
                      				if (array_key_exists('enable', $config['captiveportal'][$cpkey])) {
                      					$cpzone = $cpkey;
                      					$result = captiveportal_read_db();
                      					foreach ($result as $cpentry) {
                      					print_r($cpentry);
                      					}
                      				}
                      ?>
                      

                      Execute like this : php -q test.php

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

                      T 1 Reply Last reply Reply Quote 1
                      • T
                        tmtechonline @Gertjan
                        last edited by

                        @Gertjan Great! I think I saw that code somewhere.

                        Will start with this one. Thanks a lot @Gertjan.

                        If anyone has other ideas that can make this happen, please do add some lines here :)

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