Post Logout/Session timeout SQL
I'm using freeradius with coova-chilli. Works fine and dandy, but I'm trying to enforce some policy which I can do with some scripts, but it would be much cleaner to do with radius (IMHO). What I want to happen is when user session timeout or bandwidth restriction has been hit, update a database field. right now on session timeout accounting_update_query appears to be run. I would like to run an additional query as well, to disable the account (I've added a "disabled" field to the radcheck and updated my auth query to check that). Is this something that can be configured, or is there some better way to accomplish what I'm trying to do? R. Marc
On Sat, 2011-03-26 at 15:01 -0500, Marc Phillips wrote:
I'm using freeradius with coova-chilli. Works fine and dandy, but I'm trying to enforce some policy which I can do with some scripts, but it would be much cleaner to do with radius (IMHO).
What I want to happen is when user session timeout or bandwidth restriction has been hit, update a database field. right now on session timeout accounting_update_query appears to be run. I would like to run an additional query as well, to disable the account (I've added a "disabled" field to the radcheck and updated my auth query to check that).
Is this something that can be configured, or is there some better way to accomplish what I'm trying to do?
Why not define a trigger in the database to run the additional query or a function that can perform the necessary checks and the execute a query.
Why not define a trigger in the database to run the additional query or a function that can perform the necessary checks and the execute a query.
I'll take a look at some triggers and stored procedures to go along with it. Would be useful for cleaning up stuff anyway (running radius and chilli on a wireless router, so space is at a premium). I got the inital criteria done by doing an inner join on the accounting_stop_query = " \ UPDATE ${acct_table2} INNER JOIN ${authcheck_table} USING (username) SET \ ${acct_table2}.acctstoptime = '%S', \ ${acct_table2}.acctsessiontime = '%{Acct-Session-Time}', \ ${acct_table2}.acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}' << 32 | \ '%{%{Acct-Input-Octets}:-0}', \ ${acct_table2}.acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' << 32 | \ '%{%{Acct-Output-Octets}:-0}', \ ${acct_table2}.acctterminatecause = '%{Acct-Terminate-Cause}', \ ${acct_table2}.acctstopdelay = '%{%{Acct-Delay-Time}:-0}', \ ${acct_table2}.connectinfo_stop = '%{Connect-Info}', \ ${authcheck_table}.disabled = 1 \ WHERE ${acct_table2}.acctsessionid = '%{Acct-Session-Id}' \ AND ${acct_table2}.username = '%{SQL-User-Name}' \ AND ${acct_table2}.nasipaddress = '%{NAS-IP-Address}'" R. Marc
participants (2)
-
Frank Ranner -
Marc Phillips