freeradius 3 sqlcounter not expanding and executing sql query

Heinz Ketchup tonitester at
Fri Nov 1 18:04:12 CET 2013

Hi all,

a big thanks to all developers for freeradius 3!

Having successfully set it up with mysql, I try hard to get sqlcouter going.
It is always returning 'noop' because the configured query is not being expanded and executed:
the only one entry in sqlcounter.conf:
sqlcounter expire_on_firstuse {
sql_module_instance = sql
counter_name = Expire-After-Initial-Login
check_name = Expire-After
reply_name = Session-Timeout
key = User-Name
reset = never
query = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='%{${key}}' ORDER BY acctstarttime LIMIT 1"

ATTRIBUTE Expire-After 3004 integer

debug output:
(0) expire_on_firstuse : Entering module authorize code
(0) expire_on_firstuse : expand: "%{sql:%{sql:}" -> ''
(0) expire_on_firstuse : No integer found in string ""
(0) [expire_on_firstuse] = noop

should look like:
(0) expire_on_firstuse : expand: "%{sql:SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='testuser' ORDER BY acctstarttime LIMIT 1" -> '1234'

The query from the configfile with a correct username works as expected at the mysql console and returns an integer.

Any ideas what is going wrong???

Thanks and Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Freeradius-Users mailing list