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.
저자 소개
유사한 검색 결과
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.