I need such behaviour of system:
1) User input some URL
2) Is user is not connected - he will be redirected on login page
3) After pressing Click to connect (or any other type of access allowing buttons) - user should be redirected to requested page
4) When time limit (or any other limit) is reached - user should be redirected again to login page and then immediately can press login button again.
My system works like this: after login and time limit reached user redirected to alogin.html page. And not redirected to any other place. alogin.html page shows logged_in=yes.
If I try to enter some URL - it will be opened and new session automatically started without pressing button. Rd-Reset-Interval-Time is ignored?
Ok, figured out couple of things.
1) If I want to limit time - I should use Rd-Mac-Counter-Time.
2) There is a couple of errors in policy.conf
Error:rlm_sql(sql),databasequeryerror,SELECTIFNULL(SUM(acctsessiontime-GREATEST((1421934091-UNIX_TIMESTAMP(acctstarttime)),0))FROMradacctWHEREusername='click_to_connect@xxx'ANDcallingstationid='xx-xx-xx-xx-xx-xx'ANDUNIX_TIMESTAMP(acctstarttime)+acctsessiontime>'1421934091',YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear'FROM radacct WHERE username='click_to_connect@xxx' AND callingstationid'atline1
To fix it you can use patch:
--- policy.conf.orig 2015-01-12 06:53:16.000000000 +0200+++ policy.conf 2015-01-22 15:51:58.991066903 +0200@@ -136,21 +136,21 @@
# we can now use it in a query
if("%{control:Rd-Tmp-Avail-Time}"){ #This indicates it it a device!
update control {
- Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0)) FROM radacct WHERE callingstationid='%{request:User-Name}' AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%{control:Rd-Start-Time}'}"+ Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0)),0) FROM radacct WHERE callingstationid='%{request:User-Name}' AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%{control:Rd-Start-Time}'}"
}
}
else{
#Here we need to see if the counter is to be applied on the device level and there is a device present in the request
if((control:Rd-Mac-Counter-Time)&&(request:Calling-Station-Id)){
update control {
- Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0))\+ Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0)),0)\
FROM radacct WHERE username='%{request:User-Name}' AND callingstationid='%{request:Calling-Station-Id}' \
AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%{control:Rd-Start-Time}'}"
}
}
else{
update control {
- Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0))\+ Rd-Used-Time := "%{sql:SELECT IFNULL(SUM(acctsessiontime - GREATEST((%{control:Rd-Start-Time} - UNIX_TIMESTAMP(acctstarttime)), 0)),0)\
FROM radacct WHERE username='%{request:User-Name}' AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%{control:Rd-Start-Time}'}"
}
}
But still have question. Why session after reset starting again and not redirecting to login page?
Last edit: Atomic 2015-01-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My system works like this: after login and time limit reached user redirected to alogin.html page. And not redirected to any other place. alogin.html page shows logged_in=yes.
Why session after reset starting again and not redirecting to login page?
To fix this - COOKIE authorization should be disabled in Mikrotik Hotspot server profile (on Login tab)
Last edit: Atomic 2015-01-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the way.
Can I set
Rd-Reset-Interval-Time
to 1?
I need to allow user start new session immediately after closing old session
Or better set
Rd-Reset-Interval-Time=Rd-Total-Time+1sec?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
I need such behaviour of system:
1) User input some URL
2) Is user is not connected - he will be redirected on login page
3) After pressing Click to connect (or any other type of access allowing buttons) - user should be redirected to requested page
4) When time limit (or any other limit) is reached - user should be redirected again to login page and then immediately can press login button again.
My system works like this: after login and time limit reached user redirected to alogin.html page. And not redirected to any other place. alogin.html page shows logged_in=yes.
If I try to enter some URL - it will be opened and new session automatically started without pressing button. Rd-Reset-Interval-Time is ignored?
Profile config:
Check Rd-Total-Time:=30
Check Rd-Reset-Type-Time:=dynamic
Check Rd-Cap-Type-Time:=hard
Check Rd-Reset-Interval-Time:=60
Check Rd-Mac-Counter-Data:=1
Reply Fall-Through:=1
Ok, figured out couple of things.
1) If I want to limit time - I should use Rd-Mac-Counter-Time.
2) There is a couple of errors in policy.conf
To fix it you can use patch:
But still have question. Why session after reset starting again and not redirecting to login page?
Last edit: Atomic 2015-01-22
To fix this - COOKIE authorization should be disabled in Mikrotik Hotspot server profile (on Login tab)
Last edit: Atomic 2015-01-22
By the way.
Can I set
Rd-Reset-Interval-Time
to 1?
I need to allow user start new session immediately after closing old session
Or better set
Rd-Reset-Interval-Time=Rd-Total-Time+1sec?