TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Using two-factor authentication for SSH

65 pointsby kn9over 9 years ago

11 comments

lrvickover 9 years ago
There is already a standard solution for this imo. Get a GPG smartcard like a Yubikey and put an Authentication subkey on it.<p>Now to ssh to anything, clone from Github, etc you insert your Yubikey, and enter your pin to unlock it. A gpg-agent process is created that acts as a standard ssh agent.<p>No server modifications required and you get strong hardware backed 2FA. The ssh private key never enters system memory and could not be stolen even by an untrusted machine.<p>If the smartcard itself is stolen, it will brick itself on 3 incorrect pin attempts.<p>The same device can also store all your OTP tokens or behave as U2F depending on what a service supports so the end game is secrets no longer live on disk or in memory on your systems.<p>This also integrates well on Android devices via the Yubikey Neo with apps like Yubico Authenticator and Open Keychain,
评论 #10890833 未加载
georgyoover 9 years ago
The biggest problem with using google authenticator as a two factor mechanism is if you are managing many servers, is that each server needs to have its own setup. If they share keys, and one server gets compromised, they can generate keys for your other servers. As a result, you also cannot automated the process of deploying two factor on your servers.<p>A simpler and more robust method is SSH Keys + Passwords. I should write a blog post on this...
评论 #10889937 未加载
评论 #10888834 未加载
评论 #10889739 未加载
评论 #10889960 未加载
评论 #10888735 未加载
评论 #10890104 未加载
backslashover 9 years ago
Very Happy to see 2FA on SSH becoming more and more popular. One of the primary reasons my team has seen smart phones being used as the soft token is the ease of deployment argument, people already have the phone with them. With Yubikeys (not that they are cumbersome) but for some IT groups the &quot;perceived&quot; hassle involved (if a key breaks and have to reissue a new one) is a concern. You can lose your phone too, but some customers think that a phone has more chances of not being forgotten. We&#x27;ve also seen IT groups being quite comfortable using soft tokens because they have been using them for SaaS apps - whether its authy&#x2F;GA or anything else, I guess familiarity kind of desenstizes the analysis of a risk vector.
cornelinuxover 9 years ago
Not sure if to use SSH keys? Or Yubikey? Or Google Authenticator? On a whole bunch of machines?<p>Why not have it all?<p>Using privacyIDEA [1] you can<p>* manage SSH Pub keys for several servers * manage your Google Authenticator centrally * manage Yubikeys centrally or whichever OTP token.<p>In addition you can combine it to use the Google Authenticator or any other OTP ++PLUS++ SSH keys [2].<p>[1] <a href="http:&#x2F;&#x2F;privacyidea.org" rel="nofollow">http:&#x2F;&#x2F;privacyidea.org</a> [2] <a href="https:&#x2F;&#x2F;www.privacyidea.org&#x2F;ssh-keys-and-otp-really-strong-two-factor-authentication&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.privacyidea.org&#x2F;ssh-keys-and-otp-really-strong-t...</a>
Freak_NLover 9 years ago
If you have public-facing SSH daemons running, adding 2FA seems sensible. Google Authenticator essentially turns another computing device (the smartphone) into an ersatz hardware token. While this does increase security, I don&#x27;t like the trend of turning the smartphone into a universal second factor.<p>Alternatively, you could go for a dedicated hardware token such as Yubico&#x27;s FIDO U2F [1] keys [2]. Hardware tokens that use the fledgling FIDO U2F standard can also be used with PAM and SSH as well [3].<p>Two U2F keys (one backup) will cost around $40, and can be used with a growing number of webservices, including GitHub, DropBox, and GMail as well. The small form factor means you can put the key on your (physical, real world) keychain.<p>1: <a href="https:&#x2F;&#x2F;fidoalliance.org&#x2F;specifications&#x2F;overview&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fidoalliance.org&#x2F;specifications&#x2F;overview&#x2F;</a><p>2: <a href="https:&#x2F;&#x2F;www.yubico.com&#x2F;products&#x2F;yubikey-hardware&#x2F;fido-u2f-security-key&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.yubico.com&#x2F;products&#x2F;yubikey-hardware&#x2F;fido-u2f-se...</a><p>3: <a href="https:&#x2F;&#x2F;developers.yubico.com&#x2F;pam-u2f&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developers.yubico.com&#x2F;pam-u2f&#x2F;</a>
评论 #10888209 未加载
评论 #10888186 未加载
评论 #10888040 未加载
matthiasbover 9 years ago
I am using smart card authentication for SSH, I documented it here: <a href="http:&#x2F;&#x2F;codebazaar.blogspot.com&#x2F;2014&#x2F;07&#x2F;how-to-ssh-with-your-smart-card.html" rel="nofollow">http:&#x2F;&#x2F;codebazaar.blogspot.com&#x2F;2014&#x2F;07&#x2F;how-to-ssh-with-your-...</a>
评论 #10889617 未加载
评论 #10889706 未加载
ewindischover 9 years ago
A far more simple solution is to require both SSH key <i>and</i> password. Something you have (a key) and something you know. You can even store your ssh key on a Yubikey, if you&#x27;d like.
doublerebelover 9 years ago
I&#x27;ve been using Duo Security to add 2FA on SSH and other services on my SmartOS instances. It&#x27;s really easy and the price is pretty low compared to the amount of work it would take to manage the keys and manual implementations.<p>In theory I could worry about Duo going down, but I also rely on other critical cloud services and do have other ways to access an instance in an emergency (and Duo supports fallbacks).<p>Simplicity can be deceiving. In this case I think leaving security to the pros is worth the tradeoff. I&#x27;ve previously relied on cloud services for secure user management and wasn&#x27;t let down.
PTRFRLLover 9 years ago
Authy provides something similar, I wonder if one is better than the other.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;authy&#x2F;authy-ssh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;authy&#x2F;authy-ssh</a>
评论 #10889018 未加载
评论 #10888989 未加载
newman314over 9 years ago
Using 2FA is all well and good but what I haven&#x27;t found is a good solution for managing ssh keys for an organization&#x2F;group. Would love to get some recommendations here.
评论 #10890574 未加载
e40over 9 years ago
I prefer SSH keys with passwords + knocking for the ssh port (!= 22).
评论 #10891823 未加载