11 ms·
Secretive – macOS native app to store SSH keys in the Secure Enclave
- philistine 6y agoDoes this mean that the Secure Enclave is accessible by the user? If so, it prompts so many questions. How much disk space is available on the Enclave, for example.
- lunixbochs 6y agoYou don’t actually need to store Secure Enclave protected data in the enclave. Can “wrap” it with the enclave’s key and store it on your own disk.
- GekkePrutser 6y agoThis is not what it does though. It says the private key can't be exported, and this wouldn't be the case if it was just a regular SSH keyfile encrypted using the Enclave's key.
- acdha 6y agoYou can ask the Secure Enclave or a smart card to perform operations using a key pair which is generated on and never leaves the device. In the case of SSH, you can use that directly as long as your SSH client and server support that algorithm: the client advertises the key fingerprint and just passes the server’s challenge through without modification. Apple has had native support built-in for using PIV/CAC tokens for years. For storing arbitrary sized things, you’d typically use that key pair to sign an AES key used to encrypt the actual file so your device only needs to store the comparatively small keys.
- dchest 6y agoUnwrapping it puts the private key into memory, from which it can be extracted (it’s hard, of course, but looking at the state of Intel security, everything is possible). Secure Enclave is supposed to sign with non-extractable private key without putting it into RAM.
- bdcravens 6y agoTotally a tangent, but it's interesting that we still refer to things as "disk space" even in the era of flash storage
- philistine 6y agoI know! But I wanted to write something very clear, and I chose the clearest word in my mind to convey my idea. That word is steeped in old tech, it so happens. Oh and by the way, I was shopping for a cheap laptop for a non-profit this week, and I still had to be careful to pick a laptop with an SSD. Those spinning horrors are still jammed into laptop cases to this day.
- epistasis 6y agoI wonder what a better term for disk storage would be. Block storage, in the way that cloud services refer to it? Just plain "storage"?
- jbverschoor 6y agoNon Volatile Memory Volatile Memory gets “erased” when powered off
- epistasis 6y agoAccurate, and in usage in technical circles already. But I've always found it awkward, and names based on what something is not are always unsettling to me.
- jbverschoor 6y agoThen just Memory. That’s what elderly and nontechies usually call it. And it’s correct. Even more correct with always-on-computing and automatic state saving
- saagarjha 6y agoWait until people confuse that with NVRAM.
- techslave 6y agothanks for not saying ‘begs’. no, the secure enclave is not available to the user as such. a few crypto primitives are exported. that’s what this uses. there have been any number of such “agents” over the last few years.
- morpheuskafka 6y agoThere is an API to store custom keys in the Secure Enclave. It only supports 256-bit ECC keys and the private keys cannot be read or written, only operated on by the Enclave itself. There is no official storage limit, it seems, but one Stack Overflow answer put the number at around 400. Interestingly, there appears to be no quota system for preventing one app from using them all.
- almostdigital 6y agoNot sure about how much is actually available but you can generate about 1000 keypairs before it starts to throw errors at you
- AlexCoventry 6y agoIs a similar service available for yubikeys connected to linux machines?
- vladvasiliu 6y agoThere is: https://www.esev.com/blog/post/2015-01-pgp-ssh-key-on-yubikey-neo/ https://www.esev.com/blog/post/2015-01-pgp-ssh-key-on-yubike... https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PKCS11.html https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PK... The yubikey (at least some models) can work as a smartcard.
- AlexCoventry 6y agoThanks.
- g_p 6y agoYes - as the other commenter mentioned there are some docs from Yubico. Also worth looking at PKCS11, as this lets you do HTTPS clent certificate authentication, as well as SSH. And it's all standardised too under the PKCS11 standard, which is nice for portability or diversity of token providers.
- Metus 6y agoFor anyone not aware, you can use macOS's keychain to store ssh key passwords and have them unlock at login. This way you can have the benefits and convenience of password managers in the command line for SSH certificates. https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically https://apple.stackexchange.com/questions/48502/how-can-i-pe...
- mfontani 6y agoDoes it have touch to authorise (doesn't seem to support that), or is it just going to send on all of one's currently-loaded SSH keys whenever one connects with -A (seems to)? > You can configure your key so that they require Touch ID (or Watch) authentication before they're accessed. That, to me, would be a key thing to want to have: something that tells me "hey, Terminal just wanted to access your Github key. Is that okay?" If I'm git pushing, that's fine. If I just connected to a random server... that's not okay. What is that trying to do? Deny.
- Metus 6y agoAfter researching this for a while, it seems there is no documented, native option to do this. The only option is to unlock all SSH keys all the time, which makes them less secure than the passwords for websites managed by the exact same keychain. Which, in my opinion, is weird. Do they employees at Apple use a different system altogether? Because the built-in one doesn't seem very secure. Or maybe I am using it wrong, who knows. In a similar vein, is there an exhaustive manual for macOS? It bugs me that Apple machines cost a small fortune, the OS is full of nifty features, but there is no non-superficial manual shipped with it.
- paxswill 6y agoIn regards to the ssh-agent stuff (and a lot of the other CLI tricks), the man pages usually document them. They may lag a bit for new features, but most of them will have a man page. Barring that they’ll usually print a help message. One command off the top of my head that doesn’t really follow this is the undocumented/internal `airport` command. In that case it has two different help messages depending on how it’s called, and is also tucked away in a framework as well.
- pqdbr 6y agoFrom the FAQ: > Q: How do I import my current SSH keys, or export my Secretive Keys? > A: The secure enclave doesn't allow import or export of private keys. For any new computer, you should just create a new set of keys. If you're using a smart card, you might be able to export your private key from the vendor's software. I don't get it. If so, how am I supposed to back up my keys in case of a hardware failure or hardware theft?
- Metus 6y agoYou aren't. It is the same with Yubikeys, if you use them. You are supposed to generate a certificate per user and device they are using for authentication, which is not a big deal at least for remote login on servers, as you can set an arbitrary number of valid SSH keys.
- corty 6y agoYou are supposed, yes, but it is not necessary with Yubikeys. You can still import private keys into your Yubikey. At work we are using this for group access to some appliances that annoyingly limit the number of SSH authorized keys you can teach them.
- namibj 6y agoAlso, there are arguments against generating RSA keys with closed-source software (don't tell me that's all pure hardware in a smartcard). For one, generating keys that are vulnerable to something exotic is very much a viable threat, and yubikeys in particular had an issue where some accidentally created very weak keys. Sure, you need to make sure the key doesn't leak on it's way, but that's not really the issue.
- Xylakant 6y ago> and yubikeys in particular had an issue where some accidentally created very weak keys. So did Debian between 2006 and 2008 https://certlogik.com/debian-weak-key-check/ https://certlogik.com/debian-weak-key-check/
- walterbell 6y agoCould this be possible on iOS devices, which also have a secure enclave?
- alibert 6y agoYou could check https://krypt.co https://krypt.co (not affiliated)
- walterbell 6y agoThanks, that reminded me of upcoming iOS 14 support for WebAuth/FIDO. Perhaps that can be extended to SSH auth.
- danieldk 6y agoDo you mean with Face ID? Since WebAuth/FIDO already work with iOS 13. I have been using U2F with my YubiKey (whichever one has NFC).
- vladvasiliu 6y agoNot quite. The point is to use just the iPhone as the authenticator, without an external token. See announcement here: https://developer.apple.com/documentation/safari-release-notes/safari-14-beta-release-notes https://developer.apple.com/documentation/safari-release-not... I think it was posted on HN a few days ago, but I can't find it right now.
- m0dest 6y agoNote that they were bought by Akamai last year. I wouldn't count on the Krypton apps staying around, at least not in their current incarnation. A fork could survive, though.
- sirn 6y agoTermius[1] already has this feature available in iOS 13. [1]: https://www.termius.com/ https://www.termius.com/
- justincormack 6y agoI have been using sekey for this for a while. Its pretty nice, I mean you do need to auth quite a bit if you use git clone over ssh a lot, but it does mean you know when keys are used.
- metafunctor 6y agoYep, it’s so much better than just key files: keeps key material in a secure system (Secure Enclave), you know when a key is used (standard macOS security prompt), and requires a physical interaction (Touch ID) to use a key.
- threentaway 6y agoSo, a non-portable YubiKey?
- kitsunesoba 6y agoMore like a built-in YubiKey. It's a convenience. When using one's MacBook, you don't need to pull your YubiKey out of your bag/drawer/etc to authenticate, and if you're traveling you can just leave YubiKey at home/the office, giving you one less thing to lose.
- g_p 6y agoFor anyone interested in a standardised/Linux-compatible version of this, check out PKCS11 tokens. Smartcards can and do implement this spec, and if you use PKCS11, the secret is used from the token to sign an SSH login (for example), without being revealed. This means the secret itself stays on the card. You can combine this with certificates if needed; the smartcard handles the authentication. Using PKCS11 tokens is supported in recent openssh versions. You can also use them for client certificate authentication in web browsers. For anyone familiar with DoD CACs, this is similar - I believe they use a particular card with a proprietary PKCS11 driver, but you can use opensc with any card running a PKCS11 applet. Some refs: https://zerowidthjoiner.net/2019/01/12/using-ssh-public-key-authentication-with-a-smart-card https://zerowidthjoiner.net/2019/01/12/using-ssh-public-key-... https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PKCS11.html https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PK...
- foolmeonce 6y agoThis works ok and is the best option at the moment, but as more systems upgrade to newer versions I think the Fido/U2F support is probably going to take over. It's nice to not have anything key specific, any initialization steps, and so on.
- tialaramex 6y agoEdit: Maybe OpenSSH does offer resident keys. On the one hand their release notes say they do but on the other hand I was 100% sure somebody who should know insisted they didn't. A trawl of my records cannot find such a communication so perhaps I dreamt it. If resident keys are an option then you need to make sure to buy FIDO2 authenticators and to explicitly tell OpenSSH you want resident keys. The current SSH FIDO behaviour doesn't do resident keys AFAIK. The OpenSSH team has discussed it, but not as I understand it written an implementation. In a PIV setup Jim, Sarah and Gary can each have a device (say a Yubikey) with their own private key inside it. Both their workstations and shared desktop/ interactive servers can use these keys, when they're plugged in. So when Jim is sat at this workstation, Jim's key uses Jim's private key to authenticate Jim over SSH. If Sarah wants to use a machine she's never previously used, but it was set up for Jim and Gary, her key, Sarah's key, just works to authenticate as Sarah over SSH. Simple and easy to think about. With FIDO non-resident keys a similar team Beth, Larry and Zoe have personal FIDO authenticators, let's say from Titan, they each set up their personal laptop to require their personal FIDO authenticator. Both elements are needed to authenticate. Beth's laptop, plus Beth's Titan key is enough to authenticate via SSH. But if Beth is at a Workstation she's never used before she can't use her Titan key to authenticate, it has no idea how to help on its own. If Beth sets that workstation up (a multi-step process) this isn't re-usable, Zoe can't use her Titan key without also going through that enrolment process. The reason why is a mixture of differences between typical Web authentication journeys and SSH, and the deliberate (privacy preserving) feature paucity of FIDO Security Keys when used without resident keys. The FIDO authenticator genuinely has no idea what your private key is (this is unlike for resident keys like Apple's recent announcement). It first needs to be presented with an ID, a large random-looking byte string. It has in fact encrypted your private key using AEAD mode with a secret symmetric key that's baked inside it and then used that as the ID. So when the ID comes back it decrypts it, the AEAD checks out, it now has a private key and can use that to authenticate you before it forgets it again. On the Web in this case (again not the resident case like Apple's cool Safari feature) the ID is being delivered by a remote server to your web browser when you enter a username and the browser passes it to the FIDO authenticator. But in SSH authentication doesn't work that way. So, OpenSSH stores the ID locally on a computer. It isn't secret, so it's not a huge deal if someone somehow steals it. But without that ID the authenticator can't do its job. Maybe you could arrange to synchronise the IDs across machines in an organisation. But AFAIK nothing exists to sort that out today. So without either resident credentials (which need a more expensive FIDO2 authenticator) or some further synchronisation framework PIV is easier today if you want employees to authenticate from machines that aren't "their" personal machine.
- fehyjn 6y agoIs is possible to recreate this using Windows Hello and TPM?
- muststopmyths 6y agohmm, interesting question. should be. Windows Hello generates RSA keypairs I think. Can you just use those as SSH keys ? The OS will take care of securing them in TPM if available. If you wanted to use conventional file-based keypairs and secure the "passphrase" instead, maybe use the Hello private key to encrypt the passphrase into the credential store ? I am not up-to-date on whether there's a newer more secure way to store credentials, but seems like forcing a Windows Hello action to decrypt the data in the store should be sufficient. I could be missing something though. Otherwise you'd think there'd be a solution from Microsoft already.
- vdfs 6y ago> Auditable Build Process > Builds are produced by GitHub Actions with an auditable build and release generation process. Each build has a "Document SHAs" step, which will output SHA checksums for the build produced by the GitHub Action, so you can verify that the source code for a given build corresponds to any given release What will stop an attacker from hard coding code source file hashes? I'm not saying they will, just that it's a bad method of making binaries auditable
- gruez 6y agoNothing. The point is that you can replicate the same steps on your local machine and the hashes should be the same. If they're not it means either github actions and/or the repo owner has been compromised.
- krrrh 6y agoA similar product that works on macs without a secure enclave by storing keys on the secure enclave of your iPhone is krypton. https://krypt.co/developers/ https://krypt.co/developers/
- cynix 6y agoBeen using this since the beginning and it’s great. However, there has been no updates ever since they were acquired by Akamai. A bit worried it’ll suddenly stop working one day...
- judge2020 6y agoThankfully (i believe) everything that goes into it is open source https://github.com/kryptco https://github.com/kryptco
- hanche 6y agoThe github repo seems to be updated only to version 2.5.6 (according to commit message) or 2.5.7 (according to a tag), whereas the latest version on the app store is 2.6.0. But also, the LICENSE file simply says “All Rights Reserved”.
- cynix 6y agoThe code may be open source, but not everyone can compile and install the iOS app easily, or have the required infrastructure that allows the push notification to happen.
- hanche 6y agoOuch! I am a happy user too. But Akamai is all about the enterprise, it seems, and most likely don't care about us common folks. We can only hope that they will allow the former kryptco developers to spend time maintaining it, if it becomes necessary.
- 1anna69 6y agoHello guys my hot photos are here .. http://vivy.us/isxxx http://vivy.us/isxxx username annaxx))
- djoshea 6y agoDoes anyone know of a way to guard rclone passwords that would be stored in rclone.conf? Is it possible to leverage the keychain or this tool for this? Typically passwords for sftp logins are stored with a reversible hash (see `rclone reveal`), which isn't ideal.
- old-gregg 6y agoFor the love of God, please stop using SSH keys. Almost every "company X is hacked" title on HN can be traced to leaked SSH credentials. Use auto-expiring certificates that are issued after a proper SSO+2FA flow: https://gravitational.com/blog/how-to-ssh-properly/ https://gravitational.com/blog/how-to-ssh-properly/
- resfirestar 6y ago> Almost every "company X is hacked" title on HN can be traced to leaked SSH credentials. I don’t think that’s anywhere close to true but I’d be interested if you have reason to believe it is or some examples. Or maybe it’s intentional hyperbole?
- kortilla 6y agoIntentional hyperbole to sling blog spam. That link is to a site the OP claims in profile.
- ikiris 6y agoMost of the time, you're lucky to get people to move off of passwords
- jeffbee 6y agoNice to see this going mainstream after only checks almanac ... a quarter-century of standards and practices.
- john_alan 6y agoCool but the enclave only supports the secp256r1 curve, whose coefficients are NSA chosen.
- ashildr 6y agoWhile I don‘t think that this is relevant for my personal thread scenarios, I think that this is unfortunate at least and Apple should change it with new hardware.
- john_alan 6y agoYa problem is it’s all NIST “approved” and US companies love that because it means the government is happy to use their products.
- miguelmota 6y agoI've been using a YubiKey device for SSH using yubikey-agent [0] and it's been great since it’s not possible to extract keys from hardware keys and the device is carried with me. The agent is also integrated with pinentry so it requires a pin code for the session. [0] https://github.com/FiloSottile/yubikey-agent https://github.com/FiloSottile/yubikey-agent
- StavrosK 6y agoYou don't even need the agent with the latest SSH versions, SSH can now use U2F natively, which is wonderful.
- miguelmota 6y agoOh cool didn't not know that. That’s awesome.
- rcarmo 6y agoThis is the sort of thing I would have expected Apple to do back when they didn’t care about macOS at all. Or that they should do now that they are refactoring it.
- christopherbalz 6y agoSo, macOS keychain simply doesn't have the ability to store in secure enclave?