SQLCounter configuration
Alexander Solodukhin
alt at softwarium.net
Thu Feb 26 15:38:42 CET 2009
On Thu, 26 Feb 2009 13:19:06 +0200, <tnt at kalik.net> wrote:
>>>> Can you show some examples please? I try to do like this:
>>>>
>>>> noresetBytecounter
>>>>
>>>> if (reject) {
>>>> update reply {
>>>> Reply-Message := "Traffic limit exceeded."
>>>> }
>>>> }
>>>>
>>>> but if noresetBytecounter return reject freeradius immediatly return
>>>> reject
>>>> to user and do not process 'if' clause
>>>
>>> You need to put this in the "post-auth" section, "Reject" subsection.
>>> See the example configuration files.
>>
>>
>> /etc/freeradius/sites-enabled/default[412]: "SQL Counter" modules aren't
>> allowed in 'post-auth' sections -- they have no such method.
>>
>
> Don't put the counter there but the counter attribute:
>
> if(control:Counter-Attribute < 0) { ...
>
Sorry, i read mans and comments in config and try to do like you say but
it's not work as i need. I have sqlcounter:
sqlcounter noresetBytecounter {
counter-name = Total-Max-Octets
check-name = Max-Octets
reply-name = ChilliSpot-Max-Total-Octets
sqlmod-inst = sql
key = User-Name
reset = never
query = "SELECT (SUM(AcctInputOctets)+SUM(AcctOutputOctets)) FROM
radacct WHERE UserName='%{%k}'"
}
post-auth section in sites-enabled/default:
Post-Auth-Type REJECT {
attr_filter.access_reject
if (control:Max-Octets > 0) {
update reply {
Reply-Message := "Traffic limit exceeded."
}
}
}
so, what exactly name must be in control: ? As you can see i try to put
Max-Octets, but seems that attribute simly loaded from mysql (even if
password wrong and no traffic overlimit occures there 'Traffic limit
exceeded.' error message returned) and it's always greater than zero. I
try counter:ChilliSpot-Max-Total-Octets but got:
Attribute control:ChilliSpot-Max-Total-Octets was not found
in debug. Sorry but i something missunderstand in general, please put me
on right way.
--
ISP CrIS, Softwarium
More information about the Freeradius-Users
mailing list