Hello, I have write the following rule on the sqlcounter module:
sqlcounter checkthetime {
sql_module_instance = "sql"
dialect = ${modules.sql.dialect}
counter_name = "All-Hour-Used"
check_name = "Max-Hour-Used"
key = "User-Name"
reset = "never"
$INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf
}
checkthetime file:
query = "SELECT HOUR(SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime))) FROM radacct WHERE UserName = '%{${key}}' LIMIT 1
my debug mode is here:
http://pastebin.com/F9QA2WN2, but also the interesting parts is here:
........
# Instantiating module "checkthetime" from file /etc/freeradius/mods-enabled/sqlcounter
sqlcounter checkthetime {
sql_module_instance = "sql"
key = "User-Name"
query = "SELECT HOUR(SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime))) FROM radacct WHERE UserName = '%{User-Name}' LIMIT 1;"
reset = "never"
counter_name = "All-Hour-Used"
check_name = "Max-Hour-Used"
reply_name = "Session-Timeout"
}
............
(0) checkthetime : --> 2
(0) checkthetime : Allowing user, control:Max-Hour-Used value (336) is greater than counter value (2)
(0) checkthetime : Setting reply:Session-Timeout value to 334
..........
Sending Access-Accept Id 72 from
192.168.40.12:1812 to
192.168.40.102:54010Mikrotik-Rate-Limit = '512k/2M'
Session-Timeout = 334
And in my MySQL radgroupcheck table:
7 2 Week Max-Hour-Used := 336
Even I don't have define property reply_name = "Session-Timeout" in my rule it appears!! My problem is that the Session Time out is defined even if I didn't define it.
Thanks for your attention and time.
My Freeradius is 3.0.4