skip to primary navigationskip to content

Department of Computer Science and Technology

SSH access to the CL systems

 

One-time password system (OTPW)

SSH using one-time passwords

Logging in from untrusted machines such as public computers exposes passwords to snooping: you can never be certain the machine one is connecting from has not been compromised. Even if the network connection is made over a secure channel like ssh, the password can be intercepted by a keylogger. This is known to have been the cause of at least one user-account compromise which was subsequently elevated to a root compromise on several lab machines.

One-time passwords (OTPW) are a solution to this, but require some advance preparation. The idea is to generate a set of passwords and use each one only once as prompted by the login. One-time passwords can only be generated on a Linux machine.

Generating passwords

Note that generation of a new password sheet should only be done over a secure channel using ssh and from a trusted machine. Make sure you generate your password sheet before you set off!

To generate a set of passwords, use the cl-otpw-gen program on slogin-otpw. You will then be asked to input a prefix password, which should be at least 8 characters long and consist of both letters and numbers (e.g. tpf4apf2tl). This will output an ASCII list of one-time passwords:

 OTPW list generated 2003-11-13 11:32 on sandy.cl.cam.ac.uk

 000 yD9+ t3Wz  056 9wFf YkqU  112 Fe2S :QFP  168 fu2u nwji  224 DHsc wOf%
 001 d9xT Rkpu  057 +rrN 9PLh  113 ytqC G39f  169 tE7t keFE  225 4nCC /zY5
 002 :+e+ h+Ut  058 UHMY HzK=  114 eP3y fzw4  170 QQvn vneS  226 :pu5 p4x7
 003 MqSo 4JA:  059 RfuB 5gyA  115 v=G4 xhYw  171 g5cr ZRCa  227 utgi mHSy  

If you want to print the password list on the default printer you can just input

 cl-otpw-gen | lpr 

Using passwords

OTPW can only be used if you are logging into slogin-otpw. The next time you log in to it from outside the department, when a user key is not available, you will be prompted for Password NNN:, in which case you should enter the prefix password, immediately followed by the (usually eight character) one-time password number NNN from your sheet. Using the above example, if the prefix were tpf4apf2tl, the correct string to enter when prompted for passphrase 170 is tpf4apf2tlQQvnvneS.

Security depends on no-one being able to copy a significant portion of the sheet — if an attacker has control over the local machine and a copy of more than half of the current password sheet, then he or she may well be able to access the account. If at any time you lose your sheet, or use up more than half the passwords on it (at which point you will be prompted on login that this is the case), then generate another sheet using the above process. After this, none of the passwords on the previous sheets will be be useful to anyone, so you can throw them away.

Under certain circumstances, you may be prompted for three of the passwords on the sheet — this happens when concurrent logins are attempted. In this case the prompt will be in the form of Password NNNN/NNNN/NNNN. See http://www.cl.cam.ac.uk/~mgk25/otpw.html for more details.

Disabling OTPW

If for some reason you want to disable the use of one-time passwords for logging in to your account, run 'cl-otpw-gen -p1 -nh 1 -w 1 and then login once to use up the one entry.