Community discussions

MikroTik App
 
User avatar
savagedavid
Trainer
Trainer
Topic Author
Posts: 320
Joined: Thu Aug 25, 2005 12:58 pm
Location: Cape Town, South Africa
Contact:

Usermanager and Hotspot: Lock voucher to MAC address

Tue Oct 31, 2006 11:03 pm

I am using User Manager with Hotspot and it is working great! One featre I would like to have though is the ability to lock a voucher to a MAC address the first time it is used, so that the voucher cannot be used from a different laptop once it is activated.

I am hoping it would not be too difficult as this is exactly what the trial usage does - I just need it to run from User Manager vouchers. Or if I could get some more info on exactly how the trial system works perhaps I can figure out for myself.
 
Pumpir
newbie
Posts: 49
Joined: Wed Jan 11, 2006 2:17 pm

Hm, it looks nobody have some solution

Wed Nov 08, 2006 3:25 pm

I was expecting some answer for this question. I think this would be very useful function and improvement for this hotspot. It is a pity that I am lama and not able to create some script doing this. I hope some more experienced user will try it.
Ivan
 
User avatar
savagedavid
Trainer
Trainer
Topic Author
Posts: 320
Joined: Thu Aug 25, 2005 12:58 pm
Location: Cape Town, South Africa
Contact:

Wed Nov 08, 2006 10:30 pm

I have scripting experience and I am reasonably sure I could script it. However I was hoping that it could become part of a future release, since it seems to be a fairly minor modification of the trial function.
 
Pumpir
newbie
Posts: 49
Joined: Wed Jan 11, 2006 2:17 pm

Script

Thu Nov 09, 2006 10:32 am

If you are succesfull with the script, could you share it with me on email ivan.heran (at) centrum.cz or will you publish it somewhere?
Thanks.
Ivan
 
don Otto
just joined
Posts: 1
Joined: Sun Mar 02, 2008 1:41 am

Re: Script

Sun Mar 02, 2008 1:54 am

Just made a script to eliminate usage of UM tickets across multiple PC's (MACs). It's far from perfect, but it works here.

-------------------------------------------------------------------------------
#   Script name:  BlockSecondMAC
#   To be placed in the Login section of the User Profile (for UM only)
#
#   Attempt to eliminate use of (UM) ticket users to pass their ticket information to others,
#   thus sharing tickets.
#
#   The script is not water thight, as it travers through the (UM)session list for getting the current user,
#   another user may have logged in in the meantime, thus giving the wrong user name 
#   to this script, which doesn't really harm.  Chanches that a faking user gets missed is minimal.
#
#   If someone knows how to get the current user in a more eligant way.  Please let us know.
#
#   In this script the original (paying) user, doesn't get blocked.  A catch 22 situation as he is probably 
#   part of the fooling process.   If you want him out too, remove all #22 comments.
#   
#  
:local CurrentUser
:local SessionID
:local FirstMAC 0
:local LastMAC
:local LastI
#
/tool user-manager session
:foreach i in=[find user!="x"] do={
   :set LastI $i
}
# LastI now points to last session information
#
:set CurrentUser [get $LastI user]
:set LastMAC [get $LastI calling-station-id]
:set SessionID [get $LastI acct-session-id]
#
:foreach i in=[find user="$CurrentUser"] do={
   :if ($FirstMAC = 0) do={
      :set FirstMAC [get $i calling-station-id]
   }
}
#
:if ($FirstMAC != $LastMAC) do={
   :log warning "User: $CurrentUser; Session-ID: $SessionID ($FirstMAC and $LastMAC) tempering with network"
#
#    Cancel user session
#
   /ip hotspot active
   remove [find user="$CurrentUser"]
#
#   Remove from active Host list
#
   /ip hotspot host
#22   remove [find mac-address="$FirstMAC"]
   remove [find mac-address="$LastMAC"]
#
#   Disable user
#
#22   /tool user-manager user
#22   disable "$CurrentUser"
#
#   Block MAC(s)
#
   /ip dhcp-server lease
#22   remove [find active-mac-address="$FirstMAC"]
   remove [find active-mac-address="$LastMAC"]
#22   add mac-address="$FirstMAC" block-access=yes
   add mac-address="$LastMAC" block-access=yes
#
#   Remove user cookie
#
   /ip hotspot cookie
   :foreach i in=[find user="$CurrentUser"] do={
      remove $i
   }
#
#   Notify End of Script
#
} else= {
   :log info "User: $CurrentUser; Session-ID: $SessionID ($LastMAC) OK"
}
 
dennyglover
just joined
Posts: 15
Joined: Fri Dec 27, 2013 2:05 pm

Re: Usermanager and Hotspot: Lock voucher to MAC address

Fri Aug 19, 2016 1:17 pm

thanks don but may i ask,will this affect the users which are not vouchers because i have users who share same username
 
Jovicar
just joined
Posts: 7
Joined: Sat Mar 18, 2017 12:51 am

Re: Usermanager and Hotspot: Lock voucher to MAC address

Fri Aug 11, 2017 3:57 pm

Dennyglover i have the some question like you. For two mac using one user. Have you fixed it?

Who is online

Users browsing this forum: No registered users and 17 guests