Also what happens if you loose your cellphone? We thought about this and for us the possibility of loosing access to the server fully was too much.
If not, it might be possible to configure PAM with some sort of keys module set to 'sufficient', then have PAM fall back on two-factor auth paired with pam_unix.
In fact, I'll see if I can get either of those working a bit later today. Seems like it could be neat.
Of course this leaves you a vulnerable to ip spoofing, but adds a ton of convenience and could be a good trade-off.
But that's correct, in recent openssh versions, it seems that you can add specific-host-only rules for authentication etc.
I also believe I once ran across a patch someone had done to the login code to allow both to be required, I can't find the link right off though as I'm at work currently. If I find it, I'll add it here
This is on our list to pay for someone to do, and we'll release it when they do ... it will probably be FreeBSD-centric, but if it's against OpenSSH generally, it should be usable by others...
Then that's a process problem that can be solved. It would take a trivial amount of time to screenshot the page and stash them in your wiki or similar.
I've written down mine on three different pieces of paper (in my wallet, my bag and my closet), and also took a screenshot from it and `gpg`-ed it (with a passphrase, so no one can open it unless they know the password) and stored it in a few online repositories, as well as a friend's mailbox.
So, I'll never be locked out from my account.
This is your problem. I keep mine (for multiple services) in my wallet, and it's worked out excellently.
Anyone set up Google Authenticator to only challenge me on a host every N minutes or something like that? I.e., first login requires two-factor auth, subsequent logins don't for at least 30 minutes? Seems like it'd be irritating to keep popping my phone out every time I connect to a remote server.
Unless I'm mistaken in how Google Authentiator works - of course. If so, please fill in my blank :-)
[0] http://code.google.com/p/google-authenticator/
[1] http://en.wikipedia.org/wiki/HOTP
[2] http://en.wikipedia.org/wiki/Time-based_One-time_Password_Al...
So you are in fact handing over your 2-factor auth key to Google when you run google-authenticator. There's no actual need for the binary to do this (although it obviously makes the key entry on the phone much less error-prone) and there don't seem to be any command line arguments that would turn it off either. doesn't do this at all -- see below. (can I do strikethrough on HN?)
So you are in fact handing over your 2-factor auth key to Google when
you run google-authenticator
Unless things have changed a lot since I last used this, this is not entirely correct. The binary will print out a URL - the QR code is only generated if you hit this URL.If you visit this URL, you are sending the "QR-encoded" (not exactly, but you know what I mean) version of the key to Google's servers.
As long as you do not visit this link, you will not send your key to Google's servers.
So don't hit that URL if you don't want Google to know your 2-factor auth data!
Also, the way I would intend on using this is such that if your public key is in authorized_keys, you log in like normal. If not, you authenticate with PAM using both your unix password (or ldap or whatever you have configured) and your 2nd authentication system. I log into one or two of my servers from strange computers often enough that disabling password authentication entirely on those servers is limiting.
Here's how you do it: first, sudo apt-get install libpam-google-authenticator; second, run google-authenticator as the user you will access remotely and follow the instructions; then, edit /etc/pam.d/sshd, and add "auth required pam_google_authenticator.so" in a new line; edit /etc/ssh/sshd_config and add (or change) the ChallengeResponseAuthentication line so it reads "ChallengeResponseAuthentication yes"; and finally, sudo service ssh restart to restart the ssh server.
More info is available from the packager of libpam-google-authenticator[1], and from the Google Authenticator PAM module's README.[2]
--
[1] http://blog.theroux.ca/security/ubuntu-2-step-authentication...
[2] http://code.google.com/p/google-authenticator/source/browse/...
--
Edits: Corrected typos; added more context.