Bug 1611323 - Ansible DNF module fails to do GPG checking
Summary: Ansible DNF module fails to do GPG checking
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: ansible
Version: 28
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-02 08:38 UTC by Unto Sten
Modified: 2020-08-14 15:00 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-05-28 22:02:17 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Unto Sten 2018-08-02 08:38:16 UTC
Description of problem:

Ansible DNF module installs RPM packages without GPG verification even though DNF is configured to do checking on the server side. Settings in the server /etc/dnf/dnf.conf:

gpgcheck=1
localpkg_gpgcheck=1

do not help. Ansible module calls Python 2 DNF library base.py package_install() function and the packages are never verified. Unfortunattely base.py API does not expose a verification function.

As a proof of concept, I wrote one:

 def package_verify(self, pkg):
        result, errormsg = self._sig_check_pkg(pkg)
        if result == 0:
            return (result, None)
        else:
            logger.critical(errormsg)
            return result, errormsg 

And called it from Ansible DNF module. It worked.

Version-Release number of selected component (if applicable):

2.6.1

How reproducible:

Always

Steps to Reproduce:
1. Use Ansible DNF module to install signed RPM
2. Observe how RPM gets installed
3.

Actual results:

RPMs got installed even though they were signed and the corresponding public key was NOT installed on the server.

Expected results:

GPG verification should work. this could be very bad indeed as many people use Ansible. Attackers could inject malicious RPMs via Ansible DNF module.

Additional info:

Comment 1 Unto Sten 2018-08-02 08:41:27 UTC
To be clear: This bug occurs only when you upload RPM packages to server and ask Ansible DNF module to install them from the filesystem.

Comment 2 Kevin Fenzi 2018-08-02 21:16:35 UTC
Can you file this upstream at https://github.com/ansible/ansible/issues/ ?

Or if you like I can do so...

Comment 3 Unto Sten 2018-08-03 04:17:48 UTC
(In reply to Kevin Fenzi from comment #2)
> Can you file this upstream at https://github.com/ansible/ansible/issues/ ?
> 
> Or if you like I can do so...

Yes, I just filed a bug report. But I suppose this could require co-operation with python-dnf library maintainers. I had no time study the library for more than a few hours, but the library may need fixing as callers have no way to verify RPMs, as far as I can tell. 

Using CLI, verification works when localpkg_checkgpg=1.

You see, I am currently working on building a very secure server environment, and was shocked to find unverified RPMs getting installed via Ansible. This is not good.

Yes, it is true that you need root rights to install RPMs, but root may not be the *creator* of the RPMs. So he or she trusts that only signed and verified RPMs will get in, but this assumption turns out to be wrong.

Comment 4 Ben Cotton 2019-05-02 21:12:28 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2019-05-28 22:02:17 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Georg Sauthoff 2020-08-14 15:00:56 UTC
Just for reference, this is the upstream report https://github.com/ansible/ansible/issues/43624 mentioned in comment 3.


Note You need to log in before you can comment on or make changes to this bug.