FiloSottile/yubikey-agent — a security tool — sits at 2.9k GitHub stars in the Security space. yubikey-agent is a seamless ssh-agent for YubiKeys.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
yubikey-agent is a seamless ssh-agent for YubiKeys.
Easy to use. A one-command setup, one environment variable, and it just runs in the background.
Indestructible. Tolerates unplugging, sleep, and suspend. Never needs restarting.
Compatible. Provides a public key that works with all services and servers.
Secure. The key is generated on the YubiKey and can't be extracted. Every session requires the PIN, every login requires a touch. Setup takes care of PUK and management key.
Written in pure Go, it's based on github.com/go-piv/piv-go and golang.org/x/crypto/ssh.
Installation
macOS
brew install yubikey-agent
brew services start yubikey-agent
yubikey-agent -setup # generate a new key on the YubiKey
Then add the following line to your ~/.zshrc and restart the shell.
To use yubikey-agent for all hosts but one, you'd add the following lines instead. In both cases, you can keep using ssh-add to interact with the main ssh-agent.
yubikey-agent takes a persistent transaction so the YubiKey will cache the PIN after first use. Unfortunately, this makes the YubiKey PIV and PGP applets unavailable to any other applications, like gpg-agent and Yubikey Manager. Our upstream is investigating solutions to this annoyance.
If you need yubikey-agent to release its lock on the YubiKey, send it a hangup signal or use ssh-add's "delete all identities" flag. Likewise, you might have to kill gpg-agent after use for it to release its own lock.
ssh-add -D
This does not affect the FIDO2 functionality.
Changing PIN and PUK
Use YubiKey Manager to change the PIN and PUK.
yubikey-agent -setup sets the PUK to the same value as the PIN.
If the wrong PIN is entered incorrectly three times in a row, YubiKey Manager can be used to unlock it.
yubikey-agent -setup sets the PUK to the same value as the PIN.
ykman piv access unblock-pin
If the PUK is also entered incorrectly three times, the key is permanently irrecoverable. The YubiKey PIV applet can be reset with yubikey-agent --setup --really-delete-all-piv-keys.
Manual setup and technical details
yubikey-agent only officially supports YubiKeys set up with yubikey-agent -setup.
In practice, any PIV token with an RSA or ECDSA P-256 key and certificate in the Authentication slot should work, with any PIN and touch policy. Simply skip the setup step and use ssh-add -L to view the public key.
yubikey-agent -setup generates a random Management Key and stores it in PIN-protected metadata.
Alternatives
Native FIDO2
Recent versions of OpenSSH support using FIDO2 tokens directly. Since those are their own key type, they require server-side support, which has only recently reached Debian and GitHub.
FIDO2 SSH keys by default don't require a PIN, and require a private key file, acting more like a second factor. yubikey-agent keys always require PINs and can be ported to a different machine simply by plugging in the YubiKey. (With recent enough tokens such as a YubiKey 5, a similar setup can be achieved by using the verify-required and resident options, after setting a FIDO2 PIN with YubiKey Manager: the private key file will still be required, but it can be regenerated from the YubiKey.)
gpg-agent
gpg-agent can act as an ssh-agent, and it can use keys stored on the PGP applet of a YubiKey.
This requires a finicky setup process dealing with PGP keys and the gpg UX, and seems to lose track of the YubiKey and require restarting all the time. Frankly, I've also had enough of PGP and GnuPG.
ssh-agent and PKCS#11
ssh-agent can load PKCS#11 applets to interact with PIV tokens directly. There are two third-party PKCS#11 providers for YubiKeys (OpenSC and ykcs11) and one that ships with macOS (man 8 ssh-keychain).
The UX of this solution is poor: it requires calling ssh-add to load the PKCS#11 module and to unlock it with the PIN (as the agent has no way of requesting input from the client during use, a limitation that yubikey-agent handles with pinentry), and needs manual reloading every time the YubiKey is unplugged or the machine goes to sleep.
The ssh-agent that ships with macOS (which is pretty cool, as it starts on demand and is preconfigured in the environment) also has restrictions on where the .so modules can be loaded from. It can see through symlinks, so a Homebrew-installed /usr/local/lib/libykcs11.dylib won't work, while a hard copy at /usr/local/lib/libykcs11.copy.dylib will.
/usr/lib/ssh-keychain.dylib works out of the box, but only with RSA keys. Key generation is undocumented.
Secretive and SeKey
Secretive and SeKey are similar projects that use the Secure Enclave to store the private key and Touch ID for authorization. The Secure Enclave has so far a worse security track record compared to YubiKeys.
pivy-agent
pivy-agent is part of a suite of tools to work with PIV tokens. It's similar to yubikey-agent, and inspired its design.
The main difference is that it requires unlocking via ssh-add -X rather than using a graphical pinentry, and it caches the PIN in memory rather than relying on the device PIN policy. It's also written in C.
yubikey-agent also aims to provide an even smoother setup process.
How active is development on FiloSottile/yubikey-agent?
The most recent commit recorded on FiloSottile/yubikey-agent was 3.0 years ago, based on the GitHub push timestamp. The repository has 165 forks — one of the better signals of community interest.
How many stars does FiloSottile/yubikey-agent have?
FiloSottile/yubikey-agent has 2.9k GitHub stars — refresh the page for the live number, or check github.com/FiloSottile/yubikey-agent. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is FiloSottile/yubikey-agent open source?
Yes — FiloSottile/yubikey-agent ships under the BSD-3-Clause license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/FiloSottile/yubikey-agent.
What else is in the Security space?
FiloSottile/yubikey-agent is tracked by TopGit under the Security category, alongside 6 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What topics is FiloSottile/yubikey-agent associated with?
GitHub's repository topics for FiloSottile/yubikey-agent: "cryptography", "piv", "smartcard", "ssh", "ssh-agent", "yubikey". TopGit's editorial category is Security.
Where can I see FiloSottile/yubikey-agent in action?
The project maintains a homepage at https://filippo.io/yubikey-agent. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about FiloSottile/yubikey-agent?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/FiloSottile/yubikey-agent is the definitive source.
Read full README in the tab above.
Still deciding about yubikey-agent?
One click hands the question to an AI along with this page — see what it says about yubikey-agent.