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:
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.
Can you file this upstream at https://github.com/ansible/ansible/issues/ ? Or if you like I can do so...
(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.
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.
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.
Just for reference, this is the upstream report https://github.com/ansible/ansible/issues/43624 mentioned in comment 3.