Pfsense 2.1 only one voucher database for all Multi instance Captive Portal



  • Hi,

    I have pfsense 2.1 install and enable "Captive Portal" in two interfaces, I need only one voucher database for the two interfaces. I mean the same voucher "EMb2stekUda3" work for Interface one and Interface two.

    Thanks

    Saleh



  • Just put the interfaces in the same CP instance.



  • Hi Ermal,

    Thanks for your reply. Is there any way to sync the voucher database between two instances.  Per Interface I have one AP connected to the Interface, via the multi CP instance, I need to know, how many users connected per AP.

    Best Regards,

    Saleh



  • "per AP" is "per Interface" is "per zone", right ?

    I used this code (in a Munin plugin) to count all users on all zones, I guess it will be easy to adapt it a little bit for your needs:

    #!/usr/local/bin/php -q
    	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 */
    
    	$count_cpusers = 0;
    	/* Is portal activated ? */
    	if (is_array($config['captiveportal'])) {
    		/* For every zone, do */
    		foreach ($config['captiveportal'] as $cpkey => $cp) {
    			$cpzone = $cpkey;
    			/* zone selected -> count users and add */
    			$count_cpusers += count(captiveportal_read_db());
    			}
    		}
    	echo $count_cpusers;
    ?>
    

Log in to reply