Community discussions

MikroTik App
 
Telecomd
just joined
Topic Author
Posts: 7
Joined: Tue Feb 05, 2019 8:50 am

hotspot can't drop wifi client after session time finished

Fri Apr 12, 2019 3:20 pm

Hi, sorry for my english.
Situation:
RB3011UiAS 6.43.11
We have hotspot. Everything is working fine. Clients can connect to hotspot via SMS auth. Users redirecting to local html page, and after filling form, get sms. After that User can use internet 15 minutes (Hotspot User Profile - Session Timeout 15 min). After this time, internet connection losts, but wifi connection stayed. If user will sighn any address in his browser with http, he would be redirected to our local auth page. If httpS, he wouldn't redirected.
1. How to make redirection to local auth page automatically, without filling any address in the browser after the session time would stopped?
2. How to make full dissconection from wifi, after session time stops?
 
korg
Member Candidate
Member Candidate
Posts: 152
Joined: Tue Apr 26, 2016 4:10 pm
Contact:

Re: hotspot can't drop wifi client after session time finished

Sun Apr 14, 2019 7:13 pm

Hi,

how did you setup a hotspot authentication via SMS? Is it possible to get a script for it?

tx

korg
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: hotspot can't drop wifi client after session time finished

Sun Apr 14, 2019 10:41 pm

1. How to make redirection to local auth page automatically, without filling any address in the browser after the session time would stopped?
2. How to make full dissconection from wifi, after session time stops?
1. I don't think you can. redirection means re-directing something the user has filled into the browser. otherwise it would be an pop up which will likely to be blocked by the browser.
you can try "advertise" feature in hotspot, which forces the user to visit a URL, which can then be your auth page.

2. no you can't, the mikrotik is just a router. To disconnect WiFi , it is has to be the WiFi access point to send a disassociate message to the wifi client. you maybe use some sort of script to add wifi client's MAc to the bridge filter, which blocks this device from accessing the router all together, so it will not even get an DHCP address. this way it can still communicate to the WiFi access point but cannot complete the DHCP process. as far as the user is concerned, he cannot connect to the WiFi network.
 
Telecomd
just joined
Topic Author
Posts: 7
Joined: Tue Feb 05, 2019 8:50 am

Re: hotspot can't drop wifi client after session time finished

Mon Apr 15, 2019 2:49 pm

Hi,

how did you setup a hotspot authentication via SMS? Is it possible to get a script for it?

tx

korg
Hi. My script.
#Search number in log hotspot

:foreach line in=[/log find buffer=hotspot message~"login failed"] do={
:do {:local content [/log get $line message];
:put $content;
:local pos1 [:find $content " (" 0];
:put $pos1;
:if ($pos1 != " ") do={
:local uname "";
:local uname7 "";
:local uname8 "";
:local uname9 "";
:local phone "";

:if ([:pick $content ($pos1-10)] = "9") do={
:set uname [:pick $content ($pos1-10) ($pos1-0)];
:set uname8 [:put ("8" . {$uname})]

#Password generation
:local date [/system clock get time];
:local hour [:pick $date 0 2];
:local min [:pick $date 3 5];
:local sec [:pick $date 6 8];
:local usernumber [:pick $content ($pos1-7) ($pos1-5)];
:put $usernumber;
:global pass 123456; #yourpass#
:set pass ($hour * $min * $sec - $usernumber);
:if ($pass < 100) do={
:set pass 4256; #yourpass#
}
:put $pass;

#Add user to hotspot / user-manager

do {/ip hotspot user add name=$uname} on-error={};
do {/ip hotspot user set password=$pass numbers=[find name=$uname]} on-error={};
do {/tool sms send port=usb2 channel=0 phone-number="$uname8" message="login $uname password $pass"} on-error={};

}

}
}
}

# Clear hostpot log

/system logging action set hotspot memory-lines=1;
/system logging action set hotspot memory-lines=1000;
 
Telecomd
just joined
Topic Author
Posts: 7
Joined: Tue Feb 05, 2019 8:50 am

Re: hotspot can't drop wifi client after session time finished

Mon Apr 15, 2019 2:49 pm

1. How to make redirection to local auth page automatically, without filling any address in the browser after the session time would stopped?
2. How to make full dissconection from wifi, after session time stops?
1. I don't think you can. redirection means re-directing something the user has filled into the browser. otherwise it would be an pop up which will likely to be blocked by the browser.
you can try "advertise" feature in hotspot, which forces the user to visit a URL, which can then be your auth page.

2. no you can't, the mikrotik is just a router. To disconnect WiFi , it is has to be the WiFi access point to send a disassociate message to the wifi client. you maybe use some sort of script to add wifi client's MAc to the bridge filter, which blocks this device from accessing the router all together, so it will not even get an DHCP address. this way it can still communicate to the WiFi access point but cannot complete the DHCP process. as far as the user is concerned, he cannot connect to the WiFi network.
THX, I'll try "advertise"

Who is online

Users browsing this forum: DanMos79, massinia, vingjfg and 41 guests