Live data from Hacker News

Poll HN: Do you use SSH certificates (not mere public-key authentication)?

news.ycombinator.com

121–130 of 156 posts

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#121
post #36

Earlier quoted context omitted.

How do you issue client certificates? Do you not worry that the private key needed to issue these can also leak just the same as your personal private key?

By doing a Certificate Signing Request (CSR) from the client. Not sure when it's actually worth doing this extra effort but with the right automation (e.g. with Ansible) it's doable. Never tried this for ssh though. Additional security if you use HSMs.

SSH provides native support for certificates; they’re a custom (non‐X.509) format. The signatures are generated with the ssh-keygen command; I set my infrastructure up purely by reading the manpage, not referring to any blog posts or anything, so I think the documentation is a good way to get started.

https://man.openbsd.org/ssh-keygen.1#CERTIFICATES

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#122

Earlier quoted context omitted.

I think this is true if you only really have one or two computers you use ssh from regularly but if you have a few or you get new ones frequently you can get back to that experience of not having to frequently generate and distribute public keys by using a yubikey to sign local keys and then your authorized_keys only needs the cert authorization in it.

I just store my SSH key in my Yubikey and then I can SSH from any computer that has SSH and GPG installed. Gets rid of the "generate and sign a key that then sits on that computer that might not be fully trusted" step...

not as flexible, as it has more dependencies, but you can make it work without gpg as well: https://developers.yubico.com/yubico-piv-tool/YKCS11/

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#123

Earlier quoted context omitted.

> Rotation is actually a lot easier with certificates. I just generate a new key on the client, copy the public key to the CA, and I’m done, with no need to repopulate authorized_keys on all my other machines. Or, just paste your public key into your Userify profile and the same thing happens in seconds for every server that you have authorization for. Even better, there's no dependency on having a CA up and running…

I’m glad Userify works well for you. For my purposes, whipping up a couple of cronjobs involving curl and OpenSSH is more appropriate than relying on an external cloud service. > But I've been burned before when a central auth server was down and I couldn't log into my servers There is no central auth server involved here. My servers check login credentials against the CA’s public key, which is installed alongside my…

Fair point. that's basically what userify is, I think![0] (just really a UI on top of a script!) You can run your own server for management, and that's what we do.

0. https://github.com/userify/shim/blob/master/shim.py

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#124
post #78
post #67

Earlier quoted context omitted.

This wouldn't matter anyway because the server can just give you access regardless of the auth provided.

I know you can restrict the methods on the client (and which keys you use) but can the client determine the host actually used it?

Use `ssh -vv` and you'll see which methods are proposed and used.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#125

Earlier quoted context omitted.

> On the other side, as a personal user of SSH with basically one person to worry about, the effort of setting up a certificate seems like just a waste versus the existing key-based infrastructure; I don't understand at all what attack it would prevent or what convenience it would provide for the cost of learning it. The main benefit I get from using SSH certs at home is expiration. Before, I always had a niggling fe…

How is this more secure than simply creating new certificates and replacing the old ones is the authorized_keys files? > I only have to worry if my machine is secure in the present No. If a host has been accessed by an attacker due to an exfiltrated key in the past it's tainted forever.

> How is this more secure than simply creating new certificates and replacing the old ones is the authorized_keys files?

It’s more convenient for me than updating authorized_keys. When I build a new machine, for example, I first generate a new SSH keypair on the machine. Then I copy the server and user public keys to the CA. Once I drop them in the right folder, certificates get generated automatically and served over HTTP. Then on the new machine I set up cronjobs to refresh the certificates every two weeks. I didn’t have to update authorized_keys on a dozen other machines, and I didn’t have to inspect any host fingerprints.

> If a host has been accessed by an attacker due to an exfiltrated key in the past it's tainted forever.

Yes, that’s obvious (although I did mention shell script in my previous comment—been a while since I thought this through). The scenario I imagined at the time was more like, did I ever copy my private key to an unencrypted flash drive, and then lose the flash drive? I never let private keys leave a machine anymore, but maybe I wasn’t so strict about that five years ago, and when did I generate my main SSH keypair? Was it four, five, six years ago? I no longer have to worry about such things. I could have just rotated my keys, but with short‐lived certificates I now get the benefits of key rotation without having to do any of the work.

Now I tie all my SSH keys to a WebAuthn key, which provides even more protection, because within the three‐week window that my certificates are valid, an attacker would have to also physically possess my Yubikey.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#126

I've used public-key basically forever. I have wanted to go that step further and implement certificates for a good few years now, I absolutely see the value, no question about it (i.e. no more out of date authorized_keys files, no need to even install authorized_keys files in the first place, the list goes on). I wish YubiKeys were more flexible in allowing SSH certificates to be hosted on them (currently can only h…

You can sign yubikey-hosted FIDO keys in OpenSSH just fine.

A FIDO token can also act as CA, though the certificates it issues will be limited to use by relatively recent SSH versions as FIDO support was only added in 2019.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#127
post #92
post #81

Earlier quoted context omitted.

That's just the nature of trusting someone else to be your CA. You don't have to do that to use SSH certs.

At the minimum, you need to trust yourself to be a CA. That's strictly more attack surface than not having a CA.

It's not "strictly" more because you reduce the attack surface of your leaf certs through expiration, etc.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#128
post #92

Earlier quoted context omitted.

At the minimum, you need to trust yourself to be a CA. That's strictly more attack surface than not having a CA.

It's not "strictly" more because you reduce the attack surface of your leaf certs through expiration, etc.

What attack does that prevent? If the leaf certs are compromised, then so is the server, and it is already game over.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#129
post #56
post #16

We looked into them once at work for our "conventional" SSH infrastructure, but immediately rammed into the wall that a certificate can sign a key, but you can't have a full PKI infrastructure like SSL where certs can sign certs that can sign keys. Without the ability to delegate, the logistics of needing to create an absolutely centralized authority to do the useful things we wanted to do within the organization rai…

Essentially the whole point of modern SSH CAs is to centralize authentication and authorization for servers, and to keep long-lived keys off your developer machine fleet. If "no long-lived keys on laptops" and "central authority for who gets access to what with which credentials" aren't principles for your security practice, then you're right: there's not much of a win to switching to a CA model.

We use different central authorities than certificates, which manage keys directly; the end result is much the same even if the tools are theoretically inferior. Long-lived keys on laptops might be a weakness at this point, honestly. I expect that to be resolved by a slow but steady move to "whatever the cloud supports" as AWS and such rolls out their various solutions. I know we've got teams that use them, I imagine it'll be obligatory at some point here.

I know it's not perfect, which is why I contrasted "polished turd" to the "uncut diamond in the rough". We're at a size where it's really hard to justify a whole lot of work on the uncut diamond, in contrast with the various cloud efforts to fix their problems. Given that such things now exist it's more a matter of moving over to them than developing anything ourselves now, which is probably an improvement over where we were two years ago. We probably couldn't have beaten the clouds even if we did put the effort in; this is in that class of problem where the effort is nominally small but the price of not breaking things is so large than it ends up a multi-year project anyhow. (One of my least favorite classes of project.)

I'd also add that I report this not in the spirit of "we've solved this problem", but just an experience report.

Re: Poll HN: Do you use SSH certificates (not mere public-key authentication)?

#130
post #34
post #16

We looked into them once at work for our "conventional" SSH infrastructure, but immediately rammed into the wall that a certificate can sign a key, but you can't have a full PKI infrastructure like SSL where certs can sign certs that can sign keys. Without the ability to delegate, the logistics of needing to create an absolutely centralized authority to do the useful things we wanted to do within the organization rai…

> Without the ability to delegate, the logistics of needing to create an absolutely centralized authority to do the useful things we wanted to do within the organization raised the cost of "first value" too high for us to fuss over. Have you considered integrating this with the SSO provider you are almost certainly already using as 1k strong org? Basically, create groups in Okta or whatever you’re using, delegate man…

Well, that is either 1. exactly the sort of development that I was talking about on top of the tech, rather than the tech being directly useful and 2. the sort of thing the clouds are naturally doing on their own.
Post reply on HN