18

I am currently looking into the possibility of using Yubikey (NEO)'s to store the private SSH keys of my users. By searching the internet I've found several places that explain how you can generate a GPG master key and subkey, import it on your Yubikey, export and convert the public key and setup gpg-agent to connect via ssh.

What I can't seem to find anything about is a way to also sign the key and load that into gpg-agent using OpenSSH's method for signing user keys. For my servers I have generated a key using ssh-keygen and set that key up as a CA via TrustedUserCAKeys in sshd_config. After converting the GPG public key to an OpenSSH public key I can sign it using ssh-keygen, but I'm unable to get gpg-agent to use the private key in combination with the signed public key. I know I can put the signed key in the authorized_keys file on the server, but the main advantage in my use case of using TrustedUserCAKeys is that it alleviates the burden of having to maintain an authorized_keys file for all users on all servers and instead only having to maintain a revoked_keys list. So I'd like the signed key to be placed on the client side rather than the server side. Putting it on the server side would defeat the purpose of signing the key in the first place except for the added expiration date.

It is not a requirement to have the signed public key loaded onto the Yubikey and/or into gpg-agent, if there is a way to have PuTTY, MobaXterm or some other Windows SSH connection tool or any tool at all to make the SSH connection use the signed public key as opposed to the unsigned public key, whether it via the Yubikey, gpg-agent or loading the file separately, that would be a great solution as well.

Is this at all possible or is there no solution (on Windows) that supports including a signed public key with a private key?

Also something I just thought of is that if I can somehow sign the subkey with another PGP key and use that PGP key as the ssh CA that'd be fine too, as long as it's possible to convert it to an OpenSSH private key to also sign regular SSH keys.

SunMar
  • 181
  • 1
  • 5
  • If you have a Kerberos infrastructure (e.g. windows domain), you might be able to use the certificate to get a Kerbersos ticket and use the GSSAPI authentication instead. Of course, a lot more setup is requried. – billc.cn Nov 09 '15 at 16:19

1 Answers1

5

using Yubikey (NEO)'s to store the private SSH keys of my users

This use-case is described on yubico website here: https://developers.yubico.com/yubico-piv-tool/SSH_with_PIV_and_PKCS11.html

What I can't seem to find anything about is a way to also sign the key and load that into gpg-agent using OpenSSH's method for signing user keys.

The step 2 from the above mentioned method can modified that you will not self-sign the key, but sign it with your CA key.

This method should work also on windows (yubico-piv-tool) has releases also for Windows.

Jakuje
  • 5,229
  • 16
  • 31
  • Thank you for the reply! The problem though is that OpenSSH doesn't support X.509 certificates, they've implemented their own way of signing keys. I can setup my own CA and use that to sign the certificate in the gpg-agent or Yubikey, but if I'm not mistaken that CA still wouldn't be recognized by OpenSSH and the gpg-agent will pass just the regular public key to SSH and not the signed public key. – SunMar Nov 17 '15 at 10:35
  • Yes. You would need to have openssh CA key and openssh certificates to make it working natively. But there was some [unofficial patch](http://roumenpetrov.info/openssh/) for openssh to support x.509, if it is option for you, but I am not sure about this in combination with yubikey though. – Jakuje Nov 17 '15 at 10:38
  • Yes I have found that patch, but due to security policies it is not possible for me to use an unofficial patch in a production environment so I am limited to OpenSSH's built-in signing method. – SunMar Nov 17 '15 at 10:50
  • I understand. But if you didn't yet try the openssh certificates, I would recommend you to give it a try. It is really easy to set up in comparison to full-blown X.509 and it works flawlessly on every recent openssh, probably also on Windows, since MS is making it part of windows in last months. – Jakuje Nov 17 '15 at 10:56