by traceroute66 · 4y ago · 0 comments
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 host X509 type). Because if I could use a Yubi for SSH certificate signing I would have already been using certificates ! (Yes I know, theoretically you can do it with GPG keys, but frankly that's a PITA with many issues).
My current plan is to take inspiration from this : https://smallstep.com/blog/diy-single-sign-on-for-ssh/
However, if the author of a piece of security software tells me something is a bad idea, I tend to accept that, especially if that author is mjg59.
- https://keepassxc.org/docs/#faq-ssh-agent-how
- https://developers.yubico.com/SSH/Securing_SSH_with_FIDO2.ht...
You could probably also put the SSH key itself as a resident key on the YubiKey. But personally I like the fact the key and 2FA aren't on the same device (and the fact you can only get my key when you know the KeepassXC master password).
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...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.
what doesn't work is storing the signed certificates