Is it possible to automate a Disconnect-Request based on exceeded Monthly-Usage?

Alan DeKok aland at deployingradius.com
Wed Sep 11 13:14:26 CEST 2019


On Sep 11, 2019, at 3:05 AM, Houman <houmie at gmail.com> wrote:
> 
> Sorry, I should have explained that I'm using StrongSwan as my NAS, which
> is supporting CoA :

  That's nice, but sort of assumed.  If the NAS doesn't support CoA, then there's no point in sending it CoA packets.

> I have found the home server example in sites-available/originate-coa. I
> think I have to set it up under /etc/freeradius/3.0/proxy.cnf.

  I'm not sure what that means.  Set "it" up?  Set *what* up?

  If you read the "originate-coa" virtual server, you will see what you have to set up.  So did you do that?

> Alan, I'm a bit lost here when you said:
> 
>> That's what "originate-com" is for.
>> The documentation isn't perfect, but it should be good.  When you receive
> an accounting >request packet, check for over the limit, and if so, send a
> Disconnect-Request packet.
> 
> I think you mean I have to do that
> in /etc/freeradius/3.0/sites-enabled/default under the section:
> 
> update request { ... }

  In the "preacct" or "accounting" sections.

> In what programming language do I have to do that? I think it has to be in
> SQL right?

  If your users are in SQL, you check their usage via SQL queries.

> I already do this to capture the monthly usage upon each request:
> 
> update request {
> 
>                Monthly-Usage = "%{sql:SELECT
> COALESCE((SUM(`acctoutputoctets`)), 0) FROM radacct WHERE
> `username`='%{User-Name}' AND Month(acctupdatetime)=(Month(NOW())) AND
> Year(acctupdatetime)=Year(NOW())}"
> 
>        }

  OK.

> Now I need to add another line underneath to compare the Monthly-Usage
> against a value and then send the Disconnect-Request if it's greater than
> the value.  How Do I raise the Disconnect-Request?

  The "originate-coa" virtual server explains that in detail.  Read the comments at the top of that file.  See also "man unlang".

  There *is* extensive documentation on this, that I already pointed you to.  If you have questions about the documentation, ask.  But asking a question *answered in the documentation*, then it looks like you haven't read it.

  Alan DeKok.




More information about the Freeradius-Users mailing list