Show HN: GPG on macOS and YubiKey
github.com
github.com
For those starting from scratch with a YubiKey I always recommend this guide:
https://github.com/drduh/YubiKey-Guide
Then they know how this stuff works and how to fix it when it breaks.
From the drduh guide:
> It is recommended to generate cryptographic keys and configure YubiKey from a secure operating system and using an ephemeral environment
Update: new YKs with new firmware are apparently able to provide proofs that the keys were generated on hardware.
That specific best practice might not be the most important for most people to follow, compared to other things on the list, but it is definitively a good idea and has saved me before. Random number generators on embedded devices aren't always the best.
Also I'd strongly encourage generating encryption subkey in software (offline, air-gapped machine) and then copying it to Yubikeys. If you lose your Yubikey (or mistype 3 times the PIN) you wouldn't be able to decrypt your secret data.
We're taking the risk anyway because the benefits of having the private keys generated and stored entirely on the YK is entirely worth it.
We're also not primarily using the YK to encrypt messages. If continuing to decrypt shared messages in the future is critical, I'd personally look into HSMs which offers key-wrapped backup.
One thing that I still haven't found a good answer for that's not mentioned in the guide: what's KDF for?
The new yubikey firmware has release notes here: https://support.yubico.com/support/solutions/articles/150000...
This is the bit that has me lost:
> To remove the transmission and on-card storage of OpenPGP PINs in plain text, the YubiKey supports the Key Derived Function (KDF) functionality. With the KDF function enabled, the PIN is stored as a hash on the YubiKey. When entering the PIN to the OpenPGP Smart Card, the OpenPGP client will only pass the hashed value, never passing the PIN directly. KDF functionality is set on the card itself, and communicated to the client; it is transparent to the user. Should the KDF functionality not be enabled, the PIN function will work as previously. The KDF function is listed in section 4.3.2 of the OpenPGP Smart Card 3.4 spec.
Can someone explain to me how KDF matters at all here?
It seems like the keys are encrypted on the yubikey via pin, or at least protected in hardware via pin, and that the pin is stored on the device. KDF seems to take that plain text pin and replace it with a hashed pin. If you steal my yubikey, it looks like KDF would prevent you from... dumping the PIN? But if you could dump the pin, wouldn't you just dump the key instead? I can't seem to figure out the threat model for this feature.
Interested to hear what it's for
``` programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
services.udev.packages = [ pkgs.yubikey-personalization pkgs.libu2f-host ]; services.pcscd.enable = true;
environment.shellInit = '' export GPG_TTY="$(tty)" gpg-connect-agent /bye export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" ''; ```
The only surprise I had was that I forgot to tell gpg to trust the imported key after I imported it.
Combine this with GoPass... its the start of something good :)
What was the problem with gnome? I vaguely recall a problem with polkit or something.
For organizations publishing employee keys via Web Key Directory can also be an additional signal that the key is trustworthy.
It's also quite simple: for example exporting the key 5C090ED7318B6C1E (binary, not armored) and putting it on this exact URL: https://datadoghq.com/.well-known/openpgpkey/hu/964aj6q73iat... is enough to discover the key using e-mail address.
This post goes into more detail: https://spacekookie.de/blog/usable-gpg-with-wkd/
WKD is used by Linux distros (ArchLinux, Gentoo, Debian...) and kernel.org itself: https://www.kernel.org/category/signatures.html#using-the-we... as well as some OpenPGP sites (e.g. ProtonMail).
https://github.com/DataDog/yubikey/blob/master/gpg.sh#147
This statement has no effect when using Yubikey - the PIN is cached by the key itself and it will remain unlocked indefinitely until it's physically unplugged. See https://dev.gnupg.org/T3362
Maybe you should edit the title of this submission and add "Show HN" (https://news.ycombinator.com/showhn.html).
The best method I know is to store it on paper with the help of paperkey:
http://www.jabberwocky.com/software/paperkey/
The tool also supports a raw output mode which can be piped to a QR encoder. 4096 bit RSA secret keys fit in binary QR codes and they are much easier to use compared to manual data entry.
Current versions of zbar can't decode binary data in QR codes properly. I've sent some patches that fix the problem but they haven't been reviewed yet. Hopefully it will be possible to automate this process with zbarcam soon.
Still looking forward to SSH supporting U2F (some day).
[0]: https://marc.info/?l=openssh-unix-dev&m=157259802529972
Signing every commit is going to make it a mindless task. It's easier to be vigilant when signing if you sign less frequently.
What trade-offs should be considered?
git config --global commit.gpgsign true
this turns commit signing on for every commit, you don't have to explicitly sign commits as a separate step.the criticism I've always heard of this practice is, what do you do with those signatures? github displays a little widget showing that the commits are signed, but beyond that I don't think it cares which public key they were signed with, so it's not really helping anything.
My understanding is:
Entering a key passphrase each time is going to be annoying without providing benefit over just signing some git tag.
Leaving the key unlocked in an agent is going to be somewhat less secure than requiring the key to be unlocked on every use.
> github displays a little widget showing that the commits are signed, but beyond that I don't think it cares which public key they were signed with, so it's not really helping anything.
As I understand it, "verified" means it's either a commit made on GitHub's website with that user signed in, or the commit was signed with one of the keys associated with that user's profile.
I guess for the case of "I only trust commits signed by a certain key", you'd need to use a different GitHub profile.
I use this but it causes weird usability issues for me when using multiple iTerm tabs or git GUIs when the GPG daemon’s unlock timeout expires and I need to input my passphrase in again. I wish it could just be tied to the mac’s keychain, so when I unlock my computer it is ready to go. Or at least tie it into TouchID or Watch like unlocking the mac does.
I sign all my commits so that everyone knows it was most likely me. You can even turn on branch protection in GitHub these days that rejects unsigned commits.
With all due respect, Mr. Torvalds isn't exactly famous for having designed the most secure kernel.
https://www.gentoo.org/news/2018/06/28/Github-gentoo-org-hac...
You can even turn on branch protection in GitHub these days that rejects unsigned commits.
https://help.github.com/en/github/administering-a-repository...
> Signing each commit is totally stupid. It just means that you automate it, and you make the signature worth less. It also doesn't add any real value, since the way the git DAG-chain of SHA1's work, you only ever need _one_ signature to make all the commits reachable from that one be effectively covered by that one. So signing each commit is simply missing the point.
[0]: http://git.661346.n2.nabble.com/GPG-signing-for-git-commit-t...