nmattia's macOS Touch ID SSH guide spreads, sparks key-backup debate
A blog post showing how to turn a Mac's Secure Enclave into a non-exportable SSH key spread from Lobsters to Hacker News and Reddit.
What to know
- The guide shows a three-command way to create a non-exportable SSH identity in a Mac's Secure Enclave, authenticated via Touch ID, usable for git/GitHub.
- The post spread from Lobsters to Hacker News and Reddit within a day, with author nmattia personally answering technical questions throughout.
- Commenters debated the tradeoff at the core of the design: keys that can never be stolen also can never be exported or backed up, pushing some toward Yubikeys, 1Password, or SSH certificate authorities instead.
The dispute Whether Secure Enclave keys' total non-exportability is a security feature to embrace or a practical deal-breaker next to synced alternatives like 1Password. · positions read across 39 posts and comments
This is a welcome discovery that native macOS tooling can replace third-party SSH-agent apps like Secretive or 1Password.
-
“Cool! I personally use Secretive for this but I had no idea you could do it all with OS-provided tooling.”
eta · Lobsters ↗
The inability to export or back up Secure Enclave keys is a real drawback, especially compared to synced solutions like 1Password or recoverable Yubikey setups.
-
“I like the concept, but not being able to export the keys is an unfortunate deal breaker for me.”
DemonWav · Reddit ↗
Practical configuration tips (per-host IdentityAgent, SSH_SK_PROVIDER, SSH certificate authorities) make the setup more workable in real multi-machine environments.
-
“To make it a bit less tedious adding back the key after a reboot I export `SSH_SK_PROVIDER=/usr/lib/ssh-keychain.dylib` so that I only need to type `ssh-add -K`”
msangi · Lobsters ↗
nmattia Blog author / developerarianvp Prior researcher cited in the postApple Maker of macOS Secure Enclave / Touch ID
The record 2 articles and posts · last 30 days
What people are saying 24 voices from 3 sites · best of 39 · verbatim
- Does this setup require Touch ID authentication every single time the key is used, or does the system remember authorization for a period?
- Can the same in-enclave private key be used for GPG commit signing in Git, not just SSH?
- Oct 21
-
You can also use a password manager like 1Password [1] to store your private keys, and use a local socket for your SSH agent to automatically unlock using TouchID.[1]
-
If I knew it's relatively easy I would have saved $$ on yubikey - for personal projects security requirements are not high but it's good to have something better than a file which could be stolen by malware. Kudos to author for the how-to.
-
You aren't supposed to be moving SSH keys. They should stay on the machine they were generated on. The less accessible they are the better.I really wouldn't rely on an SSH key as the sole way of accessing a machine.
-
I very much prefer to have one key per device! That allows for fine grained access control. In general I wouldn’t export private keys unless really necessary.
-
Just in case it helps someone, a while ago I wrote a blog post with exact CLI invocations to set up a local-password-store protected by TouchID. If you wish, the encrypted password-store can be backed up and tracked with a Git.> PasswordStore (`pass`) + GnuPG (`gpg`) + TouchID>
-
That was my first thought, too — this might work as one of additional methods of logging in, but not as the only one.I have been using YubiKeys for many years now, following this guide: https://github.com/drduh/YubiKey-GuideThis means I can have secure private keys for ssh and gpg (cue the crowd saying gpg is insecure without offering good modern…
-
Yes I don't see how that's helpful.It's quite opposite of what I'd want.If you use a trezor hardware wallet (and probably other hardware wallets) you can deterministically regenerate -sk keys.I use trezors various agents for AGE, FIDO2/passkey, ssh[0].But you still need the backup some bits of material like stubs for some FIDO keys (not secret…
-
Crazy that this particular feature we’ve all been waiting for hasn’t received first-party support by any DevEx company.You know, the companies that say security is their number one priority, or companies that scream “developers, developers, developers”. How Google and Apple didn’t come up with something together eludes me, but then again, we have…
-
As cool as this is, this does limit the functionality of your keys, because not everything can access the secure enclave in the way it wants to - and as others point out, this is a one-way street and locks your mac hardware into the flow.I went with this system for some months but it ultimately broke my workflow. I switched to a system of my own…
-
> No key files (like ~/.ssh/id_ed25519.pub and friends) littering the file system; and there’s no risk of mistakenly deleting them either.Or backing them up, or copying them to your new computer. You're just one spilled coffee cup away from losing the key.
-
If you do this, have at least one backup key (if need be on paper) or a guaranteed alternate path into the hosts you depend on this key to access. Because if the secure enclave is as good as we're told, if you lose access to ->THIS<- secure enclave, its game over for the keys.Secure enclave protecting Keychain, the keychain is backed up. Not the…
- Oct 20
-
I like the concept, but not being able to export the keys is an unfortunate deal breaker for me.
-
"set up a CA" is really simple. ```console ssh-keygen -t ed25519 -f certificate_authority -C "User Certificate Authority" ``` copy to server and add this to your sshd_config: ``` TrustedUserCAKeys /etc/ssh/certificate_authority.pub ``` Then you sign your ssh public key: ```console ssh-keygen -s certificate_authority -I $(uuidgen) -z '0001' -n…
-
I ran into a similar question a while ago when trying to do something similar using a Yubikey as an SSH key. The procedure used in the blog post here generates the key in-enclave, which is the most secure from a privacy perspective (if it has never left the secure enclave it can't be intercepted) but not the most secure from an availability…
-
Thanks for writing this, I will have to try it out. I only skimmed the article because I'm not familiar with a lot of the secure enclave/Apple-specific stuff, but I have a question: Does this setup require biometric authentication every time the key is used, or does the system "remember" your authorization for some length of time? When I use…
-
Copying private keys away from the machine they were generated on is generally to be avoided. You could accidentally leave them somewhere you don't mean to (temp directory, thumb drive), or someone could steal/pwn one of your machines. SSH certificates are the solution you're looking for. You can set up a CA and then sign both host and user public…
-
Not exactly true, you can set IdentityAgent per host or hosts by using match blocks in your ssh configuration file.
-
1P can be used to generate or save existing ssh keys. The app knows that the type of secret is an ssh key. There's a background agent that needs to be enabled. At that point you just configure the IdentityAgent socket: ``` IdentityAgent "~/Library/Group Containers/ABC.com.1password/t/agent.sock" ``` Then the SSH agent will trigger a touchID…
-
Yep, that's a good idea! You can also set it in the ~/.ssh/config: https://gist.github.com/arianvp/5f59f1783e3eaf1a2d4cd8e952bb4acf#using-the-securitykeyprovider-by-default I added it explicitly in the post because I'm a big fan of less hardcoded configuration, and so that it can be enabled/disabled explicitly (you may not always want to use…
-
To make it a bit less tedious adding back the key after a reboot I export `SSH_SK_PROVIDER=/usr/lib/ssh-keychain.dylib` so that I only need to type `ssh-add -K`
-
Git can use an SSH key for its signing, so yes it can add long as you’re not tied to explicitly GPG keys.
-
It's recent that macOS ships with all the tools to do this natively. I prefer to avoid relying on 3rd party tools but I read some good things about Secretive while researching this!
-
Cool! I personally use [Secretive](https://secretive.dev/) for this but I had no idea you could do it all with OS-provided tooling.
-
Post author here. This was the result of a lot of experimentation; if there are experts that want to chime in, I'd love to hear your thoughts!