by mmulqueen · 1w ago · 0 comments
By having it as a GPG key, you get signing and encryption on top of SSH. You can pair it with gopass as a password vault.
I haven't had to make a new key for years, they're very hard-wearing, mine lives on my key ring with my house keys. But I wrote this script to automate setting up a new key, I haven't tested it with recent Yubikeys or a recent version of GPG, but might be a useful starting point: https://github.com/Method-B-Ltd/auto-gpg-card - PRs welcome if it's broken.
You still need to be really careful about what can run as your user, but being able to take the key away physically remove a load of risk.
There's very little hassle involved anyway. You set up the hardware key once and it lasts years and you have to configure SSH and GPG on any machines that you use as a terminal (not any of the machines you connect to). It is easily scripted and deployed en masse.
I'm talking about the hassle of entering your PIN everytime you need to use it. The idea of ssh keys is that you don't have to enter your password anymore, but if you just have to enter a different password everytime then I don't really see the point. If you still need to enter a PIN it also prevents automation, like having a backup run during the night to an offsite location via ssh.
For machine to machine like a backup process, it runs with its own key, with its own system user on the source and destination machine. That key has to sit on disk (or at least that's the risk that I accept), but that's a completely different risk to a key living in a real user's home directory. It can be locked down on both sides to mitigate further. Read only pull backups over SSH are possible this way for example.
You can use hardware tokens without interaction of course, but I agree in this particular case, it doesn't buy you much extra protection.