Discussion:
Get Daily Usage: Repeat Question
Imdad Hasan
2018-12-02 17:28:35 UTC
Permalink
Dear All,

I am going to repeat my question because i not got the reply of my question
which i asked before 3.5 Months ago. If any have the solution or idea then
please reply.

*Question: How can i make daily usage report with freeradius.*

I got a idea earlier from the *freeradius user list, *But that fails on one
problem.

*Problem:*

Say for example:

if any user "XYZ" have a one accounting session with the
acct-start-time = "2018-08-16
05:00:00" and acct-stop-time = " 2018-08-19 11:16:46". Ok. Means only one
accounting session 3 days. So, in this example how can i calculate OR get
the "2018-08-17" OR "2018-08-18" s' data usage of that "XYZ" user?


Warm regards
Imdadali Kadiwala
-
List info/subscribe/unsubscribe? See http://ww
Selahattin Cilek
2018-12-02 18:29:34 UTC
Permalink
To be able to achieve your goal, you must first understand what RADIUS is all about, then what FreeRADIUS does *not*, then what it *does* and then how it does it.

If configured to do so, FreeRADIUS can receive accounting data from NASes (switch, access point etc) and log and save the incoming data either in flat files or on a database. (MySQL being the most favourite...)

It is not a difficult thing to do what you want if you use MySQL. If you check the "/usr/local/etc/raddb/mods-config/sql/main/mysql/queries.conf" file, there is a special section named "accounting". Under that section, you'll find the SQL queries called by FreeRADIUS when it receives an accounting packet from a NAS. You can modify the queries to suit your particular requirements. What I did was to create a stored procedure for each of those accounting tasks and take care of the complexity of accounting within the database.

The most important query under that section is "interim-update". Mine looks like this:

interim-update {
query = "CALL accounting_update ('%{Acct-Session-Id}','%{Called-Station-Id}','%{Calling-Station-Id}','%{Acct-Session-Time}','%{Acct-Input-Octets}','%{Acct-Input-Gigawords}','%{Acct-Output-Octets}','%{Acct-Output-Gigawords}')"
}

Here, "CALL" is a SQL keyword to run a stored procedure on the database, "accounting_update" is the name of the stored procedure and all its parameters are FreeRADIUS tokens. (Note they all start with %.)

Of course, what you need is knowledge of MySQL. You must be able to create and manage a database. FreeRADIUS offers no help in the way of keeping records.

A word of caution: You'll find that many NASes fail miserably when it comes to RADIUS accounting, so you will have to deal with the incorrect data sent by the NASes and also the annoying "anonymous" identity problem. In addition, you must disable TLS session caching, since it is known to enable users to bypass any accounting constraints you might have in place.

Good luck.

Selahattin ÇİLEK
CRATIS Networking


On 02-Dec-18 20:28, Imdad Hasan wrote:

Dear All,

I am going to repeat my question because i not got the reply of my question
which i asked before 3.5 Months ago. If any have the solution or idea then
please reply.

*Question: How can i make daily usage report with freeradius.*

I got a idea earlier from the *freeradius user list, *But that fails on one
problem.

*Problem:*

Say for example:

if any user "XYZ" have a one accounting session with the
acct-start-time = "2018-08-16
05:00:00" and acct-stop-time = " 2018-08-19 11:16:46". Ok. Means only one
accounting session 3 days. So, in this example how can i calculate OR get
the "2018-08-17" OR "2018-08-18" s' data usage of that "XYZ" user?


Warm regards
Imdadali Kadiwala
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

[Loading Image...]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon> Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users
Alan DeKok
2018-12-02 19:08:01 UTC
Permalink
On Dec 2, 2018, at 1:29 PM, Selahattin Cilek <***@hotmail.com> wrote:

A very good response, thanks!
Post by Selahattin Cilek
In addition, you must disable TLS session caching, since it is known to enable users to bypass any accounting constraints you might have in place.
I'm not sure why... if the TLS session caching is set up properly, it's just an authentication. And FreeRADIUS can ACK / NAK it, just like any other authentication.

Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius
Alan DeKok
2018-12-02 19:10:15 UTC
Permalink
Post by Imdad Hasan
*Question: How can i make daily usage report with freeradius.*
In short you don't. The accounting data is in a database. You ask the database for that information.
Post by Imdad Hasan
if any user "XYZ" have a one accounting session with the
acct-start-time = "2018-08-16
05:00:00" and acct-stop-time = " 2018-08-19 11:16:46". Ok. Means only one
accounting session 3 days. So, in this example how can i calculate OR get
the "2018-08-17" OR "2018-08-18" s' data usage of that "XYZ" user?
If the users session spans multiple days, then there's no way to get the usage for each day.

If you want to track daily session usage, you must edit the default queries, and likely the schema, in order to track that information.

Alan DeKok.


-
List info/subscribe/unsubscribe? See h

Loading...