Skip to content

Commit 4a75160

Browse files
committed
Download public keys by fingerprint in travis
The uid and fingerprint are more legible than the full key, which should make future changes easier to review. The keys are used by Travis only to validate that a git tag was signed with a recognised key. The results of the build are signed separately. You can confirm the fingerprints in .travis.yml match the ones in the by running this on the old packaging/gpg.keys: gpg --import-options show-only --import packaging/gpg.keys
1 parent 180b4c9 commit 4a75160

File tree

4 files changed

+69
-68
lines changed

4 files changed

+69
-68
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ before_install:
2323
# Decrypt our private files for CI use only
2424
- eval "$(ssh-agent -s)"
2525
- ./.travis/decrypt-if-have-key df4daddc19fe
26+
- export KEYSERVER=pool.sks-keyservers.net
2627
#
2728
# Run
2829
before_script:
29-
- gpg --import packaging/gpg.keys
30+
# Download keys - builds of tags check for a recognised signature
31+
- ./packaging/gpg-recv-key [email protected] "9CCE 9A8D 5328 FBD6 CE29 6DCC 63DF 1E44 D829 797E"
32+
- ./packaging/gpg-recv-key [email protected] "4DFF 624A E564 3B51 2872 1F40 29CA 3358 89B9 A863"
3033
# Run the commit hooks in case the developer didn't
3134
- git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | ./packaging/check-files -
3235
script:

packaging/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ and post-release update.
1818
Programs and packages with specific needs should create extra
1919
`whatever.functions` and supporting scripts in a subdirectory.
2020

21-
The `gpg.keys` file is a list of keys that can be expected to sign
22-
tags and packages.
2321

2422
Making a release
2523
----------------

packaging/gpg-recv-key

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/sh
2+
3+
if [ ! "$KEYSERVER" ]
4+
then
5+
echo "No KEYSERVER environment set, e.g.:"
6+
echo " export KEYSERVER=hkps://hkps.pool.sks-keyservers.net"
7+
exit 1
8+
fi
9+
10+
debug=""
11+
if [ "$debug" ]
12+
then
13+
if [ ! "$GNUPGHOME" ]
14+
then
15+
echo "No GNUPGHOME environment set, e.g.:"
16+
echo " export GNUPGHOME=$HOME/.gnupg"
17+
exit 1
18+
fi
19+
20+
if [ ! -d "$GNUPGHOME" ]
21+
then
22+
mkdir -p "$GNUPGHOME"
23+
chmod 700 "$GNUPGHOME"
24+
fi
25+
fi
26+
27+
keyuid="$1"
28+
fingerprint="$2"
29+
30+
# Modern GPG can import key by fingerprint but the version available
31+
# within travis currently does not, so we extract the short version and
32+
# check it matches manually
33+
key=`echo $fingerprint | cut -f7-10 -d' ' | tr -d ' '`
34+
35+
gpg --keyserver "$KEYSERVER" --recv-key "$key" || exit 1
36+
gpg --fingerprint "$key" > /tmp/keystatus.$$
37+
status=$?
38+
39+
cat /tmp/keystatus.$$
40+
if [ $status -ne 0 ]
41+
then
42+
rm -f /tmp/keystatus.$$
43+
exit 2
44+
fi
45+
46+
if ! grep -q "^uid.*<$keyuid>" /tmp/keystatus.$$
47+
then
48+
rm -f /tmp/keystatus.$$
49+
echo "Did not find expected uid $keyuid"
50+
exit 3
51+
fi
52+
53+
echo "uid looks good"
54+
55+
if ! grep -q " $fingerprint$" /tmp/keystatus.$$
56+
then
57+
rm -f /tmp/keystatus.$$
58+
echo "Did not find expected fingerprint $fingerprint"
59+
exit 3
60+
fi
61+
62+
echo "Fingerprint looks good"
63+
64+
rm -f /tmp/keystatus.$$
65+
exit 0

packaging/gpg.keys

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)