In the authorized_keys script, if instead of exec()ing SHELL you use SSH_ORIGINAL_COMMAND you won't break "ssh myhost "
In the extended example it does actually use the SSH_ORIGINAL_COMMAND, will update the simple version too
Simple Two-Factor SSH Authentication
31–40 of 47 posts
Re: Simple Two-Factor SSH Authentication
#32Re: Simple Two-Factor SSH Authentication
#33Earlier quoted context omitted.
In the extended example it does actually use the SSH_ORIGINAL_COMMAND, will update the simple version too
SSH_ORIGINAL_COMMAND isn't in the ENV at all if no command was passed through
Re: Simple Two-Factor SSH Authentication
#34As noted alsewhere, ForceCommand is a nicer option, and can be done with something like this in sshd_config: Match group yubikey # ForceCommand /usr/local/bin/yubikey.sh ForceCommand /usr/local/bin/mobileverification.sh The commented out script is something I wrote to authenticate Yubikeys - see http://yubico.com/yubikey And the mobileverification.sh sends a randomly generated 4 digit pin code to the phone number tha…
Additionally, if you don't want to pay for SMS you could send an email to your cell number.
Re: Simple Two-Factor SSH Authentication
#35As noted alsewhere, ForceCommand is a nicer option, and can be done with something like this in sshd_config: Match group yubikey # ForceCommand /usr/local/bin/yubikey.sh ForceCommand /usr/local/bin/mobileverification.sh The commented out script is something I wrote to authenticate Yubikeys - see http://yubico.com/yubikey And the mobileverification.sh sends a randomly generated 4 digit pin code to the phone number tha…
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…
This is not correct. You can't decrypt a key with a one time password.
The OP is requiring a the second factor(the OTP) after the key is sent to the server and authenticated.
Re: Simple Two-Factor SSH Authentication
#36As noted alsewhere, ForceCommand is a nicer option, and can be done with something like this in sshd_config: Match group yubikey # ForceCommand /usr/local/bin/yubikey.sh ForceCommand /usr/local/bin/mobileverification.sh The commented out script is something I wrote to authenticate Yubikeys - see http://yubico.com/yubikey And the mobileverification.sh sends a randomly generated 4 digit pin code to the phone number tha…
Re: Simple Two-Factor SSH Authentication
#37Re: Simple Two-Factor SSH Authentication
#38Re: Simple Two-Factor SSH Authentication
#39As noted alsewhere, ForceCommand is a nicer option, and can be done with something like this in sshd_config: Match group yubikey # ForceCommand /usr/local/bin/yubikey.sh ForceCommand /usr/local/bin/mobileverification.sh The commented out script is something I wrote to authenticate Yubikeys - see http://yubico.com/yubikey And the mobileverification.sh sends a randomly generated 4 digit pin code to the phone number tha…
What needs to go into trusted_keys?
It's the I'd of your specific Yubikey - I'm on my phone on a train right now, but off the top of my head it is the first 12 characters that get printed when you use your Yubikey. Pretty sure it's 12, anyway.
Re: Simple Two-Factor SSH Authentication
#40As noted alsewhere, ForceCommand is a nicer option, and can be done with something like this in sshd_config: Match group yubikey # ForceCommand /usr/local/bin/yubikey.sh ForceCommand /usr/local/bin/mobileverification.sh The commented out script is something I wrote to authenticate Yubikeys - see http://yubico.com/yubikey And the mobileverification.sh sends a randomly generated 4 digit pin code to the phone number tha…
What needs to go into trusted_keys?
# 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 tab before ForceCommand)
# /etc/init.d/ssh restart