FIDO2 hardware keys
FIDO2 security keys such as a YubiKey can sign you in to SSH servers through the sk- key types that OpenSSH added in version 8.2. The private key stays on the security key, and every signature needs it there: held to the phone, plugged in, or touched.
ZestSSH reaches a security key in two ways:
- On a phone (from 4.0), ZestSSH talks to the security key itself: by NFC on Android and iPhone, or plugged in by USB-C on Android. See On a phone.
- On a computer, ZestSSH talks to an SSH agent: the agent and the hardware behind it do the signing, and ZestSSH passes the request through. See On a computer. The same path works for any key an agent holds: keys you loaded with
ssh-add, smart cards, and the SSH keys kept in 1Password or Bitwarden.
Availability
Section titled “Availability”| Platform | How ZestSSH reaches the security key | Status |
|---|---|---|
| Android | Itself, by NFC or a key plugged in by USB-C | From 4.0 |
| iPhone | Itself, by NFC | From 4.0 |
| iPad | Not yet: iPadOS gives apps no NFC reader | Not available |
| Windows | Through the OpenSSH pipe (\\.\pipe\openssh-ssh-agent) |
Full support |
| macOS | Through a Unix socket ($SSH_AUTH_SOCK, or the 1Password or Bitwarden socket) |
Full support |
| Linux | Through a Unix socket ($SSH_AUTH_SOCK, or the 1Password or Bitwarden socket) |
Full support |
A USB security key does not work on an iPhone yet: iOS gives an app no way to talk to one. Use one with NFC.
Other keys an SSH agent holds (loaded with ssh-add, or kept in 1Password or Bitwarden) sign in on a computer only: phones have no SSH agent for ZestSSH.
Supported key types
Section titled “Supported key types”OpenSSH 8.2 and later define two FIDO2 SSH key types, and ZestSSH signs with both, on a phone and through an agent:
| Key type | Notes |
|---|---|
sk-ecdsa-sha2-nistp256@openssh.com |
Works with nearly every FIDO2 security key. |
sk-ssh-ed25519@openssh.com |
Needs a newer security key with Ed25519 support. |
On a phone
Section titled “On a phone”From 4.0, an Android phone or tablet and an iPhone sign in with a security key on their own. There is nothing else to install.
Make a key on a security key
Section titled “Make a key on a security key”- Open Manage > Keys (on a tablet, More > Keys) and tap +.
- Fill in Display name and Username, and choose SSH key.
- Tap On a security key: “Make the key on a FIDO2 security key, over NFC or USB. It never leaves the security key.”
- In New key on a security key, pick the Key type: Ed25519 or ECDSA P-256. Ed25519 needs a newer security key; every FIDO2 key can make ECDSA P-256.
- Turn on Ask for the security key’s PIN every time if you want the key to sign only after its PIN is typed: “ZestSSH then asks for the PIN at every sign-in, and a security key that supports it is also set to sign only after the PIN.” This needs a PIN set on the security key (set one with its maker’s app, such as Yubico Authenticator).
- Tap Create, then hold the security key to the back of the phone (near the top of an iPhone), or plug it in. Touch it when a plugged-in key blinks. If the security key has a PIN, ZestSSH asks for it here too, also with the switch off.
- Tap Save key, then add the key’s public key to your hosts as for any key (see Install a key).
The key is made on the security key and stays there. ZestSSH keeps only the key file: its public half and a handle the security key knows it by. That file holds no secret, and on its own it cannot sign anything.
A large tablet, which has the computer’s Keys page, does not offer On a security key there. Make the key on a phone, or with ssh-keygen on a computer, and import its file.
A PIN every time: who holds to it
Section titled “A PIN every time: who holds to it”With Ask for the security key’s PIN every time on, ZestSSH asks the security key to keep that rule itself, through FIDO2’s credProtect extension. A security key that has it then signs with this key only after its PIN, whatever app asks, a computer’s SSH agent included.
A security key without it still makes the key, and ZestSSH says so: “Key made. This security key cannot be set to sign only after its PIN, so asking for it every time is ZestSSH’s own rule: someone with both the security key and this key’s file could sign with a touch alone.” The rule is then a flag in the key file, which ZestSSH holds to.
Bring in a key made elsewhere
Section titled “Bring in a key made elsewhere”A key made with OpenSSH on a computer (ssh-keygen -t ed25519-sk or -t ecdsa-sk) comes with a file, id_ed25519_sk or id_ecdsa_sk. Bring it in as any key file: in the key’s editor, tap Paste key or Import from file. The file holds no secret, so it is safe to move between your devices.
A key made with -O resident still needs its file here: ZestSSH does not read the list of keys stored on the security key. On a computer, ssh-keygen -K writes the files of a security key’s resident keys again.
Sign in
Section titled “Sign in”Connect to the host as usual. When the host takes the key, ZestSSH asks for the security key:
- “Hold your security key to the back of the phone, or plug it in.” (Android with NFC and USB)
- “Plug in your security key.” (Android without NFC)
- “Hold your security key near the top of the iPhone.” (iPhone, in the system’s NFC sheet)
- “Touch your security key.” when a plugged-in key blinks.
Keep the key still until the sheet closes: a sign-in with a PIN takes a second or two. If it moves away too soon, ZestSSH says “The key moved away too soon. Hold it still until this closes.” and waits for it again.
On Android, the first time you plug a security key in, Android asks whether ZestSSH may use it. A key plugged in while the phone waits for NFC is used too.
The PIN
Section titled “The PIN”A key made with Ask for the security key’s PIN every time asks for the security key’s own PIN in the sheet, in a Security key PIN field: “The PIN of the security key itself. ZestSSH does not keep it.”
- The PIN is never saved, and the field is cleared once the PIN is sent.
- A wrong PIN says “That PIN is wrong.” with how many tries the security key still gives, for example “3 tries left before the key blocks its PIN.”
- After three wrong PINs in a row, ZestSSH says “Too many wrong PINs in a row. Take the security key away, then hold it to the phone or plug it in again.”
- After too many wrong PINs in all (eight on most keys), the security key blocks its PIN for good (ZS-1704). Only a reset with its maker’s app helps, and a reset erases every key on it.
- If the security key moves away after the PIN was sent and before it answered, ZestSSH reads the security key’s count of tries when it is back. It sends the PIN again only where that count shows the first send was not taken as a wrong try. Otherwise you type it again: “The security key moved away before it answered. Type the PIN again.”, or “That PIN is wrong.” where the count fell.
ZestSSH never tries a PIN you did not type.
When the security key does not sign
Section titled “When the security key does not sign”Whatever stops the security key ends the sign-in: a password saved beside the key is never tried in its place, and ZestSSH says “No other way of signing in was tried in its place.” Closing the sheet cancels the sign-in.
Before a signature goes to the host, ZestSSH checks it: that it is for this key and for what was to be signed, and that the security key waited for the touch or PIN the key asks for. An answer that fails the check is not sent (ZS-1705).
A scheduled task, the server monitor and other runs with nobody there cannot use a key on a security key: nobody is there to hold it to the phone.
On your computer too
Section titled “On your computer too”ZestSSH keeps a security key’s key as its OpenSSH key file, in the place a key’s private key goes. That file holds no secret, only the handle the security key knows the key by and the public key, and it is useless without the security key itself. So it can travel freely:
- Get the file onto the computer. With personal sync on, the key reaches the computer like any key. Without sync, open the key’s editor on the phone, choose Export private key, and move the file to the computer.
- Load it into the agent. On the computer, export the file the same way (Export private key in the key’s editor), then run
ssh-addwith it, for examplessh-add ~/.ssh/id_ecdsa_sk. This needs OpenSSH 8.2 or later, with the security key plugged in. - Connect. ZestSSH signs through the system’s SSH agent; touch the security key when it blinks.
Until the file is in the agent, a sign-in with the key stops and tries nothing else: “The key of this sign-in is not in the SSH agent any more. Load it into the agent again, or plug in the hardware key it is on, and connect again.”
On a computer
Section titled “On a computer”On Windows every account of the computer shares the agent pipe’s name, and the first program to take it serves it. So before it sends anything, ZestSSH asks Windows who serves it: Windows’ OpenSSH Authentication Agent, or a program running as you, such as 1Password or Bitwarden. A program of another account gets nothing, not a key and not a sign-in, and ZestSSH says so (ZS-1701).
How it works
Section titled “How it works”ZestSSH does not talk to the USB or NFC token itself on a computer. It speaks the SSH agent protocol to an agent, and the agent, backed by the token, does the rest:
- Find the agent. For the system’s agent, ZestSSH uses the socket named in
$SSH_AUTH_SOCKon macOS and Linux, and the OpenSSH pipe on Windows. For 1Password or Bitwarden it looks where that app’s agent listens. On macOS and Linux it checks the socket first and refuses one that others can write to (world-writable, or group-writable), since a program on that socket could read every signing request. - List the keys. ZestSSH asks the agent which keys it holds, including
sk-keys. - Save the key. You pick keys from the list, and ZestSSH saves each as a key that names the agent. Only the public key and a name are stored: no private key reaches the app.
- Sign when needed. When you connect, ZestSSH first asks the server whether it takes the key. Only then does it ask the agent to sign, so the token asks for a touch only for a key the server will accept. You touch the token (and enter its PIN if it has one), and ZestSSH passes the signature to the server.
The 15-second sign-in timeout stops while the agent waits for your touch. An RSA key held by an agent signs with SHA-512 or SHA-256, as the server takes. The agent can also hold ordinary RSA, ECDSA and Ed25519 keys; they work the same way.
A security key’s file (id_ed25519_sk, id_ecdsa_sk) imported on a computer, or synced from a phone, signs through the system’s agent in the same way, once the file is added to it with ssh-add.
1. Create the hardware key (once)
Section titled “1. Create the hardware key (once)”If you have no security-key credential yet, make one with OpenSSH on your computer, or on a phone (see Make a key on a security key):
# Ed25519 (needs a capable token); use -t ecdsa-sk for the widest supportssh-keygen -t ed25519-sk -O resident -O verify-requiredAdd the public key to the server’s ~/.ssh/authorized_keys as usual.
2. Load it into your agent
Section titled “2. Load it into your agent”ssh-add # loads keys, including sk- keys, into the running agentssh-add -L # shows that the sk- key is thereOn Windows, the OpenSSH Authentication Agent service must be running for the system agent.
3. Add the agent key in ZestSSH
Section titled “3. Add the agent key in ZestSSH”- Open Keys in the sidebar.
- Choose New key, then Connect via ssh-agent. (On the SSH agent line of the list, What is this? explains the agent and has the same button.)
- At the top of the dialog, choose whose agent: System agent, 1Password or Bitwarden.
- ZestSSH looks for the agent and shows what it found:
- OpenSSH client is not installed: on Windows, Open settings opens Windows Settings at Optional features, where you add OpenSSH Client; on macOS and Linux the dialog names the package to install.
- ssh-agent is installed but stopped: on Windows, Start agent turns on the OpenSSH Authentication Agent service (Windows asks for permission once). On macOS and Linux the dialog says how to start it from your shell’s startup file.
- Agent is running, no keys loaded: Add a key… loads a private key file into the agent.
- Otherwise, the keys the agent holds.
- Select the keys and choose Add key (or Add n keys). Refresh reads the agent again.
- Open the host and pick the new key in its Key field. The key is listed under SSH agent on the Keys page.
4. Connect
Section titled “4. Connect”Connect as usual. When the server takes the key, touch your token.
1Password and Bitwarden
Section titled “1Password and Bitwarden”- Turn on the SSH agent in the 1Password or Bitwarden app and unlock it. If ZestSSH gets no answer, it says so and asks you to turn the agent on, unlock the app, and choose Refresh.
- On Windows, 1Password and Bitwarden answer on the OpenSSH pipe themselves, so the Windows OpenSSH Authentication Agent service must be off while you use them.
- KeePassXC adds its keys to the system’s agent: choose System agent for those.
Allow unattended runs
Section titled “Allow unattended runs”An agent key has the Allow unattended runs switch like any other key. With it on, scheduled tasks and other automation that run with nobody there ask the agent to sign; the private key still never leaves the agent.
Common mistakes
Section titled “Common mistakes”- Moving the security key away too soon (phone). Hold it flat against the phone until the sheet closes. A thick case, or one with metal or a magnet in it, can get in the way. On Android, plugging the key in avoids it (ZS-1702).
- NFC is off (Android). ZestSSH says “NFC is off. Turn it on in the phone’s settings and try again.”
- Another security key (phone). A key works only with the security key it was made on, and not after that security key is reset (ZS-1703). Something held to the phone that is no FIDO security key at all (a bank card, for example) gives “That is not a FIDO security key.”
- No touch in time (phone). A plugged-in key that blinks waits for your touch: “The security key was not touched in time. Try again.”
- No PIN on the security key (phone). A key made with Ask for the security key’s PIN every time needs a PIN set on the security key: “This needs the security key’s PIN, and the security key has no PIN set. Set one with the key maker’s app, then try again.”
- Ed25519 on an older security key (phone). “This security key cannot make an Ed25519 key. Choose ECDSA P-256.”
- USB access refused (Android). If you say no when Android asks whether ZestSSH may use the plugged-in key, ZestSSH says “ZestSSH was not allowed to use the security key.”
- An iPad, or a USB key on an iPhone. Neither can reach a security key yet (ZS-1706). Use an iPhone with an NFC key, an Android device, or a computer.
- The agent is not running or is empty (computer). ZestSSH only sees keys the agent holds. Run
ssh-add(on Windows, check that the OpenSSH Authentication Agent service is started), or use Add a key…. $SSH_AUTH_SOCKis not set. On macOS and Linux, the system agent is found through this variable. Start ZestSSH from an environment where it is set.- Insecure socket permissions. ZestSSH refuses an agent socket that others can write to. Fix the permissions (for example
chmod 600on the socket) rather than working around the check. - The key left the agent. If the agent no longer holds the key, the connection stops with: “The key of this sign-in is not in the SSH agent any more. Load it into the agent again, or plug in the hardware key it is on, and connect again.” Nothing else is tried in its place.
- No touch. If the token was not touched or is locked, ZestSSH says the agent or hardware key did not sign, and tries nothing else in its place.
- Confusing this with agent forwarding. Signing in with an agent key (this page) is not the same as forwarding an agent to a remote host. See SSH agent forwarding.
Give a vault key to the agent
Section titled “Give a vault key to the agent”The other way round, Add to agent on the Keys page gives one of your vault’s keys to this computer’s SSH agent for a time, so other tools can use it. See Add a key to the SSH agent.
Security keys and agent keys work on every plan, Free included. See Plans and limits.
Q: Can I use my YubiKey with ZestSSH?
A: Yes. On an Android phone, hold it to the phone (NFC) or plug it in (USB-C); on an iPhone, hold an NFC YubiKey near the top of the phone. On a computer, load its sk- key into your SSH agent, add it on the Keys page with Connect via ssh-agent, and touch the token when you connect.
Q: Does ZestSSH talk to the security key directly? A: On a phone, yes, from 4.0: over NFC, or USB-C on Android. On a computer, no: it goes through an SSH agent, which handles the token. Either way the private key stays on the hardware, off your disk and out of the app.
Q: Is the key file of a security key’s key a secret?
A: No. It holds only the handle the security key knows the key by and the public key. Without the security key itself it cannot sign anything, so it can sync, and Export private key writes it so you can load it into a computer’s SSH agent with ssh-add.
Q: Can I use a key made on my phone on my computer?
A: Yes. It syncs with personal sync, or export it on the phone with Export private key and move the file over. Then add it to the computer’s SSH agent with ssh-add (OpenSSH 8.2 or later), keep the security key plugged in, and connect. See On your computer too.
Q: Does ZestSSH keep my security key’s PIN? A: No. It is typed in the sign-in sheet, sent to the security key, and cleared. ZestSSH never saves it. It sends it a second time only within the same sign-in, when the security key moved away before it answered and its count of tries shows the first send was not counted (see The PIN).
Q: Why not on my iPad? A: iPadOS gives apps no NFC reader, and iOS gives an app no way to talk to a USB security key. Both are needed for an iPad; until then, use a computer or a phone.
Q: Can I use the SSH keys in 1Password or Bitwarden? A: Yes, on a computer. Choose 1Password or Bitwarden in the Connect via ssh-agent dialog.
Q: Do resident (discoverable) and non-resident keys both work?
A: Both work. On a phone, ZestSSH needs the key’s file, also for a resident key. On a computer, a resident key can be loaded with ssh-add -K.
Q: Can a FIDO2 certificate be used?
A: Not yet. ZestSSH reads sk-*-cert-v01@openssh.com certificates, but a security key’s key signs in without a certificate.
Next steps
Section titled “Next steps”- SSH agent forwarding: forward an agent to further hosts (a different feature).
- OpenSSH certificates: certificate-based sign-in.
- Public key authentication: generate and import software keys.
- SSH connections: the connection protocol and its sign-in methods.