How can to access status information of captive portal ?
-
Is there any way I can access status information of captive portal and display that information on a webpage for individual user?
-
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. -
@Gertjan
Isn't there any other way? -
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.