S/Key and One-Time PasswordsAaron Poffenberger
"A one-time password (OTP) is a password that is only valid for a single login session or transaction." [fn:[[#1]]]
In other words, a one-time password is an authentication mechanism in which the password is used once to authenticate a user and is then discarded never to be used again. Once the OTP is used a new one is required the next time the user needs to authenticate.
For a system like this to work, the user needs to know or be able to predict the next password the system will use. There are several ways this can be done:
- Using an algorithm to generate a sequence of passwords. The user carries all or a subset of the sequence with him.
- Using a time-synchronized method of generating the next password between the user and the system. This method requires the user to have a device with him that has the same time as the system he must authenticate with.
- Challenge-based method in which the system presents a challenge and the user calculates the correct response.
All three are variations of the same fundamental approach. A mathematical algorithm is used to compute the next password in the sequence. In order to make it as hard as reasonably possible to determine the next password in the sequence if one has any of the current passwords, the algorithm is a cryptographic hash, or one-way, function.[fn:[[#1]]] That is, given the input values one can easily calculate the result but given the result it's very hard to determine the input values.
OK. So what?
The "so what" of one-time passwords is that they're great when you must absolutely make a connection to a server but can't: 1) trust the computer you're connecting from (a public computer), or 2) can't connect over a secure protocol like ssh(1).
A few years ago I ran into problem 1. I was in Mexico City and despite having brought a small computer that I could trust, I couldn't find any place with a wireless access point I could use. I was stuck. I needed to connect to my mail server but could only do so over a public system. Fortunately I was somewhat prepared and had a throw away account I could use but still didn't like the idea of connecting using a computer that might have had a keylogger on it.
A one-time password would have been perfect.
How Do I Use It?
In OpenBSD it's really quite easy to use and since it's well documented, like almost everything associated with OpenBSD, I'm not going to go over the steps. Read the instructions and follow them carefully and you should have little trouble.
I will, however, offer a few notes about using S/Key.
A Few Notes about Daily Use
S/Key is not a substitute for an encrypted session: Just because you connected and don't have to worry about your password being intercepted and reused doesn't mean the session is secure. If you use your password (/e.g.,/ with sudo(8)) during the session then any keystroke loggers on the untrusted system can capture it.
Protect Your Pre-Generated Passwords: Most likely you'll be carrying some of the pre-generated passwords on your person. You have to protect them just as you would for any regular passwords you know. Don't write down the name of the system or user id they're associated with.
Yes, this make it harder on you to remember which systems they go with but the point is to make it hard or impossible for an attacker to use them. The best way to carry them is in an electronic device that has a password-vault program like Password Safe installed on it. Create a separate file just for your one-time passwords.