Live data from Hacker News

Simple Two-Factor SSH Authentication

moocode.com

41–47 of 47 posts

Re: Simple Two-Factor SSH Authentication

#41
post #40
post #36

Earlier quoted context omitted.

What needs to go into trusted_keys?

Yeah, it is 12. Here is a basic usage guide: # groupadd yubikey # usermod -G yubikey USERNAME # echo "yubikeyid" >> /home/USERNAME/.ssh/trusted_yubikeys # (yubikeyid is first 12 characters of the OTP) # chmod 755 /usr/local/bin/yubikey.sh # (this file is /usr/local/bin/yubikey.sh) # echo "Match group yubikey" >> /etc/ssh/sshd_config # echo " ForceCommand /usr/local/bin/yubikey.sh" >> /etc/ssh/sshd_config # (that's a…

Thank you!

Re: Simple Two-Factor SSH Authentication

#42
post #40
post #36

Earlier quoted context omitted.

What needs to go into trusted_keys?

Yeah, it is 12. Here is a basic usage guide: # groupadd yubikey # usermod -G yubikey USERNAME # echo "yubikeyid" >> /home/USERNAME/.ssh/trusted_yubikeys # (yubikeyid is first 12 characters of the OTP) # chmod 755 /usr/local/bin/yubikey.sh # (this file is /usr/local/bin/yubikey.sh) # echo "Match group yubikey" >> /etc/ssh/sshd_config # echo " ForceCommand /usr/local/bin/yubikey.sh" >> /etc/ssh/sshd_config # (that's a…

If you're still on CentOS 5.7 you might need to upgrade your openssh package. Might I recommend openssh-5.8.p1 with the HPN patch (http://www.psc.edu/networking/projects/hpn-ssh/#patches)

Re: Simple Two-Factor SSH Authentication

#43
post #42
post #40

Earlier quoted context omitted.

Yeah, it is 12. Here is a basic usage guide: # groupadd yubikey # usermod -G yubikey USERNAME # echo "yubikeyid" >> /home/USERNAME/.ssh/trusted_yubikeys # (yubikeyid is first 12 characters of the OTP) # chmod 755 /usr/local/bin/yubikey.sh # (this file is /usr/local/bin/yubikey.sh) # echo "Match group yubikey" >> /etc/ssh/sshd_config # echo " ForceCommand /usr/local/bin/yubikey.sh" >> /etc/ssh/sshd_config # (that's a…

If you're still on CentOS 5.7 you might need to upgrade your openssh package. Might I recommend openssh-5.8.p1 with the HPN patch ( http://www.psc.edu/networking/projects/hpn-ssh/#patches )

Was I ever on CentOS 5.7?

Re: Simple Two-Factor SSH Authentication

#44
post #20

Earlier quoted context omitted.

These are much more sensible that the OP's solution. Just to be clear to anyone reading, because it's not really explained: * OP double-protects the SSH key. It means you need the key's passphrase and another factor (Google authenticator) to decrypt the ssh key. Then the ssh key is used to auth with the server. => the authentication with the server is still one factor auth, compromising the key at any level still gra…

The method listed in the article does authenticate with the SSH key first and then the second factor kicks in only if the key (and passphrase) are valid. Doesn't ForceCommand do exactly the same thing except it allows you to do it globally?

Not only does it allow you to do it globally, it doesn't allow a user to log in and disable it on you either. If you have to have them turn it on in ~/.ssh/authorized_keys all it takes is someone to get in once to add in a key that doesn't require that any more.

Re: Simple Two-Factor SSH Authentication

#46
post #45

What a great solution. I will use it, but... I guess I found a serious security problem. When logging ssh commands with '-vT', I can see the secret. The secret should be hard coded in the two_factor script.

I don't see the secret in the output when I run that command. It just says:

debug1: Remote: Forced command.

Re: Simple Two-Factor SSH Authentication

#47
post #45

What a great solution. I will use it, but... I guess I found a serious security problem. When logging ssh commands with '-vT', I can see the secret. The secret should be hard coded in the two_factor script.

I don't see the secret in the output when I run that command. It just says: debug1: Remote: Forced command.

It seems that certain versions of OpenSSH do print out the command and parameters so I've updated the blog post to include a work-around
Post reply on HN