274 points · by simonpure · 4y ago · 92 comments
"Normal" SSH keys will work for (pretty much) all systems that support SSH. And the ones that don't will certainly never support U2F.
For business, it's a better deal to buy new Yubikeys that support FIDO2 then it is to support GPG on Yubikeys.
- The guide was mostly written before that was possible
- Many servers are slow to update to newer distro versions with newer openSSH versions. I still need to access at least one server which can’t support it yet. (And just one which doesn’t support it forces me to use the GPG approach so that it’s the same key everywhere.)
- the guide also tells you to use the new approach if it’s available to you :)
- GPG is still used for some other things, like signing git commits
Backing up the secret key material is still an issue with FIDO2.
You should add multiple keys to your logins and have a "backup" key which is separate one.
Especially when you lose physical key, you want to have different one and revoke lost one asap.
The same with private keys generated on a device - private key should stay on the device on which it was generated and never copied. If you need access from a different device you generate private key on another device and transfer public key only to be added to account.
Which in turn also makes physical keys that you can connect to different devices a bit more convenient as private key never leaves key and is not directly accessible by laptop that it is connected to.
Having a strong passphrase makes things a lot simpler. A classic convenience vs security tradeoff...
I can't use it to log in to my routers and other SSH gear, and don't expect to for the lifetime of the hardware.
With OpenSSH U2F it'll be decades before you won't ALSO need a more traditional key. That or use passwords (brrr)
I also disagree with the idea of backing up the private key. Generating secure passwords is hard and it is infeasible to ask people to use diceware to generate and store their secure backup. And if you aren't doing backups you might as well generate the key on device. For the purpose of revocation, you can keep a signed revocation certificate around in the event you lose your key.
This makes the guide much simpler, as you don't have to spin up a live airgapped system with secure boot for each employee's key generation. There's no need to have a complicated backup flow either.
---
YubiKeys in general are problematic as they don't have a display that can show the action being taken, e.g. a compromised host could display one thing while the user is signing/encrypting another. This isn't a problem in modern crypto hardware wallets, which have displays that show precisely what is being signed, to mitigate this exact threat model.
You should have secure copies of your master key. Especially if you've invested time in building up your web of trust. Backing up encryption keys is also useful. If they're lost, data cannot be decrypted later. Signing keys are the only ones which are completely expendable.
Creating a paperkey and storing it in a physical safe is ideal. That way you can keep your master key offline until needed and use subkeys for daily use.
You can encode it as a QR code:
gpg --export-secret-key $KEY | paperkey --output-type raw | qrencode --8bit --output secret.png
And easily restore it later with zbar: zbarimg --raw --oneshot -Sbinary secret.png | paperkey --pubring public.asc | gpg --import
zbarcam --raw --oneshot -Sbinary | paperkey --pubring public.asc | gpg --importWhere can I read to how to do that?
https://www.jabberwocky.com/software/paperkey/
https://wiki.archlinux.org/title/Paperkey
The paperkey tool will produce a human-readable text file that you can print out. I found that to be inconvenient and settled on QR codes instead. They're ubiquitous, machine-readable and have built-in error correction.
I’m at the moment between keys. I tried to use the new SSH keys which resides on the FIDO key. Problem is that most services I wanted it to use for don’t understand them. Most prominently Ubuntu LTS18.4 because of no official support for OpenSSH 8.2. So I use my old key with an ssh key derived from gnupg and a new one with resident ssh key.
(I already own a Ledger Nano X and a Trezor in case that’s what you mean with “crypto device” and find the GPG experience insufficient).
Unlike a YubiKey, the screen on both Trezor and Ledger mitigate the confused deputy/phishing attack for the purposes of FIDO U2F. I'd recommend them with usage for U2F, specifically the Ledger if you're interested in better hardware security at the expense of open-source.
I can overlook the UX issues when it’s a matter of 1-10 average signs per day and not 100s, like I have with PGP+U2F. I guess they’re all right as backup devices.
The new Nitrokeys look interesting (and not yet available) but I agree, something is missing in the market here.
Which ones?
I think solving the lack-of-display problem is far easier for FIDO/TOTP than GPG, as with GPG you could be signing arbitrary content that is difficult to validate on a small screen.
But FIDO/TOTP data are more structured and can be coerced into being displayed on the device's screen, as shown in this video [1].
For Windows, you need to compile (cf https://gist.github.com/martelletto/6a7cf806c6433ac9ce71d66a... ) then ssh-keygen -t ecdsa-sk
For Linux, if you need to recompile: https://cloud.google.com/compute/docs/tutorials/ssh-with-sk
https://www.schneier.com/blog/archives/2007/11/the_strange_s...
You can read about what is actually done to make ECDSA keys here.
https://wiki.openssl.org/index.php/Creating_an_OpenSSL_Engin...
debian 10 backports repository has openssh 8.4 with FIDO2 support builtin so no recompile needed there.
debian 11 has 8.4 in its regular repository.
I also recommend doing what I did: get two Yubikeys, not one. Do everything twice, that way you have a physical backup/fallback device. You can also choose to leave one permanently stored somewhere and carry another one with you. Encrypt your backups for two public keys, add two 2FA keys to critical sites, etc. It buys you lots of options for relatively little effort.
It all appears to be pretty far from being plug and play, often seeming to require a lot of additional software/modules to get specific things working. Is this because the standards don't go far enough or am I just way off the mark?
When shopping for a suitable device you look for OpenPGP compatibility on the list of features. You can even still get it in smartcard format[1]. Integrated USB devices like the YubiKey that support OpenPGP are effectively emulating a smartcard and a USB smartcard reader.
[1] https://www.floss-shop.de/en/security-privacy/smartcards/13/...
If it’s plugged into a networked system, it's not air-gapped. And if an air-gapped system is connected to any device which has previously been connected to a non-air-gapped system, it's no longer air-gapped.
I hate to nitpick, but this is really, really important.
Every air gapped system has the weakness that you have to eventually get material on and off the system. That connection can be used to attack the air gapped system. The smartcard interface used here to isolate the systems might be considered weaker than other methods but it is intended to provide this sort of isolation.
Everything else - good luck. Proprietary apps. Each one is slightly different. I haven’t bothered to use it for key generation. To be fair, there are hardware design constraints (no clear UI) so it would be hard to get around the learning curve.
So this is why when talking about using hardware keys to unlock local stuff, like a PC, or authenticate/decrypt SSH, GPG, bitlocker etc. this all gets so tricky and often needs extra software?
From their website: “Support for WebAuthn, FIDO2, FIDO U2F, smart card (PIV), Yubico OTP, OpenPGP, OATH-TOTP, OATH-HOTP, and Challenge-Response” [1]
So one key can do all of those things. How user friendly it is depends on the service you’re using and how that is configured. Logging into to a google account? Easy. Logging into Windows? Easy-Medium [2]. As more organizations support the tool, it becomes plug and play in a lot of areas (Okta, centrify, etc). Mac is more difficult with opportunity to lock yourself out [5]. Linux is… Linux.
You can set more configurable options in the manager tool. [3]
But it can get as complicated as you want it to with the developer tools [4].
I’ve been following this for years and have had keys, and I think we’re finally to the point where I could recommend it to a semi-technical person. Get 3 - 1 small form factor that stays in your main computer / pc / chromebook, one on your key ring with NFC, and a backup in a fireproof safe. That will stop any account takeover. If a key is lost or stolen, revoke and replace it. That will cover 99% of attack scenarios for the population.
[1] https://www.yubico.com/product/yubikey-5-nfc/
[2] https://www.yubico.com/products/computer-login-tools/
[3] https://www.yubico.com/support/download/yubikey-manager/
[4] https://www.yubico.com/support/download/
[5] https://support.yubico.com/hc/en-us/articles/360016649059-Us...
`PKCS11Provider /usr/lib/ssh-keychain.dylib`
This kind of knowledge is proximate to my own line of work, but I think it could be frustrating for others that have no such alignment.
These days I use the FIDO support. It is much simpler, but software support is a bit on the bleeding edge. You don't get to amortize a GPG toolchain in for commit signing or anything like that, though.
If I am in a small company, I can give everyone a yubikey and have some process that verifies everyone.
Now I want to eliminate cookies / sessions keys. (just go with me). I want to use client certificates - but I only trust the yubikey.
I am noodling ways that I can generate client certs, install them fairly easily and sign them with the yubikey.
The goal here is that client certs are a really good idea- every request can include one, as opposed to every request including a session cookie / nonce that is open to interception / playback etc etc.
And now we have billions of hardware security modules (am including secure enclaves in phones) - so there really ought to be a way through here.
My problems include "generating client certs client side" - not something many browsers support and signing that in some sensible fashion
But is all seems quiet possible
The UI for client certs in browsers are miserable, terrible, horrible and insert every other awful adjective you can imagine. Seriously, it's so broken as to be unusable. Everybody knows it, nobody wants to fix it.
With a client certificate the end server knows, you don't need to fuck around with cookies and TLS binding and so on. Add a new end point - great to use that during your "session". it just works.
One day I will work it out.
FIDO2 is arguably a much better way to deal with this provable identity problem. The UI for FIDO2 has been worked out and is good enough, etc. The big problem is, it requires handing people Yubikeys(or similar devices).
see: https://textslashplain.com/2020/05/04/client-certificate-aut...
Instead of generating client certs client side, generate a elliptical curve key pair who's public key you sign with the yubikey and send to the server. Then, sign every request with that key and the server can verify it using the public key sent previously. All that can be done in js, without a jwt or sending anything other than a request and signature. It's essentially a client cert.
I still don't really understand how much more security it'd get you than bog standard webauthn, especially considering it'd be a custom, less tested system, but you can already do something similar to your idea using standard cryptographic primatives.
Also, sops (https://github.com/mozilla/sops) works with gpg and so with Yubikeys.
Too bad that there is no flow diagrams of how all physical object connects.
Or key objects relates to each entity being transitioned.
It’s a lot of reading and typing as you go before something clicks in one’s head.
We still use it for SSH and its great!
If someone steals the key, they can't really do anything with it. They can't sudo because the session is locked. They can't use it to log in your web accounts from other computers because websites ask for a password/pin in addition to touching the yubikey.
PS: you should always have a backup yubikey (or, better, two)