While Red Hat Enterprise Linux 9 (RHEL 9) deprecated SHA-1 for signing for security reasons, it is still used by many for signing packages. In this article, I’ll go over some typical problems users may face with Fedora SHA-1 status (including some possible workarounds), and how you can update your infrastructure to use a more secure SHA-256.
Infra mistakes → user struggles
While the default security policy might refuse SHA-1 all over the system, the problem we’re addressing today looks like this:
# dnf install package-name -y Dependencies resolved. ============================================================= Package Arch Version Repository Size ============================================================= Installing: package-name x86_64 1-1.el9 repoName 3.0 k Transaction Summary ============================================================= Install 1 Package Total size: 3.0 k Installed size: 21 Downloading Packages: [SKIPPED] package-name-1-1.el9.x86_64.rpm: Already downloaded warning: Signature not supported. Hash algorithm SHA1 not available. Problem opening package package-name-1-1.el9.x86_64.rpm The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. Error: GPG check FAILED
Per the warning/error above, DNF on RHEL 9 refuses to install the package. DNF is told to check signatures (DNF configuration gpgcheck=1) but the package signature hash algorithm is SHA-1. RPM is forbidden to even check it on the system-level crypto layer.
Can this happen on RHEL 8 or older?
No, at least not by default. The packaging stack on RHEL 8 (and older) accepts SHA-1 signatures without complaints. Potential problems can occur during in-place upgrades from RHEL 8 to the RHEL 9 system. Please pay attention to the warnings issued by LEAPP.
Preparation for this crypto policy change started on RHEL 8. If you want to experiment on RHEL 8, you can bring the configuration from the future RHEL with:
# update-crypto-policies --set FUTURE
Why are packages signed by SHA-1 in 2022?
The official packages for RHEL and Fedora have been signed with SHA-256 for a very long time (all the currently supported distribution versions).
The problem is with third-party packages. SHA-1 is the default hash algorithm for the rpmsign utility on RHEL 7. Also, the default hash algorithm in OBS signd is still SHA-1. So third-party package providers might still unconsciously use SHA-1 signatures.
State of Fedora SHA-1 deprecation
In this case, RHEL has been moved forward earlier than Fedora. At the time of RHEL 9 release, the latest release of Fedora was version 36. At the time of writing this post, Fedora’s policy switch is planned for Fedora 39 (about +18 months after the RHEL 9 release). Still, if you want to experiment with such a setup on Fedora, there exists a special policy (Fedora 36+):
# update-crypto-policies --set TEST-FEDORA39 Setting system policy to TEST-FEDORA39 Note: System-wide crypto policies are applied on application start-up. It is recommended to restart the system for the change of policies to fully take place.
The expected failure can then be tested with:
# curl https://copr-be.cloud.fedoraproject.org/archive/2022-07-18-blogpost-sha1/test.repo > /etc/yum.repos.d/test.repo # dnf install dummy-pkg ... Importing GPG key 0xFCFBE669: ... Key imported successfully Import of key(s) didn't help, wrong key(s)? Problem opening package dummy-pkg-20220622_1500-1.el7.x86_64.rpm. Failing package is: dummy-pkg-20220622_1500-1.el7.x86_64 GPG Keys are configured as: https://copr-be.cloud.fedoraproject.org/archive/2022-07-18-blogpost-sha1/pubkey.gpg The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. Error: GPG check FAILED
How am I supposed to sign packages, then?
Please switch to SHA-256 (or SHA-512). With the rpmsign utility, one option is to move the signing host to a newer distro than RHEL 7.
One can also modify the %__gpg_sign_cmd
macro (copy-pasted from the /usr/lib/rpm/macros
file) so it contains the --digest-algo sha256
option. This can be done in the ~/.rpmmacros
file:
%__gpg_sign_cmd %{__gpg} \ gpg --batch --no-verbose --no-armor --passphrase-fd 3 \ %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \ --no-secmem-warning \ --digest-algo sha256 \ -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
For more info take a look at signing KB article. With OBS signd, there’s sign -h sha256
option.
I still want to install SHA-1 signed packages!
This is discouraged. Even a signature from a years old RPM could be hacked recently by an attacker. If you really know what you are doing, there’s a possibility to use dnf --nogpgcheck option.
Alternatively you can also switch to the legacy crypto policy:
update-crypto-policies --set LEGACY
Or explicitly allow the SHA-1:
update-crypto-policies --set DEFAULT:SHA1
But please don’t forget to switch back, e.g.:
update-crypto-policies --set DEFAULT
Next steps
Now you know how to install SHA-1 signed packages (when really necessary and you understand the security consequences). But please don’t forget to report to your software provider that the SHA-1 problem exists!
From the other side, administrators, please fix your infrastructure. Make the SW distribution chain fluent again. Then forget about this post.
Sull'autore
Altri risultati simili a questo
Ricerca per canale
Automazione
Novità sull'automazione IT di tecnologie, team e ambienti
Intelligenza artificiale
Aggiornamenti sulle piattaforme che consentono alle aziende di eseguire carichi di lavoro IA ovunque
Hybrid cloud open source
Scopri come affrontare il futuro in modo più agile grazie al cloud ibrido
Sicurezza
Le ultime novità sulle nostre soluzioni per ridurre i rischi nelle tecnologie e negli ambienti
Edge computing
Aggiornamenti sulle piattaforme che semplificano l'operatività edge
Infrastruttura
Le ultime novità sulla piattaforma Linux aziendale leader a livello mondiale
Applicazioni
Approfondimenti sulle nostre soluzioni alle sfide applicative più difficili
Serie originali
Raccontiamo le interessanti storie di leader e creatori di tecnologie pensate per le aziende
Prodotti
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Servizi cloud
- Scopri tutti i prodotti
Strumenti
- Formazione e certificazioni
- Il mio account
- Supporto clienti
- Risorse per sviluppatori
- Trova un partner
- Red Hat Ecosystem Catalog
- Calcola il valore delle soluzioni Red Hat
- Documentazione
Prova, acquista, vendi
Comunica
- Contatta l'ufficio vendite
- Contatta l'assistenza clienti
- Contatta un esperto della formazione
- Social media
Informazioni su Red Hat
Red Hat è leader mondiale nella fornitura di soluzioni open source per le aziende, tra cui Linux, Kubernetes, container e soluzioni cloud. Le nostre soluzioni open source, rese sicure per un uso aziendale, consentono di operare su più piattaforme e ambienti, dal datacenter centrale all'edge della rete.
Seleziona la tua lingua
Red Hat legal and privacy links
- Informazioni su Red Hat
- Opportunità di lavoro
- Eventi
- Sedi
- Contattaci
- Blog di Red Hat
- Diversità, equità e inclusione
- Cool Stuff Store
- Red Hat Summit