SQL Counter for Expiration Attribute - Prepaid Cards

Prabhpal S. Mavi prabhpal at digital-infotech.net
Tue Jan 1 10:01:57 CET 2013

Dear List Members,

i have working setup of FreeRadius 2x (freeradius-2.1.12-4.el6_3.x86_64)
including "rlm_sqlcounter" (Max-Daily-Session). User are logged off
alright when "Max Session Timeout" is reached. But users can re login to
gain access. The username and passwords are for hotspot. We do not want
the username and password to work again once it has been used.

For example: prepaid voucher (MySQL username & password) has 1 hour
access. User should be able to use sum of one hour, either continuously
once they are logged in or in parts (30min today & 30min tomorrow so on)
username & password must never work for more than 1 hour to access our
network. i am bit confuse attribute to use, i would grateful if someone
can advice the correct attribute to use for the purpose.


Hi Members,

after working for four days still unable to make it work. Alan Buxey
advised me to implemented "Expiration" Attribute. Expiration works just
fine. If i specify any date (01 Sep 2013). But i am working to expire
username after certain amount of time, such as one hour (not one hour
after first log in) sum of one hour internet used either by one time login
or multiple logins (30Min morning & 30min afternoon etc..).

i understand i would need sql_counter to achieve. I am trying but not
working. my configuration.

1.) Created Counter:

sqlcounter expiration {
               count-attribute = "Acct-Session-Time"
               counter-name = "Max-Allowed-Session"
               check-name = "Expiration"
               sqlmod-inst = "sql"
               key = "User-Name"
               reset = "never"
               query = "SELECT IFNULL(TIME_TO_SEC(TIMEDIFF(NOW(),
MIN(AcctStartTime))),0) FROM radacct WHERE
UserName='${key}' ORDER BY AcctStartTime LIMIT 1;"

2.) Added in radiusd.conf

instantiate {

3.) Added under auth section:

authorize {

When we expire account with expiration attribute which kind of value can
we define to the attribute so that account gets expire after 1 hour of
internet use (using sql counter). Date format is working alright (01 Sep

Thanks everyone for attending to this material.

More information about the Freeradius-Users mailing list