Live data from Hacker News

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

news.ycombinator.com

71–80 of 156 posts

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

#71
post #48

For those curious about how SSH CAs and key signing works, I wrote a blog post about that awhile ago: https://dmuth.medium.com/ssh-at-scale-cas-and-principals-b27... I also created a "playground" which can be used to stand up such an environment running in Docker containers to better understand the process: https://github.com/dmuth/ssh-principal-and-ca-playground Hope folks here find them helpful.

That that looks rly helpful. I’ll check that out tonight, thanks for sharing

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

#73

I don't see the benefit of using certificates for personal use. In my mind, certificates only really shine when administering a fleet of servers in a large company, as it eliminates the need to update the authorized_keys file on every server someone is hired or leaves. I could be missing some less obvious use cases, but if you're just authenticating to your personal machines, it doesn't seem worth it. It's not any mo…

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.

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

#74
Note that using a CA cert with SSH (or putting a host cert in DNS, etc) expands the attack surface for your server from just that server to the server + the CA's servers + the CA's employees + potentially other CA's + whatever governments are able to compel the CA['s] to issue a MITM cert for your server.

For big organizations security is by-definition lax (you have to trust lots of non-trustworthy employees), but there's no reason to accept this compromise for smaller companies or personal use.

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

#75

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…

The Yubikey PIV/X509 applet can be used for SSH (see [0]). Their link doesn't explain this but that key can be used as a CA instead of as a straight SSH key if you want. eg to add the CA to your authorized_keys files, generate a throwaway key, sign that with the CA and add it to your ssh-agent:

  ssh-keygen -D opensc-pkcs11.so -e > cert-on-piv.ssh
  ( echo -n "cert-authority "; cat cert-on-piv.ssh ) >> ~/.ssh/authorized_keys
  name="temp-$(date +%Y%m%d-%H%M)"
  ssh-keygen -q -N '' -C "${name}" -t rsa-sha2-256 -f ${name}
  ssh-keygen -t rsa-sha2-256 -s cert-on-piv.ssh -D opensc-pkcs11.so -V -1d:+1d -I ${name} ${name}.pub
  ssh-add -t 1d ${name}
  rm -f ${name} ${name}.pub ${name}-cert.pub
[0] https://developers.yubico.com/PIV/Guides/PIV_Walk-Through.ht...

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

#76
post #35

I store my authorized_keys in DNS TXT records, that are DNSSEC signed, with a validating resolver on the box. I then just use "/usr/bin/hesinfo %u ssh" as my AuthorizedKeysCommand in OpenSSH. I wrote a little tool that allowed you to "#include" other DNS records etc, but "hesinfo" is generally easily installable/available so it's just easier.

I would love a HOWTO link. Also, can the DNS server be public facing? Any issues with the authorized keys being public (AFAICT there isnt but i am not a security expert)?

A public key can be an identifier. Depending on what other information you share online or if a key is reused on GitHub it can be used to identify other places you visit and other artifacts associated with you. If your goal is anonymity then keeping you public keys secret or not attached to other personal information like a domain name is ideal. Almost all registrars are going to have a way to reveal your true identity.

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

#77
I used to put CA keys, encrypted, in a repo only ops admins have access to. The passphrase was shared manually with each admin, once. If/when an admin left, the plan was to rotate the CAs. All SSH and TLS servers I used this for had the ability to use multiple CAs, so the rotation itself worked.

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

#78
post #67
post #47

Earlier quoted context omitted.

There is technically one minor one, which really isn't one - but you should be aware of. Someone can take your authorized keys and add them to a box they control, and trick you into logging in. However, this would trigger the "new host" warning SSH gives you, and you can minimize this by minimizing which hosts you allow your private keys to be used on. And if someone is so actively trying to attack you they probably…

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?

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

#80
It's possible to store the private CA keys on something like YubiKey hardware offline. That seems like a good trade off if you don't have access to a cloud based HSM. Ideally, the private CA keys would be stored in an HSM and used to sign any keys you needed with them. Note: this is not to be confused with using a FIDO/U2F hardware authenticators which is also a good idea.

This can double not only has a PKI for hosts and users using SSH connections but you can also use the PKI for signature verification of arbitrary data.

Post reply on HN