rlm_sqlcounter: Max-Daily-Session.

* zhex900 at gmail.com
Tue May 13 10:08:19 CEST 2014


I checked, it is in one line. I have attached the sqlcounter file.

Jake He


On Tue, May 13, 2014 at 3:55 PM, Russell Mike <radius.sir at gmail.com> wrote:

> Hi
>
>
> On Tue, May 13, 2014 at 1:31 AM, * <zhex900 at gmail.com> wrote:
>
>> Hi,
>>
>> I followed your instructions. Now I get the following errors:
>>
>> (2)   [-sql] = ok
>> (2)   [expiration] = noop
>> (2)   [logintime] = noop
>> (2) WARNING: pap : Auth-Type already set.  Not setting to PAP
>> (2)   [pap] = noop
>> (2) dailycounter : Entering module authorize code
>> (2) ERROR: dailycounter : %{sql:SELECT SUM(acctsessiontime) FROM radacct
>> WHERE username = '%{User-Name}' AND acctstarttime BETWEEN
>> FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')}
>> (2) ERROR: dailycounter :
>>                                                                         ^
>> Invalid variable expansion
>> (2)   [dailycounter] = fail
>> (2)  } #  authorize = fail
>> (2) Using Post-Auth-Type Reject
>>
>> /etc/freeradius/mods-enabled/sqlcounter
>>
>> sqlcounter dailycounter{
>>         counter_name = "Daily-Session-Time"
>>         check_name = "Max-Daily-Session"
>>         reply_name = "Session-Timeout"
>>         sql_module_instance = "sql"
>>         key = "User-Name"
>>         reset = "daily"
>>         cache-size = 5000
>>         query = "SELECT SUM(acctsessiontime) FROM radacct WHERE username
>> = '%{${
>> key}}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND
>> FROM_UNIXTIME('%e')"
>> }
>>
>> Could you please make sure if the above query is in one line or use "\"
>> to break the line. it is indicating some wrong expression in the query.
>> carefully check your daily counter. it would work.
>>
>> On Mon, May 12, 2014 at 11:27 PM, Russell Mike <radius.sir at gmail.com>wrote:
>>
>>> Do the following
>>>
>>>
>>> STEP 1:
>>>
>>> nano counters.conf
>>>
>>> sqlcounter dailycounter {
>>>
>>>                 counter-name = "Daily-Session-Time"
>>>
>>>                 check-name = "Max-Daily-Session"
>>>
>>>                 reply-name = "Session-Timeout"
>>>
>>>                 sqlmod-inst = "sql"
>>>
>>>                 key = "User-Name"
>>>
>>>                 reset = "daily"
>>>
>>>                 cache-size = 5000
>>>
>>>                 query = "SELECT SUM(acctsessiontime) FROM radacct WHERE
>>> username = '%{%k}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND
>>> FROM_UNIXTIME('%e')"
>>>
>>> }
>>>
>>>
>>> STEP 2:
>>>
>>> nano radiusd.conf
>>>
>>> instantiate {
>>>
>>>         dailycounter
>>>
>>> }
>>>
>>>
>>> STEP 3:
>>>
>>> nano sites-available/default
>>>
>>> authorize {
>>>
>>>  dailycounter
>>>
>>> }
>>>
>>> STEP 4:
>>>
>>> accounting {
>>>
>>> sql
>>>
>>> }
>>>
>>> STEP 5: LOOK, THIS MUST BE *CHECK & REPLY* ITEM NOT CHECK ONLY. BOB IS
>>> ALLOWED FOR 60 MINUTES, VALUE IS IN SECONDS.
>>>
>>> Max-Daily-Session := 3600
>>>
>>>
>>> STEP 6: Restart Radius Daemon
>>> RM --
>>>
>>>
>>> On Mon, May 12, 2014 at 11:28 AM, * <zhex900 at gmail.com> wrote:
>>>
>>>>  Hi,
>>>>
>>>> I have to follow this tutorial to get the the session limit working.
>>>> But looking at the debug output it seems the sql counter is not executed.
>>>> No Session-Timeout is sent to NAS as well.
>>>>
>>>> Accounting is working fine. I can see all the accounting information
>>>> radacct time.
>>>>
>>>> Here is my configuration. Please let me know if I should provide more
>>>> information.
>>>>
>>>> Jake He
>>>>
>>>> FreeRADIUS V. 3
>>>>
>>>> mods-enabled/sqlcounter
>>>>
>>>> sqlcounter noresetcounter {
>>>>         sql_module_instance = sql
>>>>         #dialect = ${sql_module_instance}.dialect
>>>>         dialect = mysql
>>>>         counter_name = Daily-Session-Time
>>>>         check_name = Max-Daily-Session
>>>>         reply_name = Session-Timeout
>>>>         key = User-Name
>>>>         reset = never
>>>>         query = “SELECT SUM(AcctSessionTime) FROM radacct where
>>>> UserName=’%{%k}’”
>>>> }
>>>>
>>>> sites-enabled/default:
>>>>
>>>> authorize {
>>>>
>>>> preprocess
>>>> chap
>>>> mschap
>>>> suffix
>>>> eap
>>>> files
>>>> sql
>>>> pap
>>>> noresetcounter
>>>> }
>>>>
>>>> radcheck:
>>>> Max-Daily-Session:=60 for the user bob
>>>>
>>>> -
>>>> List info/subscribe/unsubscribe? See
>>>> http://www.freeradius.org/list/users.html
>>>>
>>>
>>>
>>> -
>>> List info/subscribe/unsubscribe? See
>>> http://www.freeradius.org/list/users.html
>>>
>>
>>
>> -
>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
>>
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140513/4aefd744/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqlcounter
Type: application/octet-stream
Size: 4264 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140513/4aefd744/attachment.obj>


More information about the Freeradius-Users mailing list