logoalt Hacker News

LeBit • today at 6:32 AM • 5 replies • view on HN

The article starts on an incorrect premise.

The author says he doesn’t like the idea of having keys sitting on his file system ready to be snatched by bad actors.

That’s why they should be passphrase protected.

You use ssh agent to store the keys in memory and for convenience you can store the passphrases in keychain. MacOS OpenSSH has the UseKeychain config directive for that.

I use Yubikey/FIDO2 myself, but not because private keys cannot be protected on a file system.


Replies

Gigachad • today at 6:41 AM

Secure Enclave is still more secure in that it should be impossible to access the private key. Password protected keys are still vulnerable to malware that can read the keyboard, trick you in to typing the password, or that have exploits in macOS to read the memory.

Jakob • today at 6:47 AM

Isn’t the macOS keychain user-readable by default?

Assuming the attacker has user rights (which it needs to read the key) it could also read the passphrase, right?

Update: I tried it out and stand corrected. ssh-add doesn’t store it in the user-readable keychain. So the passphrase is protected. (And also not recoverable by the user).

tiberious726 • today at 10:41 AM

Key on disk plus a passphrase is still only 1FA. Key in the SE + an unseal PIN is 2FA. There's already plenty written about why one is better better than the other.

mjg59 • today at 7:36 AM

Do you type your passphrase every time you log into a remote machine? If not, the private key is in RAM and can be extracted by malware and stolen. If so, that's way more annoying than using touchid or some other physical proof of presence.

➕ show 1 reply
chicagobuss • today at 6:34 AM

was wondering the exact same thing. dude never heard of passphrases?