In OpenSSH, what does a FIDO-backed key such as [email protected] prove at login, and what do touch and verify-required add?
answer
- key handle on disk, secret in hardware
- flags and a counter in each signature
- user presence is the default
- verification means a PIN
- still one factor to sshd
basics
~20 sA FIDO-backed SSH key signs inside a hardware authenticator, so a login proves that device was present; the file on disk is only a key handle. sshd requires a touch by default, and verify-required also demands a PIN-verified signature.
solid answer
~40 sWith `[email protected]` or `[email protected]` keys, the private key file holds only a **key handle**; the authenticator combines it with a per-device secret that cannot be exported, so copying the file is useless without the device. Each signature carries the authenticator's **flags** and a **counter** alongside the usual signature over the session identifier. By default sshd requires the **user-presence** flag, so someone had to touch the device; `no-touch-required` on the authorized_keys line relaxes that, and `PubkeyAuthOptions touch-required` refuses the relaxation. `verify-required`, as an authorized_keys option or in `PubkeyAuthOptions`, also demands that the device verified the user, today by PIN. OpenSSH still counts a security key as one factor even with a PIN; to demand two, combine methods with `AuthenticationMethods`.
go deeper
Recall that an sk key lives partly in a hardware authenticator: the file is a handle, the device signs, and a touch is normally needed for each login.
Explain what the signature carries beyond an ordinary key, flags and a counter, and what the touch and PIN flags each mean to sshd.
Show the operational choices: when no-touch-required is acceptable, enforcing presence or verification server-wide with PubkeyAuthOptions, the risk of resident keys, and why a PIN does not make two factors.
Weigh hardware-backed keys against short-lived certificates or a second method: each moves assurance differently, and the rollout cost lands on device supply and recovery.
## What the sk key types are OpenSSH supports **FIDO/U2F hardware authenticators** as key types of their own. The wire names are `[email protected]` and `[email protected]`, created with `ssh-keygen -t ed25519-sk` or `-t ecdsa-sk`, and certificate variants exist for both. To the SSH protocol they are ordinary `publickey` authentication: the client sends the public key and a signature over the session identifier, and sshd checks that the key is authorised and the signature verifies. What changes is **where the signature is made** and **what extra evidence it carries**. Passkeys used for web sign-in are a related idea covered with web authentication; here the subject is SSH keys only. ## The key handle and the device secret The `ssh-keygen` man page describes two parts: - a **key handle**, stored in the private key file on disk (`id_ed25519_sk`); - a **per-device private key**, unique to the authenticator and **not exportable** from its hardware. At login the hardware combines the two to derive the real signing key. So: 1. Copying `id_ed25519_sk` from a laptop gives an attacker a key handle and nothing to sign with. 2. The authenticator must be attached for every login with that key. 3. Losing the device without the file is likewise not enough for an attacker, unless the key is **resident** (below). ## What each signature carries PROTOCOL.u2f, OpenSSH's description of the format, lists what the authenticator signs: a hash of the **application** string (normally `ssh:`), a **flags** byte, a **counter**, and a hash of the message. The message is the usual RFC 4252 data beginning with the session identifier. The flags and counter travel on the wire with the signature, so sshd can read them. | Evidence | Set by | Checked by sshd | |---|---|---| | signature over the session identifier | the authenticator | always, like any key | | **user presence** flag (a touch) | the authenticator, when touched | required by default | | **user verification** flag (a PIN) | the authenticator, when the PIN was entered | only with `verify-required` | | counter | the authenticator, increasing | carried in the signature | ## Touch: user presence By default sshd **requires the user-presence flag**, so a signature without a touch is refused. That defeats malware that tries to sign silently while the device is plugged in: it still needs a human to tap the authenticator. - `no-touch-required` on a key's `authorized_keys` line, or as a certificate option, allows signatures without presence, for unattended use. - `ssh-keygen -O no-touch-required` creates a key that does not ask for a touch, and sshd still refuses its signatures unless that override is present. - `PubkeyAuthOptions touch-required` in sshd_config makes presence mandatory and disables the override. ## verify-required: user verification `verify-required` asks for more than a touch: the signature must attest that the authenticator **verified the user**, which today means a PIN. It can be set in three places: - on the `authorized_keys` line for one key; - in sshd_config with `PubkeyAuthOptions verify-required`, for every FIDO key; - as a certificate option, or at key generation with `ssh-keygen -O verify-required`. Not all authenticators support it. Neither `touch-required` nor `verify-required` has any effect on non-FIDO key types. ## Still one factor, and resident keys PROTOCOL.u2f is explicit: from sshd's point of view a security key is **a single factor of authentication, even if protected by a PIN or biometric**. Something you have plus a PIN checked on the device is strong, but sshd does not count it twice. To require two independent methods, list them in `AuthenticationMethods`, for example a FIDO key followed by keyboard-interactive. A **resident** key (`ssh-keygen -O resident`) stores the key handle on the authenticator itself, so it can be loaded on another computer with `ssh-add` without copying a file. Resident keys typically require a PIN to be set first, and the man page warns the obvious cost: with both parts on the device, a stolen authenticator is more useful to an attacker. ## What this buys in practice - A copied key file is no longer a working credential. - With presence required, every login needs a human touch, which also limits what a compromised client can do with the key. - With `verify-required`, a stolen device without its PIN cannot produce a signature sshd accepts.
- Why would an administrator add no-touch-required to a FIDO key's authorized_keys line?For unattended use where nobody can touch the device. It weakens what the login proves: software on the client could then sign whenever the authenticator is attached. A server that must never allow that sets PubkeyAuthOptions touch-required, which disables the override.
- What does creating an OpenSSH FIDO key as resident change?ssh-keygen -O resident stores the key handle on the authenticator, so the key can be loaded onto another computer with ssh-add instead of copying a file. It usually needs a PIN set on the device, and with both parts on the device a stolen authenticator is worth more to an attacker.
- Copying an sk private key file to another laptop is enough to log in.
- A FIDO key with a PIN counts as two factors for sshd.
- Touch is optional unless the server explicitly asks for it.
- With verify-required the server checks the user's PIN itself.
- verify-required also makes ordinary ed25519 keys ask for a PIN.