Authentication is hard.
So,
A = Account server. This guy actually holds the account details like passwords
L = Login server. Could be the same as A
C = Client. The one who wants to make the connection. Could be a server really.
S = Server. The one who the connection is being made to.
- C logs in to L
- C calls L.createPasswords(unique id)
- L calls A.createPasswords(username, unique id) returns two random passwords, a login password and a server password. Both encrypted with a key that C knows. The passwords are attached (via the unique id) to username’s account.
- C calls S.login(username + “:” + unique id, login password) this is over PB, so it’s challenge response, etc.
- P logs in to L
- P calls L.getPasswords(username, unique id)..
- L calls P.getPasswords(username, unique id) this returns the two passwords (encrypted with a key P knows).
- P checks the login password against what C gave it and grants access if it matches
- C calls P.challenge(random data)
- P returns a md5 digest of the challenge plus the server password
- C verifies the server password against the one the login server gave it
Assumptions:
- Connection between L and A is secure.
- L and A are intended to both be servers run by me/MV3D.
- L and A are separate servers since L is a publicly accessible server, so it shouldn’t have account details on it.
- Communication between any server and L is under SSL.
Holes: If either C or P’s login user+password is compromised, they can be impersonated.
X Logs in to L
- X calls L.challenge() which returns random data that is recorded in X’s session on L
- X AES encrypts time, username using the md5 of the challenge and username’s password
- X calls L.authenticateSession(username, AES encrypted data)
- L calls A.authenticateSession(username, the random data, the AES encrypted data)
- A validates the encrypted data and returns non confidential account info to L plus AES encrypted original time, A’s server name
- L returns the encrypted data from authenticateSession back to X
Apologies if this makes no sense, or if it’s completely dumb. It’s late, and I should really be asleep and not trying to solve authentication problems.