OPIE – One Time Keys

Posted by Benjamin Close on November 8, 2008 under Other | Read the First Comment

Using External SSH access with normal password authentication is dangerous. It is susceptible to the following problems:

  • People can use weak passwords which are easy to hack
  • A remote machine may have a key logger on it
  • Someone may be performing a man-in-the-middle type attack

Hence if you wish to access a shell account or scp files remotely you should consider using either public/private keys setup or to setup One Time Keys.

Setting Up One Time Keys

Log in to the box (AS SECURELY AS POSSIBLE)

Logging in securely is important as you’ll be asked for a pass phrase. If this is compromised you’re in trouble.

Enable OTP

Run:

 opiepasswd -c

This will enable one time keys, asking you for the pass phrase as a seed for the cipher.

Once run one time keys are enabled.

The output of the command (something like):

 ID closebs OTP key is 499 wc8001
 THY HOOK TRY FREY DED DEDE

tells you a lot.

  • The 499 is the number of the current One Time Password.
  • The wc80001 is a key to go with your pass phrase if you want to generate the 499 login password.
  • The THY HOOK… is the password for key 499

Finding out the next N passwords

To discover the next N One Time Passwords for printing use:

 opiekey -n NUM SEQ KEY

where:

  • NUM is the amount of passwords to generate
  • SEQ is the sequence number of the password to start with
  • KEY is the key given for the cipher

Ie:

 opiekey -n 10 499 wc80001

This will display 10 keys, starting with key 499 and using the key wc80001. This can be useful as you can then print out the keys, and put them in your wallet/purse. WHAT I hear you say?

The reality is most passwords are broken by remote hackers. Whilst printing a list of one time passwords may seem insecure, the likely hood of someone going through your purse/wallet to find the printed out keys is very low. If you are concerned about it, simple put a simple transposition in each key that only you will know about.

Disabling OTP access

Help my keys have been compromised!

Get someone to run:

 opiepasswd -d

in your account.

Changing your OTP Pass Phrase

Simply run:

 opiepasswd

This will ask you for the next OTP in order to allow you to change your key (incase your remote) Once changed all your all your existing keys will now become invalid.

Using One Time Passwords

Any time you try to ssh to the WCL, you will be presented with:

 otp-md5 497 psfasdf ext
 Password:

This indicates you are required to provide password 497. The seed is given so you can generate the required password using it and your pass phrase if required.

Depending on the server setup, you can also enter your regular password at this point.

There is no way of telling if the server will accept your regular password or not unless you know it’s configuration.

Your Away, don’t have any passwords or pub/private keys but have access to a secure machine

As long as you can guarentee the machine you are on is secure, then chances are you can generate yourself the next password in the sequence in order to be able to access the remote box.

On the box your on run:

   opiekey  SEQUENCENUM SEED

You can get SEQUENCENUM & SEED just by sshing to the box and not logging in. You’ll need your pass phrase though.



Donations keep this site alive

  • Kaycee said,

    This is the perfect way to break down this infromatoin.

Add A Comment

*