Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 66eb672

Browse files
committed
Fix gpg signature verification
This fixes gpg signature verification to not rely on the key servers (without just blindly trusting the TLS connection to Keybase). The PGP key is downloaded from keybase and it is verified that the key fingerprint matches the correct fingerprint. Relying on the key servers caused flakey builds in some cases.
1 parent a17d8cb commit 66eb672

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

docker/Dockerfile-ca

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ WORKDIR /home/keybase
1313
# Key fingerprint from https://keybase.io/docs/server_security/our_code_signing_key
1414
RUN curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
1515
RUN curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb.sig
16-
RUN gpg --keyserver pgp.mit.edu --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7" || \
17-
gpg --keyserver keyserver.pgp.com --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7" || \
18-
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7"
16+
# GPG has no easy way of getting the ID associated with a key, so we do this :(
17+
# This line will error if the fingerprint of the key in the file does not match
18+
# Key fingerprint from https://keybase.io/docs/server_security/our_code_signing_key
19+
# Note that we do it this way rather than via the key servers since pulling from the
20+
# key servers caused a flakey build
21+
RUN gpg --with-colons --fingerprint $( \
22+
curl -sSL https://keybase.io/docs/server_security/code_signing_key.asc | \
23+
gpg --import 2>&1 | \
24+
grep -v created | \
25+
head -n 1 | \
26+
cut -d ' ' -f 3 | \
27+
cut -d ':' -f 1 \
28+
) | grep fpr | cut -d ':' -f 10 | grep 222B85B0F90BE2D24CFEB93F47484E50656D16C7
1929
RUN gpg --verify keybase_amd64.deb.sig keybase_amd64.deb
2030

2131
# Silence the error from dpkg about failing to configure keybase since `apt-get install -f` fixes it

integrationTest.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ if [ -z "$CIRCLECI" ]; then
1717
cd ../
1818
fi
1919

20-
2120
# Ensure we have the correct environment variables
2221
if [[ -f "tests/env.sh" ]]; then
2322
echo "env.sh already exists, skipping configuring new accounts..."

tests/Dockerfile-kssh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ USER keybase
1010
WORKDIR /home/keybase
1111

1212
# Download and verify the deb
13-
# Key fingerprint from https://keybase.io/docs/server_security/our_code_signing_key
1413
RUN curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
1514
RUN curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb.sig
16-
RUN gpg --keyserver pgp.mit.edu --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7" || \
17-
gpg --keyserver keyserver.pgp.com --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7" || \
18-
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "222B85B0F90BE2D24CFEB93F47484E50656D16C7"
15+
# GPG has no easy way of getting the ID associated with a key, so we do this :(
16+
# This line will error if the fingerprint of the key in the file does not match
17+
# Key fingerprint from https://keybase.io/docs/server_security/our_code_signing_key
18+
# Note that we do it this way rather than via the key servers since pulling from the
19+
# key servers caused a flakey build
20+
RUN gpg --with-colons --fingerprint $( \
21+
curl -sSL https://keybase.io/docs/server_security/code_signing_key.asc | \
22+
gpg --import 2>&1 | \
23+
grep -v created | \
24+
head -n 1 | \
25+
cut -d ' ' -f 3 | \
26+
cut -d ':' -f 1 \
27+
) | grep fpr | cut -d ':' -f 10 | grep 222B85B0F90BE2D24CFEB93F47484E50656D16C7
1928
RUN gpg --verify keybase_amd64.deb.sig keybase_amd64.deb
2029

2130
# Silence the error from dpkg about failing to configure keybase since `apt-get install -f` fixes it

0 commit comments

Comments
 (0)