Hi. I'm trying to create a custom counter which basically is the same as Max-Daily-Session but restricted to the current Called-Station-Id. I added this to sql/mysql/counter.conf: sqlcounter dailycounterlocation { counter-name = Daily-Session-Location-Time check-name = Max-Daily-Session-Location reply-name = Session-Timeout sqlmod-inst = sql key = User-Name reset = daily query = "SELECT SUM(acctsessiontime - \ GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \ FROM radacct WHERE username = '${key}' AND \ (UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b') \ AND calledstationid = '%{Called-Station-Id}' " } then in sites-enabled/default: [...] authorize { dailycounterlocation { reject = 1 } if(reject){ update reply { Reply-Message := "You have reached your daily time limit from this location" } reject } } but it's not working at all... Compared to a Max-Daily-Session attribute, in the radius debug I see the value gets returned just after the group check query. Instead with my custom attribute the value is never returned, the check query returns null (when there's no previous activity in radacct) so the user can stay connected forever (for the first session, from the second on it works). What am I doing wrong? Why the default session timeout is not returned? thanks -- Lorenzo Milesi - lorenzo.milesi@yetopen.it YetOpen S.r.l. - http://www.yetopen.it/
On Feb 27, 2015, at 11:34 AM, Lorenzo Milesi <maxxer@ufficyo.com> wrote
but it's not working at all…
See the FAQ for “it doesn’t work”.
Compared to a Max-Daily-Session attribute, in the radius debug I see the value gets returned just after the group check query. Instead with my custom attribute the value is never returned,
What does that mean?
What am I doing wrong? Why the default session timeout is not returned?
No idea. Alan DeKok.
Compared to a Max-Daily-Session attribute, in the radius debug I see the value gets returned just after the group check query. Instead with my custom attribute the value is never returned,
What does that mean?
When there is no previous session on the current day with the Max-Daily-Session attribute I get the followin in debug: rlm_counter: Current Time: 1425241760 [2015-03-01 21:29:20], Next reset 1425250800 [2015-03-02 00:00:00] rlm_counter: reset_db: Closing database rlm_counter: reset_db: Opened new database rlm_counter: add_defaults: Start rlm_counter: DEFAULT1 set to 1425250800 rlm_counter: DEFAULT2 set to 1425078000 rlm_counter: add_defaults: End rlm_counter: reset_db ended rlm_counter: Entering module authorize code rlm_counter: Searching the database for key 'ALG02MAX' rlm_counter: Could not find the requested key in the database. rlm_counter: Check item = 200, Count = 0 rlm_counter: res is greater than zero rlm_counter: (Check item - counter) is greater than zero rlm_counter: Authorized user ALG02MAX, check_item=200, counter=0 rlm_counter: Sent Reply-Item for user ALG02MAX, Type=Session-Timeout, value=200 ++[daily] = ok which sets the default value to the one read from the radgroupcheck table. This is done BEFORE the counter queries are executed. When I add my custom attribute this Session-Timeout is not returned. this is what I'm missing. -- Lorenzo Milesi - lorenzo.milesi@yetopen.it YetOpen S.r.l. - http://www.yetopen.it/
participants (2)
-
Alan DeKok -
Lorenzo Milesi