Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnupg: apply patch to allow import of key updates without user ids #80266

Merged
merged 1 commit into from Mar 6, 2020

Conversation

Valodim
Copy link
Contributor

@Valodim Valodim commented Feb 16, 2020

This adds a patch series which allows GnuPG to import updates
(revocations and subkeys) from certificates that contain no user ids.
This is relevant for refreshing keys from the default keyserver
keys.openpgp.org, where only user ids that contain verified email
addresses will be distributed, and revoked keys never contain any user
ids.

This patch series was originally authored and submitted to upstream half
a year ago (by me), but now comes from Debian packaging where it's been
included since then.

Relates to the following upstream issue: https://dev.gnupg.org/T4393

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
  • Tested execution of gnupg and dirmngr binary files
  • Fits CONTRIBUTING.md.

@FRidh
Copy link
Member

FRidh commented Feb 19, 2020

This needs to target the staging branch.

@FRidh FRidh added this to WIP in Staging via automation Feb 19, 2020
@Valodim Valodim changed the base branch from master to staging February 19, 2020 09:04
@Valodim
Copy link
Contributor Author

Valodim commented Feb 19, 2020

No problemo :) \\ edit oh whoops, wrong base. fixing in a second.

This adds a patch series which allows GnuPG to import updates
(revocations and subkeys) from certificates that contain no user ids.
This is relevant for refreshing keys from the default keyserver
keys.openpgp.org, where only user ids that contain verified email
addresses will be distributed, and revoked keys never contain any user
ids.

This patch series was originally authored and submitted to upstream half
a year ago (by me), but now comes from Debian packaging where it's been
included since then.

Relates to the following upstream issue: https://dev.gnupg.org/T4393
@Valodim
Copy link
Contributor Author

Valodim commented Feb 19, 2020

Rebased onto staging. Builds and works fine for me.

@Enteee
Copy link
Contributor

Enteee commented Feb 19, 2020

I tried to collect some background information which might help a possible reviewer. NOTE: I am by no means an expert on this topic. @Valodim: please correct me if I am wrong.

  • This is needed in order to facilitate a switch to keys.openpgp.org which does not send any user-ids for unverified users.
  • This does not solve existing issues when downloading poisoned certificates from SKS keyservers.
  • Werner Koch is reluctant to merge this. After crawling through a lot of the discussions on dev.gnupg.org I do think I have found the reason why:

Re 3.: I am still unconvinced about the use cases for accepting keys without user-id. In contrast to pgp-2, gpg has always had the policy to allow only keys with a user-id and futher only with valid, ie. signed, user-ids. The reason for this is that properties of the key are carried in the self-signature of the user-id. It is possible to take them also from so-called direct-key-signatures, but we do not have much experience with that feature and thus I fear that this will have severe regressions to the ecosystem. RFC-4880 even requires the user id and the planned change in rfc4880bis is merely for a very limited use case on embedded devices where there is no space for a user-id.
-- Source

@FRidh FRidh moved this from WIP to Needs review in Staging Feb 27, 2020
@Valodim
Copy link
Contributor Author

Valodim commented Feb 27, 2020

All of those points seem correct, thanks for writing them up :)

This is needed in order to facilitate a switch to keys.openpgp.org which does not send any user-ids for unverified users.

Correct. This is already the default in Nix since #63952, so even stable. Disclaimer: I maintain keys.openpgp.org.

I do think I have found the reason why:

The quoted argument is sound in itself, but slightly misses the point. I am still unconvinced about the use cases for accepting keys without user-id. - the patch doesn't allow importing keys without user ids per se, nor does it make an argument that this should be possible. It allows importing updates for keys that are already known, from key data that carries no user ids.

In a nutshell, a key typically consists of: primary key + subkeys + revocations + user ids. GnuPG checks for this structure on import. There is indeed a good argument not to import keys without user ids, since the user ids (or rather, their self-signatures) carry relevant metadata for the primary key. However, the subkeys and revocations can independently be checked for cryptographic integrity. For a key where a user id is already known, if we see a file that's "primary key + revocation + subkeys", the behavior this patch introduces is to merge the revocations and subkeys into the local store.

To put it differently, if you currently hand GnuPG a file with structure "primary key + revocation", the revocation will be ignored, unless there is also a valid user id on the data. Same for subkeys.

I can only speculate why Werner doesn't want to merge this patch. So far I have not seen a sound technical argument against the use case.

Patch-state in other distributions (19. Feb. 2020)

It's also in GPGTools for macOS, iinm.

@dkg
Copy link

dkg commented Feb 28, 2020

Hi there -- i'm the most active GnuPG maintainer in debian. just wanted to weigh in here to corroborate @Valodim's analysis and the attached patches in case that's useful.

The default keyserver is used for gpg --refresh, which is typically used to retrieve revocation information and new subkeys. keys.openpgp.org is entirely capable of distributing those updates, but without the changes listed here, GnuPG will ignore those updates, even though they are cryptographically verifiable.

This change is an important one, and should be applied upstream. But given upstream's inexplicable delay, those of us who redistribute GnuPG are obliged to fix it for our users.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/121

Staging automation moved this from Needs review to Ready Feb 29, 2020
Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if upstream would accept those patches, but since their intentions are basically unknown I'm in favor of applying them. 👍

@FRidh FRidh merged commit 7cc68a9 into NixOS:staging Mar 6, 2020
Staging automation moved this from Ready to Done Mar 6, 2020
@Valodim Valodim deleted the gnupg/import-without-uid branch March 7, 2020 01:42
@stigtsp stigtsp mentioned this pull request Jul 6, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants