YubiKey-Guide icon indicating copy to clipboard operation
YubiKey-Guide copied to clipboard

Renewing subkeys not covered

Open micha3lbrown opened this issue 7 years ago • 6 comments

Recently my subkeys expired and working through how to properly update these keys proved a little trickier than expected. I've taken some detailed notes, but before submitting a PR I wanted to know if that is something that people would find useful and/or if it belongs in this guide?

Thanks so much again for making this resource available, its greatly improved my security posture and understanding of GPG and Yubikeys. 🙇

micha3lbrown avatar Mar 26 '19 01:03 micha3lbrown

I was in the same boat recently and it would've been helpful to have a note here about how to handle it. There's a note mentioning renewal in the guide:

Use a 1 year expiration - it can always be renewed using the offline Master certification key.

but I didn't see a section that actually covers how to renew them.

If you do decide to submit a PR you might want to mention that there are differing philosophies about whether expired keys ought to be renewed or replaced (and how to sign the replacements to maintain trust). I found this answer informative.

+1 Thanks for this guide, incredibly useful and informative.

OvertCoffee avatar Mar 26 '19 17:03 OvertCoffee

I would find it really useful if some recommendations about this was covered in the guide.

donnex avatar Apr 27 '19 17:04 donnex

Thanks for the feedback. I'll work on documenting key rotation and revocation next.

drduh avatar May 19 '19 17:05 drduh

Okay, as many people may know, PGP does not provide forward secrecy, meaning messages are all encrypted with the same key, which if compromised reveals all past communication. However, the entire point of generating keys offline and storing sub-keys on non-exportable hardware is to reduce that risk. It won't be eliminated - the key and PIN could be stolen; there could be a vulnerability in the key hardware; or in the encryption algorithms; or in the random number generator, etc.

To address that, we could rotate the sub-keys and remind ourselves with periodic expiration. But this is a cumbersome process, as it involves booting to the secure environment, unlocking the master key, generating new key material, copying it over, exporting and sharing new public keys, re-encrypting any saved secrets with new credentials, and installing the new authentication key on remote server (without having access to the existing one!)

At their logical conclusion, short-term sub-keys would be unique for each encryption, signing and authentication event. But because YubiKey can only store one of each at a time and creating and distributing new keys is difficult, the optimal sub-key lifetime becomes a matter of personal philosophy and threat model. Those desiring better repudiation and anticipating advanced threats would be well-served by a dedicated offline machine for faster, more regular credential rotation. Better yet, a dedicated YubiKey can be used to store the Certify capability key and sign new sub-keys. If long-term SSH keys are of concern, CA-issued X509 certificates may be better suited than OpenPGP.

This guide was originally meant to solve security and convenience issues with portable SSH keys. To that end, I don't find sub-key expiration to be worth the trouble for most users. I propose removing it altogether and adding a section better explaining these security and privacy properties of PGP instead. What do others think?

drduh avatar May 20 '19 05:05 drduh

Looking for a clarification on this, as I don't think I've fully understood the section Rotating Keys.

I've been GPG encrypting some files recently, using a subkey on the Yubikey (let's call is subkey_0. If I was to generate a new subkey subkey_1, from the same master,master_key_0 then would be I be able to decrypt the files with subkey_1?

Wheest avatar Sep 01 '19 14:09 Wheest

No, I don't think that is possible, at least from my experience. You need to re-encrypt to the new subkey on rotation, I think.

drduh avatar Sep 03 '19 18:09 drduh