Hello, I use rlm_sql module and have problems with stale sessions. Sometimes users (more than 4k-5k) disconnects without accounting_stop_query and they can't connect again because session is not closed by normal way and session still active in database. My accounting time is 45 minutes, if new alive-update packets not coming for user from NAS side I close this session manually with a little script. After this process (after 45 minute) user can connects again. I used stale_sessions but it not helped. In my case I want to close for user existing staled session in database if new accounting_start_query (insert query) occurs. How can i realize this? accounting_start_query = "INSERT into ${acct_table1} \ (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctAuthentic, \ ConnectInfo_start, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, XAscendSessionSvrKey, mac_address, agent, vlan) \ values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', \ '%{NAS-Port}', '%{NAS-Port-Type}', ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), '%{Acct-Authentic}', '%{Connect-Info}', \ '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', \ NULLIF('%{Framed-IP-Address}', '')::inet, 0, '%{X-Ascend-Session-Svr-Key}', \ (case when length('%{client-mac-address}')>0 then '%{client-mac-address}' else '%{Calling-Station-Id}' end), \ (case when '%{NAS-IP-Address}' = '10.10.10.10' then '%{Nas-Port-Id}' else '%{circuit-id-tag}' end), \ '%{Nas-Port-Id}')" accounting_start_query_alt = "UPDATE ${acct_table1} \ SET AcctStartTime = ('%S'::timestamp - '%{Acct-Delay-Time:-0}'::interval), AcctStartDelay = 0, \ ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' \ AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime IS NULL" Thanks! Nadir
2014-03-13 4:32 GMT-03:00 Nadir Aliyev <nadir@azstarnet.az>:
Hello,
I use rlm_sql module and have problems with stale sessions.
In my case I want to close for user existing staled session in database if new accounting_start_query (insert query) occurs. How can i realize this?
I use this in the authorize session: authorize { ... # Clear Stale Sessions when same user x mac tries to reconnect: if(User-Name){ "%{sql:UPDATE radacct set acctstoptime=ADDDATE(acctstarttime,INTERVAL acctsessiontime SECOND), acctterminatecause='Clear-Stale-Session' WHERE username='%{User-Name}' AND callingstationid='%{Calling-Station-Id}' AND acctstoptime is NULL}" } ... } -- Roney Eduardo
participants (2)
-
Nadir Aliyev -
Rôney Eduardo