Topic: Limiting Time of User

Hi, I'm farily new to Chillispot and radius so forgive me if I ask a sillly question!

Is it possible / how do I limit the amount of time a user is online, and after the are online not let them log back in  again?

I know there is a session-timeout but I can't seem to see where to set this!

I'm using freeradius and mysql for accounting, UAM for autorization.

Thanks

Paul

Re: Limiting Time of User

Hello,

it has to be set in the radreply table. But you have to calculate the time that the user spent online and update the Session-Timeout attribute by deducting the online time from it, otherwise the user will have the same amount of time when logging in again.

Re: Limiting Time of User

Would the following counter do the job with the correct attribute in the radreply table?

sqlcounter noresetcounter {
driver = "rlm_sqlcounter"
counter-name = Max-All-Session-Time
check-name = "Max-All-Session"
sqlmod-inst = sql
key = User-Name
reset = never
query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}'"
}

Re: Limiting Time of User

Hi Paul

You can try this:

Be sure to define a 'Check Attribute' of 'Session-Timeout' when you make use of rlm_sqlcounter.
EG
Session-Timeout     :=    1200

you can then define a counter like this in the modules:

sqlcounter noresetcounter {
                counter-name = Session-Timeout
                check-name = Session-Timeout
                reply-name = Session-Timeout
                sqlmod-inst = sql
                key = User-Name
                reset = never
                query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}'"

}

Include it in the 'authorize {      }' section
EG 'noresetcounter'


rlm_sqlcounter will then take the check value defined and subtract the value of the SQL statement's result.

The newer versions of rlm_sqlcounter also lets you define the reply attribute, which can be handy to give users a data 'cap'.
It did prove to be buggy though on large values.

If you are lazy you could just grab a copy of Hotcakes, It already has these counters pre-defined and works 'out of the box'  smile