Live data from Hacker News

How to use FIDO2 USB keys with SSH

stavros.io

81–90 of 99 posts

Re: How to use FIDO2 USB keys with SSH

#81
post #63

Earlier quoted context omitted.

In a browser what you want is WebAuthn, U2F is an older never technically standardized hack and should not be used for new implementations. New web sites should do WebAuthn to enable this functionality, here's a guide someone else wrote that I found helpful in talking about the moving parts to actually implement this: https://webauthn.guide/ Firefox's WebAuthn implementation isn't as complete as it would ideally be,…

Care to elaborate how attestation is privacy infringing? As far as I understand, private attestation is a specific design goal of WebAuthN, achieved by either sharing an attestation credential with at least 100 000 instances of a given authenticator or via cryptographic means. There have been instances of authenticator vendors getting this wrong, but I remember reading that browsers will detect it and strip any attes…

Not everybody is comfortable that 100 000 is enough.

Is that extreme? Yes, but the upside to giving out attestation data just isn't there in most scenarios. It's like I have to step over broken glass to get a stale bagel. Yes these boots mitigate the risk from the glass very well but I don't even want a stale bagel anyway.

There are some scenarios where attestation makes sense. If you issued every one of your employees a genuine Yubico Yubikey then I guess it could make sense to insist on checking with attestation that nobody is using some homebrew device they built instead. But for general use? Even the tiny risk isn't justified, so it should be "off".

Here's someone much smarter than me proposing something you could do if you really care about the features from attestation but don't want people to give up privacy. If you insist on offering stale baked goods, here is how to clear up that glass:

https://www.imperialviolet.org/2019/01/01/zkattestation.html

Re: How to use FIDO2 USB keys with SSH

#82
post #64

Earlier quoted context omitted.

Oh is that what the "anonymize this key" is? If the website requires attestation, authentication might fail, but no website should require attestation, maybe unless you explicitly got the key from them (like a bank).

Websites should absolutely be requiring attestation. The attack scenario here is malware on your computer pretending to be a hardware authenticator (during sign-up or 2FA enrolment) but really just emulating one in software.

In this scenario bad guys are currently authenticated as you (otherwise they can't do enrolment) and can do whatever they want but, perversely, they decide what they want to do is... obtain the ability to authenticate as you later in a traceable way. I don't buy it.

If you're a James Bond villain and the plot's resolution needs to be saved for the final reel then this makes sense, you can't blow up the world 40 minutes into the story 'cos the audience knows that isn't the end. But real crooks don't want to build suspense, they're going to jump to the part where they win. Why play this long game?

Re: How to use FIDO2 USB keys with SSH

#83
I managed to make this work today as described in the article, after installing and configuring the software dependencies.

Client-side hardware dependencies:

* USB token with U2F (FIDO) support. FIDO2 is optional. Any old YubiKey or similar will work.

* For the resident key feature only: USB token with FIDO2 support.

* To avoid confusion, only a single USB token should be connected when ssh-keygen is run. (When ssh is run, multiple USB tokens work, the user can touch the wrong one many times, and authentication succeeds after the user touches the right one.)

* ED25519 support in the token is optional. (`ssh-keygen -t ecdsa-sk ...' uses the NIST P-256 curve, which works with all U2F tokens.)

Client-side software dependencies:

* For communicating with the token over USB, OpenBSD or (Linux with udev).

* OpenSSH 8.2p1 or later.

* OpenSSH client (ssh) compiled with `configure --with-security-key-builtin'. Without this, eventually authentication will fail locally with `internal security key support not enabled'. It's possible to work around this by compiling an .so file and specifying it with `ssh -o SecurityKeyProvider=....so', but it's complicated.

Server-side software dependencies:

* OpenSSH 8.2p1 or later.

* Default OpenSSH server (sshd) settings (without PubkeyAcceptedKeyTypes), or PubkeyAcceptedKeyTypes in /etc/ssh/sshd_config containing sk-ecdsa-sha2-nistp256@openssh.com and (optionally, for ed25519-sk keys) sk-ssh-ed25519@openssh.com .

Re: How to use FIDO2 USB keys with SSH

#84
post #68

Earlier quoted context omitted.

Waited 10 years? Why didn't you just use a yubikey in PIV mode, or the yubikey with gpg, or a smartcard, or… I've been using a yubikey PIV for, hmm… at least 5 years. Sure, a FIDO key is cheaper.

OpenSSH doesn't do X.509, how would PIV mode or a smartcard help?

Another guide, that doesn't even require yubico's PKCS11 module: https://ruimarinho.gitbooks.io/yubikey-handbook/content/ssh/...

Re: How to use FIDO2 USB keys with SSH

#85
post #76
post #68

Earlier quoted context omitted.

Waited 10 years? Why didn't you just use a yubikey in PIV mode, or the yubikey with gpg, or a smartcard, or… I've been using a yubikey PIV for, hmm… at least 5 years. Sure, a FIDO key is cheaper.

BTW both PIV and GPG in Yubikeys are just applets and not particularly suited for SSH use either. Proper applet for it is this one https://github.com/philipWendland/IsoApplet , if you can install it of course. Some get confused or have bad associations when hearing the word 'applet', but that is what they are, as in 'Java applet'. This one is too https://developers.yubico.com/ykneo-oath/Releases/

What makes you say it's not particularly suited for SSH?

Re: How to use FIDO2 USB keys with SSH

#86

Earlier quoted context omitted.

> ... so a remote SSHD can (if it wanted) demand to see signed evidence of user presence or refuse login, ... I'd like to be able to, server-side, 1) require that the private key used for authentication be stored on a hardware device and 2) require user presence, but I've never read or heard that this is possible (granted, I haven't looked into too much). If you have links to any documents that discuss how to impleme…

So there's two parts, let's take them separately. > 1) require that the private key used for authentication be stored on a hardware device So for this you're going to need the attestation data, which as you observe OpenSSH currently doesn't do anything with. It is willing to stash it in a file, and because it's a certificate it's safe for the token's owner to send this somewhere. So you could construct a mechanism to…

> I expect this would be a bunch of work, and I don't expect Free Software people to help build something to do it any time soon.

That's basically the conclusion I ended up at but I was hoping you were aware of some recent progress that I didn't know about! Thank you, though, I certainly appreciate the response.

Re: How to use FIDO2 USB keys with SSH

#87
post #85
post #76

Earlier quoted context omitted.

BTW both PIV and GPG in Yubikeys are just applets and not particularly suited for SSH use either. Proper applet for it is this one https://github.com/philipWendland/IsoApplet , if you can install it of course. Some get confused or have bad associations when hearing the word 'applet', but that is what they are, as in 'Java applet'. This one is too https://developers.yubico.com/ykneo-oath/Releases/

What makes you say it's not particularly suited for SSH?

Because they were made for a different purpose, with extra hoops you need to jump through.

Re: How to use FIDO2 USB keys with SSH

#88
post #83

I managed to make this work today as described in the article, after installing and configuring the software dependencies. Client-side hardware dependencies: * USB token with U2F (FIDO) support. FIDO2 is optional. Any old YubiKey or similar will work. * For the resident key feature only: USB token with FIDO2 support. * To avoid confusion, only a single USB token should be connected when ssh-keygen is run. (When ssh i…

FYI Another client-side software dependency: libfido2 >=1.3.0. It doesn't work with libfido2 1.2.x or earlier.

Also, if it doesn't work on your client system only because OpenSSH 8.2 was compiled without `configure --with-security-key-builtin', here is how to make it work: https://github.com/pts/external-sk-libfido2

Re: How to use FIDO2 USB keys with SSH

#89
post #69
post #2

Be aware literally nothing supports this unless it's your own kernel. Gitlab? No. Github? No. My gateway with a hand built gentoo kernel? Yes. It seems functional, but you've also got to be aware that `ed25519-sk` and `ecdsa-sk` have sort of spotty support in the devices too. `ed25519-sk` does not work on a Yubikey <5, for example.

Not only that, but there's billions of devices out there that don't support it. I can SSH to my AP, my home router, all routers at basically any ISP. None of those support this. Most of them probably never will, until they're thrown away and new ones bought in 5-10 years. Bottom line: This can't be your only key. So why bother? Why not use PIV mode/smartcard/other, which does work with every single one of these billi…

Here is another tradeoff. Many PIV smartcards (such as YubiKey 4, if I'm not mistaken) are able to store only a single private key. With U2F (ecdsa-sk), the number of SSH keys is unlimited.

Another tradeoff. Some users may be using a cheap or old token (without PIV support) or a token with a private key slot already used for something else. Now, with a software-only upgrade (on both SSH client and server), they can user their existing token for SSH authentication.

Re: How to use FIDO2 USB keys with SSH

#90
post #89
post #69

Earlier quoted context omitted.

Not only that, but there's billions of devices out there that don't support it. I can SSH to my AP, my home router, all routers at basically any ISP. None of those support this. Most of them probably never will, until they're thrown away and new ones bought in 5-10 years. Bottom line: This can't be your only key. So why bother? Why not use PIV mode/smartcard/other, which does work with every single one of these billi…

Here is another tradeoff. Many PIV smartcards (such as YubiKey 4, if I'm not mistaken) are able to store only a single private key. With U2F (ecdsa-sk), the number of SSH keys is unlimited. Another tradeoff. Some users may be using a cheap or old token (without PIV support) or a token with a private key slot already used for something else. Now, with a software-only upgrade (on both SSH client and server), they can u…

Ah yes, that's a good point. It is not great that you leak your identity by using pubkey (ssh whoami.filippo.io).
Post reply on HN