Two-Factor Authentication with SSH
sysconfig.org.uk
sysconfig.org.uk
(Hopefully you'll have configured things so that Duo's approval and a password are both required for login, so this isn't a catastrophic break in security, but it's still a little worrying. And what about when your Internet connection, or Duo's, is having problems? As I write this comment, HTTPS connections to www.duosecurity.com are throwing errors because they've installed a certificate for *.test.duosecurity.com. [1])
I prefer Google's pam_google_authenticator module. Like the Android/iOS app, it doesn't have any external service dependencies; all it assumes is reasonable clock synchrony.
[1]: https://www.ssllabs.com/ssltest/analyze.html?d=www.duosecuri...
I'm curious about more details -- to what degree is SSH (with public key auth only of course) more vulnerable than VPN, and for what reason? From academia I'm used to access to computers around the world using public SSH and port forwarding for most things, and in my world VPN was something people used on Windows, or just because it lets desktop applications act more normally, but I didn't think there was a security difference...
(Yeah I don't do sysadmin work, rest easy)
In other words, you can lead a correct horse battery staple to water, but you can't make it protect its key pair with a strong password.
I think the author's argument about using VPNs is more a "right tool for the job" thing. SSH is fine for remote shell, but then you start to need other network service access. You can use SSH tunneling, yes, but a VPN is better suited.
So, in a nutshell, the point is "only expose a single service." And since a VPN is more flexible than SSH, might as well go with that if you have the choice. You can of course make counter arguments along the lines of "expose only the minimal amount of functionality" or whether you think a VPN or SSH is more secure.
In SSH, you can tunnel ports, but that only secures traffic at that port. You can use a SOCKS proxy, but that only secures traffic configured to go through it. You can use the -w option and use IP forwarding, but then you're running TCP/IP over the SSH protocol which is bad. This is the closest you'll get to emulating what a VPN provides.
What do you trust more, OpenVPN with a port forward to an SSH server behind it, or a directly exposed SSH agent? Which will properly authenticate users without exposing any possible auth bypass, RCE, DoS, side channels, or potential vulnerabilities?
In general it's best if you can assume a perimeter firewall (i.e. VPN) will not always succeed in keeping the bad packets out. Of course it's a cop out to simply say "do both".
In general if you are managing a larger number of servers, it's not practical to MFA to each one individually / interactively. So you are forced to MFA to the border, and SFA to the individual servers. If you have a small number of servers you may find you get more fine-grain control, better auditing, and fewer points of failure to do something like this article suggests -- skip the OpenVPN and implement fully server-side validated MFA directly to the server.
The ultra-paranoid would add an HMAC based port-knocking scheme and forget about primitives like fail2ban. This could either be based on a 3rd factor or reusing the existing private key.
My own opinion is if you have few enough servers and no other reason for a VPN, then expose SSH on a non-standard port or use a port knocker, and use something like this article's MFA solution.
The non-standard port or port knocking is really just to keep spam out of your logs. Since authentication requires a 4096 bit private key, you're not worried about brute force in any case.
It's already in the most popular repos. It's used by the likes of NASA, Facebook, Box, Arbor Networks, Internet2, Twilio, Yelp, etc.
What's the contingency?
For what it's worth, I agree that Duo has better usability, and is probably the better solution in most cases. TOTP is the more paranoid option.
Duo supports this as well (and also other TOTP/HOTP modes). If you have access to a Duo account, look at the 'Import Hardware Tokens' feature under 'Devices'. That's not named accurately. Really it should be named, 'Import TOTP/HOTP secrets' as that's what they ask you to import and those secrets can be used in OATH compliant HW fobs or any software that does standard TOTP/HOTP. They also allow you to import Yubikeys as well if you like (of course, that's not OATH).
Authorization is done by making a POST request to a Duo-controlled server. If the response is the string "allow", it lets you in; if it's "deny", it doesn't. Duo can make that server return whatever they want.
No. It is fundamentally correct. The user can always do all kinds of stupid things to undermine the security of services they can access. For example transfer their token from a separate device (phone) to a generator on the same computer they use to log in (there's even a Chrome addon somewhere), or store passwords in a sticky on the screen... the possibilities are endless.
Still a good article on your MFA options with ssh.
Google Authenticator PAM module seems to be the other option that is widely used and it's much easier to find information on it.
The point being that users are already turning something-you-know into something-you-have by using a password manager.
EDIT I'm not saying that password managers are a bad thing.
Three-factor authentication with ssh public key, Google Authenticator and password
https://turquoiseliquorice.wordpress.com/2013/10/05/three-fa...