I have a few terminals that I currently use a static IP to authenticate. The problem is in my country the internet is not stable, so often I have to switch to mobile data, then the terminals can't authenticate because their IP addresses changes.
The solution I have thought of is using the MAC address of a terminal as a Username, and then for the password I would generate it as follows:
When the terminal goes to the log in page, a token is provided by the server. The javascript uses this token and passes it into an application (web service) running locally. This local webservice returns then reads MAC address of the terminal, and uses the MAC address and the token from the server to seed algorithm CustomFooAlgorithm
to generate an OTP. Then the webservice replies to the javascript request with the username and password, which the terminal then attempts to log into the server with.
My concern is CustomFooAlgorithm
is basically a shared secret across all terminals. Also I am not sure how to create such an algoirthm that would not be easy to figure out. Could this work? I like that their is no customisation per a terminal.
A more complicated way
I am guesing I would have to create an additional secret token for each terminal, and also store the secret token on the server. Then the webservice could seed some common hashing algorithm with the server token, and the secret token, to generate an OTP.
I thought one could generate the secret key from the mac address, but that is indirectly the same as doing CustomFooAlgorithm
, just splitting it into 2 steps. The advantage of two steps is then a generic algorithm can be used for step 2.
Don't Reinvent the wheel
Should I just use TOTP instead of the above? Its about the closest "off the shelve solution" I can find to solving my problem.