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

RFE: Enforce OpenPGP signatures by default #1573

Open
dmach opened this issue Mar 9, 2021 · 5 comments
Open

RFE: Enforce OpenPGP signatures by default #1573

dmach opened this issue Mar 9, 2021 · 5 comments
Labels
crypto Signatures, keys, hashes and their verification RFE v6 Related to rpm v6 (readiness)
Milestone

Comments

@dmach
Copy link

dmach commented Mar 9, 2021

It might be good to start verifying GPG signatures by default.
Adding --nogpcheck option (following what dnf has already) might be a good compromise for users that want to turn it off for individual package installs.

@pmatilai pmatilai changed the title Verify GPG signatures by default Enforce GPG signatures by default Mar 9, 2021
@pmatilai
Copy link
Member

pmatilai commented Mar 9, 2021

Rpm actually already verifies signatures if present by default since 4.0 or thereabouts, but it doesn't require them. Enforcing is supported since >= 4.14.2 and we also have the bypass-switch (--nosignature) already, so from strict technical perspective this is just a matter of one line change to turn the policy switch to 11 (%_pkgverify_level all).

The only thing stopping us is that it breaks the workflow of installing your own local builds - you need to sign or use --nosignature to install. For everything else this is 20 years too late already 😅 As the average user is not even affected at all... maybe the folks who build packages can be expected to deal with a little extra configuration to make the rest of the world that much safer.

@pmatilai pmatilai added the RFE label Mar 9, 2021
@DemiMarie
Copy link
Contributor

Rpm actually already verifies signatures if present by default since 4.0 or thereabouts, but it doesn't require them. Enforcing is supported since >= 4.14.2 and we also have the bypass-switch (--nosignature) already, so from strict technical perspective this is just a matter of one line change to turn the policy switch to 11 (%_pkgverify_level all).

The only thing stopping us is that it breaks the workflow of installing your own local builds - you need to sign or use --nosignature to install. For everything else this is 20 years too late already As the average user is not even affected at all... maybe the folks who build packages can be expected to deal with a little extra configuration to make the rest of the world that much safer.

Agreed. Those who build packages can generate their own signing keys. Personally, I would consider being able to disable this on a per-package basis a good idea, but it isn’t a blocker.

@pmatilai
Copy link
Member

Personally, I would consider being able to disable this on a per-package basis a good idea, but it isn’t a blocker.

How is --nosignature failing to achieve that as it is?

@DemiMarie
Copy link
Contributor

Personally, I would consider being able to disable this on a per-package basis a good idea, but it isn’t a blocker.

How is --nosignature failing to achieve that as it is?

It does for rpm(8), but not for dnf(8).

@marmarek
Copy link

A tricky case is when you mix local builds and downloaded packages in a single transaction. For example dnf install ./some-locally-built.rpm when that package requires some extra dependencies to be downloaded and installed. In my specific case, I have a local repository set (with baseurl=file:/// and gpgcheck=0) for packages I want to install from local build, and some (most) require extra dependencies to be downloaded from base (Fedora/CentOS) repositories. At DNF level this configuration is easy, because DNF knows where packages come from. But at RPM level they all looks the same, so requiring all the package be signed breaks this setup.

Signing local builds with some temporary key might workaround the problem, but I see few issues with that:

  1. It requires the key to be generated and appropriately protected. Normally I do keep important signing keys in HSM-like solution, which I don't really want to expose for some "temporary key". Not protecting such key may be fatal, as packages signed with it will be accepted by RPM/DNF, regardless of where they come from (this actually could be improved: to have DNF verify if packages are signed by the key configured for given repo, not just any key).
  2. If the build product includes an rpmdb, there is a risk of leaving this temporary key imported, giving it even more power. This for example affects container images. I guess this is rather rare case (to build a container from local "unsigned" packages), but such side effect may be surprising for some, and have fatal consequences.
  3. It may complicate stuff, if the packages are supposed to be signed later, or even some are already signed with a different key.

I don't have a good solution for this. This mostly seems like an issue of rpm not knowing a package origin. And letting it know that most likely will complicate interface significantly, which we definitely don't want in a security-critical code.
Some solution could be giving rpm a list of package hashes to be excluded from the signature requirement. Then DNF could populate this list based on packages downloaded from gpgcheck=0 repositories. But I'm not sure if that isn't too complex already.

But generally, I think benefits of %_pkgverify_level all by default outweigh the above issues. Having an elegant solution for them would be nice to have, but should not block the change.

@pmatilai pmatilai added the crypto Signatures, keys, hashes and their verification label Sep 14, 2023
@pmatilai pmatilai added the v6 Related to rpm v6 (readiness) label Sep 28, 2023
@github-project-automation github-project-automation bot moved this to Backlog in RPM Nov 8, 2023
@pmatilai pmatilai moved this to Todo in RPM v6 format Nov 8, 2023
@pmatilai pmatilai changed the title Enforce GPG signatures by default RFE: Enforce GPG signatures by default Nov 10, 2023
@pmatilai pmatilai added this to the 6.0.0 alpha milestone Sep 18, 2024
@pmatilai pmatilai removed this from RPM v6 format Sep 18, 2024
@pmatilai pmatilai changed the title RFE: Enforce GPG signatures by default RFE: Enforce OpenPGP signatures by default Feb 14, 2025
pmatilai added a commit to pmatilai/rpm that referenced this issue Feb 14, 2025
This is obviously only an enabler for automatic signing. The other half
of the equation is automatically setting it up, but that's another
ticket (rpm-software-management#3522). This lets us at least manually enable automatic signing in
the test-suite, which in turn is a pre-requisite for enabling enforcing
signature checking by default (rpm-software-management#1573).

Set up auto-signing inside the test-suite throughout, using a freshly
generated key for each run. With the exception of the reproducibility
tests where this would be harmful.

This is a rather primitive thing in this state - ideally the signing would
happen in parallel, but as the signing code relies heavily on macro
manipulation, that's a much bigger task for some other time. Also
I think we'd rather use an rpm specific keyring for the automatic signing,
but that requires further changes to how the signing macros work.

Fixes: rpm-software-management#2678
pmatilai added a commit to pmatilai/rpm that referenced this issue Feb 14, 2025
This is obviously only an enabler for automatic signing. The other half
of the equation is automatically setting it up, but that's another
ticket (rpm-software-management#3522). This lets us at least manually enable automatic signing in
the test-suite, which in turn is a pre-requisite for enabling enforcing
signature checking by default (rpm-software-management#1573).

Set up auto-signing inside the test-suite throughout, using a freshly
generated key for each run. With the exception of the reproducibility
tests where this would be harmful.

This is a rather primitive thing in this state - ideally the signing would
happen in parallel, but as the signing code relies heavily on macro
manipulation, that's a much bigger task for some other time. Also
I think we'd rather use an rpm specific keyring for the automatic signing,
but that requires further changes to how the signing macros work.

Fixes: rpm-software-management#2678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Signatures, keys, hashes and their verification RFE v6 Related to rpm v6 (readiness)
Projects
Status: Backlog
Development

No branches or pull requests

4 participants