News for hackers. Stuff that matters.
Re:Use TouchID to Authenticate Sudo on macOS by epistasis on Friday August 26, 2022 @03:28PM (#32611708)
Not exactly connected but the same crowd interested in this topic may also be interested in this tool to store SSH private keys in the Secure Enclave, kind of like what can be done with a YubiKey:

https://github.com/maxgoedjen/secretive

I've been looking for something like this for 3-4 years but only found it six months ago (in an HN thread). I use separate keys for every use case, and now know every time a key is used for any purpose, whether it's connecting to source control or my text editor is connecting to a remote VM.

Only thing I haven't figured out is how to do git signatures with these sorts of keys, but I haven't debugged it at all.

Re:Use TouchID to Authenticate Sudo on macOS by buildbot on Friday August 26, 2022 @07:18PM (#32613859)
I actually tried this and was glad I left myself an out - I had a kernel panic, after which the contents of the secure enclave where wiped with the rest of the system state (to restart from known good settings???). Bye-bye SSH private key. I would recommend caution if you use it.
Re:Use TouchID to Authenticate Sudo on macOS by nano9 on Friday August 26, 2022 @09:37PM (#32614704)
The same could happen with a hardware token like Yubikey, if it were to suffer from an irrecoverable software or hardware error. It's still useful, because spoofed authentication prompts will no longer get a chance at plaintext access to your password.
Re:Use TouchID to Authenticate Sudo on macOS by kitsunesoba on Friday August 26, 2022 @11:51PM (#32615458)
This is also why it's a good idea to have multiple keys instead of having everything riding on one. With a T2/M-series machine it's easy to have at least two (one in Secure Enclave, one in a USB key), and USB keys are tiny enough to hide away another one or two.
Re:Use TouchID to Authenticate Sudo on macOS by filleokus on Saturday August 27, 2022 @04:36AM (#32617045)
I've always felt that the suggestion of having two keys seems kinda cumbersome, especially for webauthn. If understand it correctly I need to enroll both keys, by physically having them present? Then I need to remember to enroll the second one whenever I sign up for something (or keep both keys with me, which kinda negates the backup perspective).

For SSH it's probably easier since I can just have both public keys accessible for adding it to new servers and keep the token somewhere safe.

My preferred solution would be to generate the private key material outside of the secure enclave (but on a offline device or something), write it down on a piece of paper and then transfer it in to the enclave/hardware device.

That way I could just restore the same private key if the physical secure enclave is destroyed.

Re:Use TouchID to Authenticate Sudo on macOS by Avamander on Saturday August 27, 2022 @08:08AM (#32618087)
> If understand it correctly I need to enroll both keys, by physically having them present?

Yes.

> Then I need to remember to enroll the second one whenever I sign up for something (or keep both keys with me, which kinda negates the backup perspective).

Alternatively you print out the backup codes.

> My preferred solution would be to generate the private key material outside of the secure enclave (but on a offline device or something), write it down on a piece of paper and then transfer it in to the enclave/hardware device.

The primary reason why we want to do hardware at all, is that to the best extent we know the key is generated by it and will remain in it. That most of the threat becomes someone in the physical world stealing it from you.

Though some more open-source webauthn tokens would allow you to do what you described. Secure key management procedures are just not something we should encourage people to do themselves, it's difficult.

Re:Use TouchID to Authenticate Sudo on macOS by filleokus on Saturday August 27, 2022 @01:54PM (#32621426)
> Alternatively you print out the backup codes.

But those are per site right?

Re hardware and that above is not something for most people:

Yeah I agree. Something like https://uni.horse/notes/solo-key-backups.html, but it shouldn’t be a solution for most people.

But I still think the backup story is flawed, and could be improved to work in a easy and secure way:

Using some easy vendor GUI tool, with a simple clone button:

1: Generate on-hardware webauthn master key on device A. 2: Generate on-hardware key-par on device B 3: Export B’s public key to A 4: Encrypt A’s private key with B’s public key 5: Export encrypted master key to B 6: Decrypt on B

But I guess we ideally would want some standardized protocol for doing this so you can do cross vendor backup.

Re:Use TouchID to Authenticate Sudo on macOS by kitsunesoba on Saturday August 27, 2022 @02:03PM (#32621500)
Personally I don't think I'd bother with redundant keys for most sites/services, only for those of the greatest importance. I think for most of us that list is short enough that redundancy is manageable.
Re:Use TouchID to Authenticate Sudo on macOS by filleokus on Saturday August 27, 2022 @02:45PM (#32621865)
Probably true. But my point is that if there was some secure/easy way to clone a key you wouldn’t need to think about redundant keys at all. If you create a clone you get redundancy for all sites in one sweep

(Most likely this will be solved by the mobile os vendors who will sync and backup your private key for you. Using your phones HSM instead of an external device)

Re:Use TouchID to Authenticate Sudo on macOS by vbezhenar on Friday August 26, 2022 @03:59PM (#32612052)
Why those things are not built-in to macOS. I don't understand. It should not be hard to implement for Apple engineers and it could be a good example for corresponding API.

I don't use sudo often enough to warrant system changes, so I don't use those programs, but if they would be enabled by default, I would gladly use them.

Re:Use TouchID to Authenticate Sudo on macOS by vouaobrasil on Friday August 26, 2022 @06:18PM (#32613394)
It is because Apple will use their own authentication-key approach with Apple passkeys, which stores a key pair on a person's iPhone.
Re:Use TouchID to Authenticate Sudo on macOS by dmitriid on Friday August 26, 2022 @04:04PM (#32612107)
Another pet peeve is: why can you auth with your watch but not your phone?
Re:Use TouchID to Authenticate Sudo on macOS by Jtsummers on Friday August 26, 2022 @04:08PM (#32612146)
It would be nice, but the phone would have to be unlocked at the same time you try to authenticate on the computer for this to work. Part of why it works with the watch is that you have to have an unlocked (but pin-lockable) watch near the computer. Most of the time when you're wearing the watch it will be unlocked (this is the default behavior, after unlocking it stays unlocked while worn) whereas the phone will relock itself. So it would be useful, if you happened to have already unlocked your phone near your laptop, but probably not as consistently useful as the watch. Most of the time, you'd find yourself unlocking your phone to unlock your computer which is not really convenient, so you'll just unlock the computer itself.
Re:Use TouchID to Authenticate Sudo on macOS by dmitriid on Friday August 26, 2022 @04:45PM (#32612551)
This would be useful in the case when laptop lid is closed. TouchID/FaceID are still very fast
Re:Use TouchID to Authenticate Sudo on macOS by metafunctor on Saturday August 27, 2022 @06:55AM (#32617694)
The Magic Keyboard for Apple Silicon macs has a Touch ID button. Works great.
Re:Use TouchID to Authenticate Sudo on macOS by jacobsenscott on Friday August 26, 2022 @11:39PM (#32615402)
You can do this with a chromebook and an android phone. I find it is more comfortable and faster to just type in the pin vs unlocking the phone, so I don't use it much.
Re:Use TouchID to Authenticate Sudo on macOS by dmitriid on Saturday August 27, 2022 @06:38AM (#32617605)
MacOS doesn't believe in PINs. It's passwords or touch id.

I'm glad my windows PC only requires a PIN :)

Re:Use TouchID to Authenticate Sudo on macOS by nocsi on Saturday August 27, 2022 @03:45AM (#32616776)
It’s not that different than initiating an Apple Pay for. Safari on Mac and reaching into your wallet on your iPhone. The framework is there. The UX would be to get a prompt in a similar way and Face ID unlock
Re:Use TouchID to Authenticate Sudo on macOS by wahnfrieden on Friday August 26, 2022 @04:37PM (#32612467)
small returns on a small market for prioritizing the work. maybe you're unhappy with the profit seeking system
Re:Use TouchID to Authenticate Sudo on macOS by drdaeman on Friday August 26, 2022 @05:20PM (#32612899)
Are software developers really a small market?

There is probably low priority/ignored because most developers can easily do this on their own, so it's not really worth the hassle.

Re:Use TouchID to Authenticate Sudo on macOS by leesalminen on Friday August 26, 2022 @05:39PM (#32613052)
Some googling shows ~20 million software developers around the world. Some googling shows roughly 2 billion households globally and 50% of them have a PC in their household. So let’s say 1 billion PC users.

20 million / 1 billion = 2%

So yes, it seems like a small market relatively.

Re:Use TouchID to Authenticate Sudo on macOS by solarkraft on Friday August 26, 2022 @09:15PM (#32614576)
Remember Steve Ballmer?

Developers are incredibly important for an ecosystem and having them a bit more optimistic about a platform can be quite beneficial (for a very low price, even).

Re:Use TouchID to Authenticate Sudo on macOS by rjzzleep on Friday August 26, 2022 @05:44PM (#32613096)
They were a significant portion of getting OSX to the masses, but became less and less relevant to Apple over time.
Re:Use TouchID to Authenticate Sudo on macOS by 8ytecoder on Saturday August 27, 2022 @02:45AM (#32616430)
Just an FYI, 1Password can now manage ssh keys that you can authenticate with TouchID
Re:Use TouchID to Authenticate Sudo on macOS by vbezhenar on Sunday August 28, 2022 @07:48AM (#32627619)
Still they bother to compile ssh, git, they even got some custom OpenSSL binary. They definitely have some resources allocated for “non-profit” development tools.
Re:Use TouchID to Authenticate Sudo on macOS by jbverschoor on Saturday August 27, 2022 @03:13AM (#32616613)
Maybe.. but it would also make it way easier for 'normal people' to use SSH keys / signing.
Re:Use TouchID to Authenticate Sudo on macOS by pram on Saturday August 27, 2022 @04:29AM (#32617014)
Seems like a natural thing to have in keychain.
Re:Use TouchID to Authenticate Sudo on macOS by kitsunesoba on Friday August 26, 2022 @03:37PM (#32611819)
Secretive is great. I use it on my T2 and M-series Macs and feel much better with keys sitting in those machines' secure enclaves than I did back when it was just sitting in ~/.ssh/ for anything to grab.

I just wish there were something as clean as Secretive for using generic PC TPMs or YubiKeys in place of a Secure Enclave under Windows and Linux. Currently have a Linux laptop halfway through setting that up and it's messy in comparison.

Re:Use TouchID to Authenticate Sudo on macOS by boustrophedon on Friday August 26, 2022 @04:23PM (#32612317)
It's actually very easy on linux now: You just use the two -sk key types released in Feb 2020 https://www.openssh.com/txt/release-8.2

`ssh-keygen -t ed25516-sk` or `ecdsa-sk` and then you touch your yubikey when unlocking the key, the same time as you would type a password.

Question for anyone else reading: Does it make sense to use a password with -sk keys? I don't think it would make a difference either way.

Re:Use TouchID to Authenticate Sudo on macOS by frutiger on Friday August 26, 2022 @04:59PM (#32612698)
> Does it make sense to use a password with -sk keys? I don't think it would make a difference either way.

Only if you want to protect your keys from being used by someone that has access to the private key + yubikey (i.e. someone physically present).

In other words, the -sk type private key is useless without the yubikey as well.

Re:Use TouchID to Authenticate Sudo on macOS by boustrophedon on Friday August 26, 2022 @05:14PM (#32612830)
Physical presence makes sense. I didn't really think it through but it's just the same as any other 2FA: you want something you know and something you have. Thanks.
Re:Use TouchID to Authenticate Sudo on macOS by flemhans on Friday August 26, 2022 @10:02PM (#32614869)
Are there any Linux-friendly laptops with a TPM built in?

It's nice not to have to rely on an external yubikey

Re:Use TouchID to Authenticate Sudo on macOS by kitsunesoba on Friday August 26, 2022 @11:56PM (#32615489)
It's not a perfect rule but anything a generation or two behind and has a GPU that's either integrated (Intel or AMD) or discrete AMD with Intel wifi and bluetooth are going to have a pretty good chance of handling a reasonably recent Linux distro (e.g. Fedora or Ubuntu non-LTS) well. While Nvidia provides official Linux drivers, I've personally had more trouble out of them than I have the stock Linux drivers for Intel and AMD GPUs.

Any laptop that is listed as supported by Windows 11 will have an onboard TPM.

Re:Use TouchID to Authenticate Sudo on macOS by judge2020 on Friday August 26, 2022 @03:56PM (#32612025)
For Windows, it seems it's possible[0, see footnote], however there are problems like general incompatibilities [1], and official support status is " We have this in our backlog. At this point it's not prioritized.".

0: https://github.com/tavrez/openssh-sk-winhello

0.footnote: "Windows Hello also supports other types of authenticators like internal TPM device(if they support generating ECDSA or Ed25519 keys, they can be used instead of FIDO/U2F security keys)."

1: https://github.com/tavrez/openssh-sk-winhello/issues

2: https://github.com/PowerShell/Win32-OpenSSH/issues/1804#issu...

Re:Use TouchID to Authenticate Sudo on macOS by redninja83 on Friday August 26, 2022 @08:57PM (#32614481)
Its possible to do, and once set up its a reasonably smooth process.

- Init Your TPM

- Create a key+cert on your TPM using certutil.exe

- Grab your public key

- Use WinCryptSSH (https://github.com/buptczq/WinCryptSSHAgent) as your SSH agent and away you go

These are very simplified steps, but there are howtos floating around (eg https://blog.habets.se/2016/10/Windows-SSH-client-with-TPM.h...)

Re:Use TouchID to Authenticate Sudo on macOS by maxique on Friday August 26, 2022 @03:31PM (#32611747)
I think 1Password's SSH agent does this now, too
Re:Use TouchID to Authenticate Sudo on macOS by danieldk on Friday August 26, 2022 @04:24PM (#32612339)
But it’s not really the same. Having private key material in the secure enclave means that it’s not extractable (except perhaps by state-level attackers with hardware access). With an SSH private key in 1Password there are still many possible software-level attack vectors (vulnerabilities in 1Password, a compromised 1Password update, etc.).
Re:Use TouchID to Authenticate Sudo on macOS by CharlesW on Friday August 26, 2022 @04:06PM (#32612126)
I didn’t know that was a thing, thank you!

https://blog.1password.com/1password-ssh-agent/

Re:Use TouchID to Authenticate Sudo on macOS by Axsuul on Friday August 26, 2022 @05:38PM (#32613040)
Note that there are some pretty significant caveats to Secretive:

- You cannot import your existing SSH keys

- You cannot transfer SSH keys if you get a new machine

Re:Use TouchID to Authenticate Sudo on macOS by adastra22 on Friday August 26, 2022 @05:46PM (#32613106)
That’s the whole point, no? Tie identity to the machine itself, not a piece of data that can be stolen.

BTW, if you have a key that you copy around to multiple machines, you’re doing it wrong!

Re:Use TouchID to Authenticate Sudo on macOS by rgoulter on Friday August 26, 2022 @11:01PM (#32615217)
It's not sufficient to be the whole point.

With some security mechanism, I'd consider:

1. prevent other people from being able to use it. 2. recover from it in case it gets lost.

If your perspective is "if I lose this laptop, I have some other way to access the systems", then it's good to never access the SSH key secret.

If your perspective is that you want your secret key to be the only way to access some system, you'll want to have some way to recover the secret.

I think in any case, it's understood that having an unrecoverable secret being the only way to access some system is a bad idea.

Re:Use TouchID to Authenticate Sudo on macOS by epistasis on Friday August 26, 2022 @06:15PM (#32613370)
Exactly, these are precisely the features I'm looking for. They are not caveats, they are the way I want my keys to behave.

If there is some sort of use case where I want to be able to backup a key, or share it with someone else I can always fall back to SSH keys on a hard disk. But those are usually anti-patterns.

Re:Use TouchID to Authenticate Sudo on macOS by howinteresting on Friday August 26, 2022 @10:11PM (#32614928)
Backup and availability is where all of these systems fail. Even the new passkey sync thing is pure vendor lock-in.
Re:Use TouchID to Authenticate Sudo on macOS by epistasis on Saturday August 27, 2022 @01:50AM (#32616138)
I'd prefer for a backup to be a second key on a different hardware device, personally.

I might also be ok if somebody like Apple had engineered a cloud solution for securely keeping backups, but only maybe.

Re:Use TouchID to Authenticate Sudo on macOS by licebmi__at__ on Saturday August 27, 2022 @01:13AM (#32615947)
the main problem is the lack of support of rsa keys.
Re:Use TouchID to Authenticate Sudo on macOS by Avamander on Saturday August 27, 2022 @08:09AM (#32618099)
Do you actually have something that can't even do NIST curves? Genuinely curious.
Re:Use TouchID to Authenticate Sudo on macOS by arthurmorgan on Saturday August 27, 2022 @01:04PM (#32620960)
Azure DevOps.
Re:Use TouchID to Authenticate Sudo on macOS by trhway6552 on Friday August 26, 2022 @06:34PM (#32613520)
I've been using https://github.com/sekey/sekey for years now! It handles gpg as well