Bug 1362452

Summary: localpkg_gpgcheck=True by default
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: diakkaml, emailtoflorian, extras-qa, fedora, jmracek, jsilhan, lantw44, mluscon, packaging-team-maint, pnemade, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Security, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1297087 Environment:
Last Closed: 2016-08-08 11:13:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1297087    
Bug Blocks:    

Description Igor Gnatenko 2016-08-02 08:46:03 UTC
+++ This bug was initially created as a clone of Bug #1297087 +++

Description of problem:
dnf is not checking gpg signature for local packages or packages specified by URL

Version-Release number of selected component (if applicable):
1.1.5-1.fc23

How reproducible:
Every Time

Steps to Reproduce:
1. dnf install http://rpm.livna.org/livna-release.rpm
#this should fail as I did not install the livna gpg key

2. dnf install --downloadonly patch
#dnf downloads patch-2.7.5-2.fc23.x86_64.rpm
3. echo hello >> /var/cache/dnf/fedora-fe3d2f0c91e9b65c/packages/patch-2.7.5-2.fc23.x86_64.rpm
#this will corrupt the package making the signature bad
4. rpm -K /var/cache/dnf/fedora-fe3d2f0c91e9b65c/packages/patch-2.7.5-2.fc23.x86_64.rpm 
#/var/cache/dnf/fedora-fe3d2f0c91e9b65c/packages/patch-2.7.5-2.fc23.x86_64.rpm: #rsa sha1 (MD5) PGP MD5 NOT OK
5. dnf install /var/cache/dnf/fedora-fe3d2f0c91e9b65c/packages/patch-2.7.5-2.fc23.x86_64.rpm 
#dnf installs the package without realizing the package has been corrupted.

Actual results:
dnf installed both the livna package and the corrupted patch package without complaint

Expected results:
dnf should find the GPG signatures to be invalid and refuse to install the package without a --nogpgcheck flag

Additional info:
Fedora documentation states that local packages should also be checked when gpgcheck=1 in dnf.conf:

https://docs.fedoraproject.org/en-US/Fedora/23/html/System_Administrators_Guide/sec-Configuring_DNF_and_DNF_Repositories.html

--- Additional comment from Jan Silhan on 2016-01-11 08:28:54 EST ---

We'll take a look.

--- Additional comment from Fedora Admin XMLRPC Client on 2016-07-08 05:37:22 EDT ---

This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

--- Additional comment from Christian Stadelmann on 2016-07-24 06:03:49 EDT ---

How can a security bug, which also is a regression to yum AFAIK, have low severity and low priority?

--- Additional comment from Jan Kurik on 2016-07-26 01:02:46 EDT ---

This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

--- Additional comment from Jaroslav Mracek on 2016-08-01 06:49:20 EDT ---

According to my investigation, the behavior of DNF with gpgcheck of local messages is identical to YUM. Please let me know if I overlooked something.

--- Additional comment from Jaroslav Mracek on 2016-08-01 08:38:14 EDT ---

Thank you very much for report of documentation difference from preset dnf behavior. We will change it according to current behavior.

We know that security is important part of package distribution, but there is supported way - repository with only signed rpms. Repositories also solve a problem of gpg-keys distribution and checksum of metadata. To create repository, createrepo_c package can be used and repositories can be remote as well local. 

With gpgcheck for local packages or remote packages outside of repository many users can have difficulties with new behavior of DNF, therefore I think due to existing solution that this bug report I can close a notbug. If you will experience any further problem, please report it.

--- Additional comment from Jaroslav Mracek on 2016-08-01 11:02:34 EDT ---

The yum has an option 'localpkg_gpgcheck' that provides requested behavior. It change the situation.

--- Additional comment from Jaroslav Mracek on 2016-08-02 03:42:09 EDT ---

The option 'localpkg_gpgcheck' was already implemented in DNF, but it is not in documentation. It is going to be change by new pull-request.

https://github.com/rpm-software-management/dnf/pull/554

If you want to use gpgcheck for local packages, you have to add "localpkg_gpgcheck=1" into /etc/dnf/dnf.conf file. Have a fun with it.

Comment 1 Igor Gnatenko 2016-08-08 11:13:53 UTC
doesn't make sense