Demo for using a FIDO security key, SSH certificate, and ssh-agent
to provide a form of SSH single sign-on (SSO),
but require the security key to be inserted when signing in.
It uses the security key as a posession factor only.
Note that when using hardware-backed SSH keys (i.e.of type ecdsa-sk
or ed25519-sk
),
the private key file does not contain the private key itself but a reference (a "key handle") to the actual private key
which is stored on the security key.
SSH certificates are used so that the authorization to sign in without touch is stored as a certificate extension.
Lastly, ssh-agent
is used to obtain 'single sign-on", as the private key file is protected with a passphrase.
This is normally superfluous when using security keys when the security key requires a PIN,
but in this case the security key is configured without any touch or PIN requirements (neither UP nor UV in FIDO terms).
The effect is that a user only needs to supply the passphrase once when adding the key to the agent, but can subsequently sign in on any server that trusts the certificate issuer as long as the security key is inserted.
This can be useful when running automation scripts that repeatedly sign in on a server that makes user interaction impracticle, for instance when using ansible to deploy a server.
SSO can be disabled either by removing the key from the agent (ssh-agent -D
) or by removing the security key,
in which case the agent can no longer access the security key:
sign_and_send_pubkey: signing failed for ED25519-SK "./mykey" from agent: agent refused operation