I’m trying to figure out how much work it would be for incus client to use a private key on a smartcard (specifically, a yubikey through its PIV applet) as opposed to the current on-disk client.key.
Is there anyone else interested in such a feature? I know of the existence of OIDC, but I’d rather keep things local/simple, and I am heavily relying on a yubikey already for SSH (yubikey-agent/sk-ssh-ed25519@openssh.com), age (though age-plugin-yubikey) and its OpenPGP applet, so might as well continue down that path.
My impression is that the server side is already sufficiently generic for this to work, because the trust list takes fingerprints. That is, you can do this:
$ ykman piv keys generate --algorithm ECCP256 83 pubkey.pem
$ ykman piv certificates generate --subject "CN=incus" 83 pubkey.pem
$ ykman piv certificates export 83 client.crt
$ incus config trust add client.crt
What is currently missing, is a codepath in the incus client to use a yubikey instead of client.key on-disk. I have to investigate whether the go tls library makes plumbing this in simple or hard. But at least on the PIV side, there is GitHub - go-piv/piv-go: Keys and certificates for YubiKeys, written in Go · GitHub to build on.