Live data from Hacker News

Native Secure Enclave backed SSH keys on macOS

gist.github.com

81–90 of 204 posts

Re: Native Secure Enclave backed SSH keys on macOS

#81
post #46

Earlier quoted context omitted.

You can use more than one key you know. Keep the private key you actively use in the secure enclave. The system you actively use is most at risk. Keep a secondary offline private key as backup. You can generate and store it in a secure location, and never move it around. Airgapped even if you want. You could even use a yubikey or other hardware for the secondary key giving you two hard to export keys. Distribute pub…

Yeah but if you get a new device, you have to go add its pubkey to every server you ever use. I wish there were an easier way, otherwise it's understandable that people copy privkeys.

There is an easier way: Create a SSH CA, add that to your authorized_keys everywhere, use it to sign the individual public keys.

Re: Native Secure Enclave backed SSH keys on macOS

#82
post #13

If I understand correctly, this means you can't back up the private key, correct? It's in the Secure Enclave, so if you lose your laptop, you also lose the key? Since it looks like export only really exports the public key not the private one? Probably not the worst thing, you most likely have another way to get into the remote machine, or an admin who can reset you, but still feels like a hole. Or am I missing somet…

Yes, that's the point, indeed. One key per device, impossible to extract, so you need to break into the device to use the key.

If you want to maintain backup access, you can use an SSH CA to sign your public SSH keys, then keep the private keys on your device. If you keep the CA keys safe (i.e. physically safe on a flash drive), this means you can even add new keys after you lose all your devices.

This way, you only need to trust your one CA on your servers (so you don't need to copy 20 public keys around for every server).

Plus, if you're setting up a (separate) SSH CA, you can also sign servers' host keys, so you don't need to rely on TOFU to prevent MITM attacks, if that's something you care about.

Re: Native Secure Enclave backed SSH keys on macOS

#83
post #59

Earlier quoted context omitted.

Yeah, that is why you should not [always (depends on your use case)] generate it on a YubiKey. You need to have: - an offline master private key backup (air-gapped) - primary YubiKey (daily use) - backup YubiKey (locked away) - revocation certificate (separate storage) (it is your kill-switch) Having a second YubiKey enrolled is the standard practice. What people do wrong is: - They generate directly on YubiKey - The…

You are talking about GPG keys. The featured article only refers to SSH keys. Know the difference.

I know the difference, thank you for your concern.

Re: Native Secure Enclave backed SSH keys on macOS

#84

Does anybody know why 'p-384-ne' (instead of 'p-256-ne') cannot be used? Key can be generated, but 'ssh-keygen -w /usr/lib/ssh-keychain.dylib -K -N ""' cannot find the key to export.

I think this is an openssh limitation.

openssh only supports sk-ecdsa-sha2-nistp256 and sk-ed25519 security keys iirc

Re: Native Secure Enclave backed SSH keys on macOS

#86

Does the hardware only support the NIST curves? Or is that just the example that happens to be given?

Only supports NIST curves and ECDSA yes.

I've heard people make the point before that EdDSA is not great for secure enclaves due to being suspictable to Fault Attacks which could lead to (partial) key extraction

Re: Native Secure Enclave backed SSH keys on macOS

#87

Does anybody know if there is something similar for gpg keys? E.g. for commit signing? That is, natively with the Secure Enclave, not exportable.

Some Fido2 keys like the YubiKey and Nitrokeys support PGP keys as well. Works pretty nice as well and has the added bonus of your key not being tied to a pice of hardware that is as likely to break like a laptop (or be upgraded on a semi-regular basis)

Re: Native Secure Enclave backed SSH keys on macOS

#88
post #17

Earlier quoted context omitted.

Inability to export the private key is no different from using an YubiKey? You can't "backup" the private key they generate either.

Yeah, that is why you should not [always (depends on your use case)] generate it on a YubiKey. You need to have: - an offline master private key backup (air-gapped) - primary YubiKey (daily use) - backup YubiKey (locked away) - revocation certificate (separate storage) (it is your kill-switch) Having a second YubiKey enrolled is the standard practice. What people do wrong is: - They generate directly on YubiKey - The…

Do you have a good guide/video/write up on this?

I’ve been putting off remaking my GPG and SSH keys using a Yubikey.

Re: Native Secure Enclave backed SSH keys on macOS

#89
post #34
post #31

Earlier quoted context omitted.

You're not really supposed to 'export' keys. Any time you move a key you risk exposing it. The idea of PKI is that only public keys move, the private key stays in one place, ideally never seen.

I've been in the security space for 25 years, and understand the theory of PKI. But I've also been in the ops space for 30 years, and understand that if you don't balance security theory with operational practice, critical business functions can fail. Ideally yes, the private key is never seen. In reality, it needs to be backed up in a secure place so it can be restored in the event of a failure.

I think you are mixing up concerns. You need a backup key. That doesn't mean you need to backup your key.

Anything (everything?) using SSH authentication supports multiple authentication keys. Have a yubikey in a locked deposit box or something.

Re: Native Secure Enclave backed SSH keys on macOS

#90

Earlier quoted context omitted.

Yeah but if you get a new device, you have to go add its pubkey to every server you ever use. I wish there were an easier way, otherwise it's understandable that people copy privkeys.

There is an easier way: Create a SSH CA, add that to your authorized_keys everywhere, use it to sign the individual public keys.

Yep that's what I do! I have two ssh-ca's stored on two Yubikeys. And both are trusted by my servers.

If I lose one I can still sign new certs with the other.

https://github.com/arianvp/nixos-stuff/blob/master/modules/s...

Post reply on HN