Page 1 of 1

Usermanager and Hotspot: Lock voucher to MAC address

Posted: Tue Oct 31, 2006 11:03 pm
by savagedavid
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.

Hm, it looks nobody have some solution

Posted: Wed Nov 08, 2006 3:25 pm
by Pumpir
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

Posted: Wed Nov 08, 2006 10:30 pm
by savagedavid
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.

Script

Posted: Thu Nov 09, 2006 10:32 am
by Pumpir
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

Re: Script

Posted: Sun Mar 02, 2008 1:54 am
by don Otto
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"
}

Re: Usermanager and Hotspot: Lock voucher to MAC address

Posted: Fri Aug 19, 2016 1:17 pm
by dennyglover
thanks don but may i ask,will this affect the users which are not vouchers because i have users who share same username

Re: Usermanager and Hotspot: Lock voucher to MAC address

Posted: Fri Aug 11, 2017 3:57 pm
by Jovicar
Dennyglover i have the some question like you. For two mac using one user. Have you fixed it?