Captive Portal Last Activity
-
Captive Portal Last activity I want to use accounting.
Does pfsense share this data? -
@ahmetakkaya said in Captive Portal Last Activity:
Does pfsense share this data?
It doesn't store that kind of data.
But it does exist, ina somewhat raw form :Read this Troubleshooting Captive Portal, use the ipfw commands and you'll see the 'bytes passed'.
Using the FreeRadius package combined with the portal gives you more control about connection duration, bandwidth allowed and quantity of data allowed..
-
Hello there
I can access usage information (kb,mb)
I can't find the check-in and check-out times either.
but I need instant session (Last Activity) time? -
@ahmetakkaya said in Captive Portal Last Activity:
I can access usage information (kb,mb)
What is kb.mb ?
@ahmetakkaya said in Captive Portal Last Activity:
I can't find the check-in and check-out times either.
It's not hidden : Status > System Logs > Authentication > General
@ahmetakkaya said in Captive Portal Last Activity:
but I need instant session (Last Activity) time?
Look here :
-
last activity I want to use the information in an accounting controller
Does pfsense share this information?
-
@ahmetakkaya said in Captive Portal Last Activity:
Does pfsense share this information?
The log file is a classic 'ASCII' readable text file. It can be parsed out to get the info.
Or, instead of using the build in pfSense User manger, use the FreeRadius package for identification and accounting. If you choose to to use FreeRadius + a SQL back-end, you have all the info in a 'radacct' SQL table. -
I could not reach the last activation information on the sql side in the data received from Accounting
-
@gertjan said in Captive Portal Last Activity:
It doesn't store that kind of data.
Correction : it actually does.
Sample PHP script that show the connected users and their last activity moment :
#!/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; /* Zone selected -> count users and add */ $connected_users = captiveportal_read_db(); if (!empty($connected_users)) { foreach ($connected_users as $user) { // print_r($user); echo $user[4]." "; $last_act = captiveportal_get_last_activity($user[2]); echo htmlspecialchars(date("m/d/Y H:i:s\n", $last_act)); } } } ?>
-
@gertjan said in Captive Portal Last Activity:
PHP script
The PHP script you shared is on the pfsense side
needed me by freeradius
Does pfsense share the latest activitiy information on freeradius?
-
@ahmetakkaya said in Captive Portal Last Activity:
The PHP script you shared is on the pfsense side
For an activate clients, In the radacct table a record with all the info about this connected client :
My accounting updates this record every 600 (605) seconds.
-
this is my radacct table
There is user login time in the marked field
The variable at the bottom always shows the current time.
I couldn't find the activity information in the table? -
I meant the "acctinputocters" and "acctoutpitoctests". The are updated every "accounting update", nomally 5 minutes.
This info is collected by pfSense, by reading these byte counters, using an ipfw command, then then handed over to FreeRadius.
Freeradius needs this info if you want to quota limit users.Something like real time graphing: not that I know of.
-
freeradius unfortunately does not send last activity information to remote sql accounting server ..
-
@ahmetakkaya said in Captive Portal Last Activity:
does not send last activity information
The record that I showed above will get updated every 600 seconds, of whatever time span you chose. When the connection gets closed, the record will have a STOP time set and the record will not get updated any more.
What do you mean by "activity information" ?
You want to know what the connected user does ? What they visits ?
A "Captive portal" is more about granting access to the net, and also "how long" and "how many bytes". Not what they are actually doing.
If you want to know what a user does, what he's looking at, you have become a MITM-man. -
I found the last activity information in the captive portal status menu on the pfsense webgui screen.
I want to see it on the remote accounting portal page that I have created.
-
@ahmetakkaya said in Captive Portal Last Activity:
I want to see it on the remote accounting portal page that I have created.
Then use the script I showed above ?
The same info is synced to Freeradius, every time a 'accounting' is updated, but this which happens every 5 minutes or so :So, it would be every minute ?! the SQL database is updated.
The function "captiveportal_get_last_activity()" in the script questions the ipfw pipes info directly, it gets the time stamp of the latest packet-event. Identical to what pfSense does when it shows the last activity.
-
I already have my settings as in the picture
How can I query the last activity information on the accounting side or on the sql side?
-
@ahmetakkaya said in Captive Portal Last Activity:
I already have my settings as in the picture
How can I query the last activity information on the accounting side or on the sql side?
I doubt the If the result of "captiveportal_get_last_activity()" is actually stored in the SQL database.
The 'acctupdatetime' (updated every 'actinterval' = env 600 seconds) together with acctinputoctets and acctoutputoctets could used to see if there was any activity during the last 'actinterval' seconds.The radpostauth table contains an every minute a recheck of the login (if you enabled that feature).
A real time updating of the results of the "ipfw" can't be transmitted to Freeradius. Run radius -X for your self to see what is send between the pfSense captive portal and Freeradius.