I am developing a hotspot solution, and have a problem with radius.
I’m running freeradius on debian, configured to talk to mysql.
Authentication and assigning attributes works fine, what I need is to be able to update the values in the mysql tables with decremented values ie the xmit-limit, recv-limit, and session-timeout.
The radius server assigns these values to the hotspot no problem, A user can be limited to say 1 hour of use and 50MB. The issue is that if they then log off and back on, they get their 50MB and 1 hour back all over again.
I need MT to beable to update the SQL tables with the appropriate vales when users log off the hotspot, and also incrementally every minute or so using radius accounting.
Freeradius SQL connector already executes a SQL query on accounting update, and accounting stop, which works great, but only adds records to the accouting table (radacct)
I need to be able to modify the values of radreply as well as the accounting table.
This is the query that freeradius does at the moment on accounting stop:
accounting_stop_query = "UPDATE ${acct_table2} SET ${acct_table2}.AcctStopTime = ‘%S’, ${acct_table2}.AcctSessionTime = ‘%{Acct-Session-Time}’, ${acct_table2}.AcctInputOctets = ‘%{Acct-Input-Octets}’, ${acct_table2}.AcctOutputOctets = ‘%{Acct-Output-Octets}’, ${acct_table2}.AcctTerminateCause = ‘%{Acct-Terminate-Cause}’, ${acct_table2}.AcctStopDelay = ‘%{Acct-Delay-Time}’, ${acct_table2}.ConnectInfo_stop = ‘%{Connect-Info}’ WHERE ${acct_table2}.AcctSessionId = ‘%{Acct-Session-Id}’ AND ${acct_table2}.UserName = ‘%{SQL-User-Name}’ AND ${acct_table2}.NASIPAddress = ‘%{NAS-IP-Address}’;
This is what I would like to do as well (to update the data values) :
“UPDATE radreply SET Value = (CASE Attribute WHEN ‘Recv-Limit’ THEN Value - ‘%{Acct-Input-Octets}’ WHEN ‘Xmit-Limit’ THEN Value - ‘%{Acct-Output-Octets}’ END) WHERE UserName = ‘%{SQL-User-Name}’”
If anyone has a similar scenario setup already and can help that would be much appreciated, alternatively if you are a SQL addict and can combine these two queries that would also be great.
Surely this a pretty fundamental thing to be able to update such attributes.
Regards,
Russell Tester.