An ordinary SSH private key is a file. Malware or a stolen backup can copy it. With a FIDO2 security key, the private key stays on the hardware: each login or signature needs the key plugged in and touched, and optionally its PIN.
What you need
- A FIDO2 security key. For
ed25519-skon a YubiKey, Yubico says firmware 5.2.3 or newer; older keys can useecdsa-sk. - OpenSSH 8.2 or newer (8.3 to download resident keys with
ssh-keygen -K, 8.4 forverify-required). - For commit signing: Git 2.34 or newer.
Check with ssh -V and git --version.
1. Create an SSH key on the security key
ssh-keygen -t ed25519-sk -O resident -O verify-required -C "you@example.com"
-t ed25519-skcreates a key whose private part lives on the security key (useecdsa-skif Ed25519 is not supported).-O residentstores it on the key, so you can recover it on a new computer withssh-keygen -K.-O verify-requiredasks for the key’s PIN on every use, not just a touch.
The files written to ~/.ssh are a handle and the public key. The handle is useless without the physical key.
2. Use it for server logins
Add the .pub file to ~/.ssh/authorized_keys on the server, or to your Git host. GitHub and GitLab accept security-key SSH keys. Check self-hosted tools before relying on them: Atlassian documents that FIDO2 SSH keys do not work with Bitbucket Data Center.
On servers you control, you can require PIN verification for every security-key login with PubkeyAuthOptions verify-required in sshd_config.
3. Sign Git commits with the same key
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519_sk.pub
git config --global commit.gpgsign true
Point user.signingkey at the .pub file. If you paste the key text instead, Git needs a key:: prefix.
Then add the same public key to GitHub (Settings → SSH and GPG keys → New SSH key, type Signing Key) or to GitLab. Signed commits show as Verified.
4. Register a backup key
Generate a second SSH key on a second security key, add both public keys everywhere, and keep the spare somewhere safe. See what to do if you lose a key.
Odoo teams
If you deploy Odoo from Git (including Odoo.sh), this protects the path from a developer’s laptop to production. Pair it with server hardening and security keys for Odoo sign-in.