[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-devel
Subject:    Re: Updating user's quota with every accounting request
From:       Alan DeKok <aland () deployingradius ! com>
Date:       2020-02-23 13:09:37
Message-ID: CAF58DAD-7CB4-4DF3-A97A-7BC147E7CD64 () deployingradius ! com
[Download RAW message or body]

On Feb 23, 2020, at 10:34 AM, Adam Mohamed <adam.mohamed@hoopoe.digital> wrote:
> Here's my use case, I'm limiting quota on users but that only happens with
> the authorize section, but once the user is logged in, I don't get to run
> the authorize section again so what I would like to do is check for user's
> usage everytime he sends an accounting request.. I just want to do an SQL
> query to sum his acctinputoctets and acctoutputoctets and if its > specific
> attribute in a radgroupcheck row, the user should be rejected or EVEN
> better add something to the reply attributes that is being sent with the
> accounting request with the remaining quota he is allowed to use like
> ChilliSpot-Max-Total-Octets := remaining quota..

  Most NASes don't support sending attributes in an Accounting-Response packet.

> Just let me know how to write the queries and where if you know and I'd be
> so grateful, thanks in advance.

  The format of the queries depend on your SQL server, which you haven't said.  And \
no, we're not going to explain the syntax of your SQL server.  That's already \
documented... in the documentation for the SQL server you're using.  I suggest \
reading it.

  Once you have a query that works, you can just use it in FreeRADIUS:

	if ("%{sql:SELECT ...}" > ...) {
		...
	}

  The main difficult is that it's difficult to query the value of one particular \
attribute in the "radcheck" table.  You'll again have to figure out what that SQL \
query is.  And read the SQL documentation to see how to do this.

  The FreeRADIUS documentation describes how the server works, and how to configure \
it.  It does NOT include documentation on how to do every possible configuration.  \
That's too hard.  Instead, we rely on users reading documentation, and asking \
questions which can be answered.

  Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic