Skip to content

Commit 31ff72e

Browse files
committed
separated steps for cent os 10 for different encryption
1 parent ba30283 commit 31ff72e

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
GPG_MAIL: ${{ secrets.LOGGING_GPG_MAIL }}
1414
GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }}
1515
GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
16+
GPG_PRIVATE_KEY_SHA256_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_SHA256_BASE64}} # base64 encoded SHA256 encrypted
1617

1718
jobs:
1819
# Empties the GH pre-release
@@ -108,12 +109,19 @@ jobs:
108109
fi
109110
110111
- name: Download, rename and resign Linux package
111-
if: ${{ steps.download_package_from_nr.outputs.result == 'failure' && matrix.osDistro != 'windows-server' }}
112+
if: ${{ steps.download_package_from_nr.outputs.result == 'failure' && matrix.osDistro != 'windows-server' && !(matrix.osDistro == 'centos' && matrix.osVersion == '10') }}
112113
run: |
113114
curl ${{ matrix.packageUrl }} -o packages/${{ matrix.targetPackageName }}
114115
sudo apt-get install -y debsigs
115116
bash ./scripts/sign.sh
116117
118+
- name: Download, rename and resign Cent OS version 10 package # requires SHA 256 signing
119+
if: ${{ steps.download_package_from_nr.outputs.result == 'failure' && matrix.osDistro == 'centos' && matrix.osVersion == '10' }}
120+
run: |
121+
curl ${{ matrix.packageUrl }} -o packages/${{ matrix.targetPackageName }}
122+
sudo apt-get install -y debsigs
123+
bash ./scripts/sign_centos_10.sh
124+
117125
- name: Download and re-zip Windows package
118126
if: ${{ steps.download_package_from_nr.outputs.result == 'failure' && matrix.osDistro == 'windows-server' }}
119127
run: |

scripts/sign_centos_10.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
#
4+
#
5+
#
6+
# Sign RPM's & DEB's in /packages to GH Release Assets
7+
#
8+
#
9+
#
10+
11+
# Sign RPM's
12+
echo "===> Create .rpmmacros to sign rpm"
13+
echo "%_gpg_name ${GPG_MAIL}" >> ~/.rpmmacros
14+
echo "%_signature gpg" >> ~/.rpmmacros
15+
echo "%_gpg_path /home/runner/.gnupg" >> ~/.rpmmacros
16+
echo "%_gpgbin /usr/bin/gpg" >> ~/.rpmmacros
17+
echo "%__gpg_sign_cmd %{__gpg} gpg --no-verbose --no-armor --batch --pinentry-mode loopback --passphrase ${GPG_PASSPHRASE} --no-secmem-warning -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}" >> ~/.rpmmacros
18+
19+
echo "===> Importing GPG private key from GHA secrets..."
20+
printf %s ${GPG_PRIVATE_KEY_SHA256_BASE64} | base64 -d | gpg --batch --import -
21+
22+
echo "===> Importing GPG signature, needed to verify signature"
23+
gpg --export -a ${GPG_MAIL} > /tmp/RPM-GPG-KEY-${GPG_MAIL}
24+
rpm --import /tmp/RPM-GPG-KEY-${GPG_MAIL}
25+
26+
cd packages
27+
28+
for rpm_file in $(find -regex ".*\.\(rpm\)");do
29+
echo "===> Signing $rpm_file"
30+
rpm --addsign $rpm_file
31+
echo "===> Sign verification $rpm_file"
32+
rpm -v --checksig $rpm_file
33+
done
34+
35+
# Sign DEB's
36+
GNUPGHOME="/home/runner/.gnupg"
37+
echo "${GPG_PASSPHRASE}" > "${GNUPGHOME}/gpg-passphrase"
38+
echo "passphrase-file ${GNUPGHOME}/gpg-passphrase" >> "$GNUPGHOME/gpg.conf"
39+
echo 'allow-loopback-pinentry' >> "${GNUPGHOME}/gpg-agent.conf"
40+
echo 'pinentry-mode loopback' >> "${GNUPGHOME}/gpg.conf"
41+
echo 'use-agent' >> "${GNUPGHOME}/gpg.conf"
42+
echo RELOADAGENT | gpg-connect-agent
43+
44+
for deb_file in $(find -regex ".*\.\(deb\)");do
45+
echo "===> Signing $deb_file"
46+
debsigs --sign=origin --verify --check -v -k ${GPG_MAIL} $deb_file
47+
done

versions/centos_10.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
osDistro: centos
2+
osVersion: 10
3+
packages:
4+
- arch: x86_64
5+
ami: ami-000a52d5ade2eab02
6+
- arch: aarch64
7+
ami: ami-005298a5e9fac3bb4

0 commit comments

Comments
 (0)