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

    How can to access status information of captive portal ?

    Scheduled Pinned Locked Moved Captive Portal
    4 Posts 2 Posters 490 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.
    • R
      reggy
      last edited by

      Is there any way I can access status information of captive portal and display that information on a webpage for individual user?

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

        Hi,

        If you're using a captive portal login with a user/password, give him access to the pfSense => Status > Captive Portal => (portal) page only.

        Assign the page to the user - or better : to the "captive portal" group to which the user (should) belong.

        Also : be careful : when the user logs in, he will get redirected to the captive portal status page right away.
        He will be able to terminate all existing connections, and even disconnect all user using the red button on the bottom of the page.

        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
          reggy @Gertjan
          last edited by

          @Gertjan
          Isn't there any other way?

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

            Well, the advantage of open source is : you can do what you want, so there are many ways.

            Something like this - it's executed every 5 minutes by a Munin client :

            <?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;
            					/* Zone selected -> count users and add */
            					$count_cpusers += count(captiveportal_read_db());
            				}
            
            	echo $count_cpusers;
            ?>
            

            and the info retrieved, the number of logged in portal users - is used to generate this.

            The code above is what ne would call a Munin plugin.
            Many others exist.

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