r/programmingtools • u/Zocin • Jul 16 '15
Best way/ Easiest way to implement a Mac address password
Hello everyone,
I am quite weak in programming (even though I have a degree in computer science from a while back) and I have a question for you.
I want my students to create a website, but I wanted them to be able to sell the access to it to their classmates. In order to make this a cheat-free access, I wanted a way to generate let's say 20 passwords which could only be used on a specific machine. In other words, if Mark buys a password he will be able to access the website with his laptop but his friend john won't be able to use it for his machine and therefore, if he wants to access the website he will need to buy his own password. Therefore I was thinking about making a mac address password thingy if that is possible.
So here are my questions: -will making a mac address password thing make my idea possible? what could be the problems with it? -What is the easiest program for making website if I wanna use a mac address? How to create that mac address password access?
9
u/binarycow Jul 16 '15
Over the internet? No, you cannot use a mac address. MAC addresses are only used within a LAN. Once you hit a router, your MAC address gets stripped off the packet, and the router's MAC address gets put on the packet.
On the intranet? Sure. You would have to inspect the packets, strip out which MAC address it came from, and use that in your program.
Is this a good idea? No way. MAC addresses are easily spoofed.
4
u/landisthegnome Jul 17 '15 edited Jul 17 '15
As others have said using the MAC is not the way to go, it has limited use and is easily spoofed.
There is no fool-proof way to prevent users from sharing passwords. Even requiring two factor authentication doesn't completely stop it. If someone really wanted to share an account they could simply call or video chat and show their current one-time password.
You can attempt to detect password sharing by logging authentication attempts and looking at things like IP address, user-agents and such, but these are all spoofable and it takes work.
You could use biometrics such as a thumbprint, which in theory would require the specific user to be physically present. Note this still doesn't prevent all sharing, and requires specialized hardware.
The best option might be using Google or Facebook OAuth. Most people likely will not want to share their logins for these accounts as the potential for abuse is very high.
edit: Technically there is a way. You have an admin hand-deliver a one-time password to the user and watch them log in, use the site, then log out. But that's not very feasible!
1
u/robhol Jul 16 '15
Even if you could use the MAC address for this, it would be very insecure, as MACs are downright trivial to spoof.
1
u/djk29a_ Jul 20 '15
There is a big problem to be noted even if MAC addresses were truly unique when it comes to operational / support concerns - what happens if a user legitimately needs their computer replaced? Do you want to manage that kind of headache on behalf of your students?
For the general idea of what you're looking for, I'd take the other recommendations and use some AuthN + AuthZ combo that's widely supported like Facebook, Google, or some other large Internet company's Oauth/OpenID system and integrate it to your application.
Beyond the MAC address spoofing stuff mentioned, there's really very, very few possibilities for uniquely fingerprinting a piece of hardware these days in a universal, reliable manner. This is partly because so many things are software-controlled and inevitably fully writable (the few exceptions being TPM modules and signing bootcode and keys outside normally accessible address spaces and some vendor-specific stuff like on Cisco UCS that is meant to duplicate everything short of certain serial numbers).
But really, this is the fundamental basis of why people started making dongles for copy protection, and anyone that's defeated these measures can explain why that technique would fail.
I suspect a "good" solution for your use case would require three or more of the following properties:
0
u/[deleted] Jul 16 '15
[deleted] — view deleted comment