Skip to content

Commit 1aec007

Browse files
committed
Include GPG keys in katello-repos and check for non-nightly
Including the GPG keys is better because it gives a higher degree of trust because the RPM is GPG signed. It also helps because dnf doesn't refresh HTTPS URLs and purging old entries is tedious. While the repos aren't typically installed that long, I've had it happen to me with one of my personal COPR repositories. The downside is that after branching you need to update the GPG key in the repository. It also makes GPG key checking correct by looking at the correct values. This allows enabling GPG for candlepin (which is using a signed release) while not enabling it for Pulp or Katello (which are nightly).
1 parent ceb00a9 commit 1aec007

3 files changed

Lines changed: 27 additions & 7 deletions

File tree

packages/katello/katello-repos/katello-repos.spec

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
%global prereleasesource nightly
88
%global prerelease %{?prereleasesource:.}%{?prereleasesource}
9-
%global release 2
9+
%global release 4
1010

1111
Name: katello-repos
1212
Version: 4.14
@@ -18,6 +18,7 @@ License: GPLv2
1818
URL: https://theforeman.org/plugins/katello/
1919
Source0: katello.repo
2020
Source1: candlepin.gpg
21+
Source2: pulpcore.gpg
2122

2223
BuildArch: noarch
2324

@@ -41,6 +42,7 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/pki/rpm-gpg/
4142

4243
install -m 644 %{SOURCE0} %{buildroot}%{repo_dir}/
4344
install -Dpm0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-candlepin
45+
install -Dpm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-pulpcore
4446

4547
if [[ '%{release}' == *"nightly"* ]];then
4648
REPO_VERSION='nightly'
@@ -53,6 +55,18 @@ else
5355
REPO_GPGCHECK=1
5456
fi
5557

58+
if [[ '%{pulpcore_version}' == nightly ]] ; then
59+
PULPCORE_REPO_GPGCHECK=0
60+
else
61+
PULPCORE_REPO_GPGCHECK=1
62+
fi
63+
64+
if [[ '%{candlepin_version}' == nightly ]] ; then
65+
CANDLEPIN_REPO_GPGCHECK=0
66+
else
67+
CANDLEPIN_REPO_GPGCHECK=1
68+
fi
69+
5670
for repofile in %{buildroot}%{repo_dir}/*.repo; do
5771
trimmed_dist=`echo %{repo_dist} | sed 's/^\.//'`
5872
sed -i "s/@DIST@/${trimmed_dist}/" $repofile
@@ -61,7 +75,9 @@ for repofile in %{buildroot}%{repo_dir}/*.repo; do
6175
sed -i "s/@REPO_NAME@/${REPO_NAME}/" $repofile
6276
sed -i "s/@REPO_GPGCHECK@/${REPO_GPGCHECK}/" $repofile
6377
sed -i "s/@PULPCORE_VERSION@/%pulpcore_version/" $repofile
78+
sed -i "s/@PULPCORE_REPO_GPGCHECK@/${PULPCORE_REPO_GPGCHECK}/" $repofile
6479
sed -i "s/@CANDLEPIN_VERSION@/%candlepin_version/" $repofile
80+
sed -i "s/@CANDLEPIN_REPO_GPGCHECK@/${CANDLEPIN_REPO_GPGCHECK}/" $repofile
6581
done
6682

6783
%clean
@@ -73,6 +89,10 @@ rm -rf %{buildroot}
7389
%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-candlepin
7490

7591
%changelog
92+
* Thu Aug 15 2024 Ewoud Kohl van Wijngaarden <[email protected]> - 4.14-0.3.nightly
93+
- Include all GPG keys in the repo file itself
94+
- Consistently enable GPG checking only on non-nightly
95+
7696
* Mon Jun 03 2024 Evgeni Golov - 4.14-0.2.nightly
7797
- Update Candlepin 4.4 key
7898

packages/katello/katello-repos/katello.repo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ name=Candlepin: an open source entitlement management system.
1515
baseurl=https://yum.theforeman.org/candlepin/@CANDLEPIN_VERSION@/@DIST@/$basearch/
1616
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-candlepin
1717
enabled=1
18-
gpgcheck=@REPO_GPGCHECK@
18+
gpgcheck=@CANDLEPIN_REPO_GPGCHECK@
1919

2020
[pulpcore]
2121
name=pulpcore: Fetch, Upload, Organize, and Distribute Software Packages.
2222
baseurl=https://yum.theforeman.org/pulpcore/@PULPCORE_VERSION@/@DIST@/$basearch/
23-
gpgkey=https://yum.theforeman.org/pulpcore/@PULPCORE_VERSION@/GPG-RPM-KEY-pulpcore
23+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-pulpcore
2424
enabled=1
25-
gpgcheck=@REPO_GPGCHECK@
25+
gpgcheck=@PULPCORE_REPO_GPGCHECK@
2626

2727
# source repositories
2828

@@ -38,11 +38,11 @@ name=Katello Candlepin source
3838
baseurl=https://yum.theforeman.org/candlepin/@REPO_VERSION@/@DIST@/source/
3939
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-candlepin
4040
enabled=0
41-
gpgcheck=@REPO_GPGCHECK@
41+
gpgcheck=@CANDLEPIN_REPO_GPGCHECK@
4242

4343
[pulpcore-source]
4444
name=pulpcore source
4545
baseurl=https://yum.theforeman.org/pulpcore/@PULPCORE_VERSION@/@DIST@/source/
46-
gpgkey=https://yum.theforeman.org/pulpcore/@PULPCORE_VERSION@/GPG-RPM-KEY-pulpcore
46+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-pulpcore
4747
enabled=0
48-
gpgcheck=@REPO_GPGCHECK@
48+
gpgcheck=@PULPCORE_REPO_GPGCHECK@

packages/katello/katello-repos/pulpcore.gpg

Whitespace-only changes.

0 commit comments

Comments
 (0)