Skip to content

Commit 5bfe33f

Browse files
committed
Implement GPG verification of autotools tarballs
1 parent d094e58 commit 5bfe33f

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fping 5.5-rc1 (2025-12-21)
4343
- Updated autoconf from 2.71 to 2.72
4444
- Updated automake from 1.16.5 to 1.18.1
4545
- Updated libtool from 2.4.6 to 2.5.4
46+
- Implemented verification of autotools tarballs in Github actions.
4647

4748
fping 5.4 (2025-04-19)
4849
======================

ci/build-1-autotools.sh

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ fi
1010
# We keep our own list of mirrors because https://ftpmirror.gnu.org is
1111
# unreliable (frequent errors from selected mirror).
1212
MIRRORS=(
13-
https://mirror.cs.odu.edu/gnu
1413
https://mirrors.ocf.berkeley.edu/gnu
14+
https://mirror.cs.odu.edu/gnu
1515
https://ftp.gnu.org/gnu
1616
)
1717

@@ -21,6 +21,7 @@ LIBTOOL_REL=libtool/libtool-2.5.4.tar.gz
2121

2222
PREFIX=$(pwd)/ci/build
2323
PATH=$(pwd)/ci/build/bin:$PATH
24+
KEYRING=$(pwd)/ci/fping-deps.gpg
2425

2526
if [ ! -d ci ]; then
2627
echo "you must run this in the root fping directory" >&2
@@ -30,38 +31,53 @@ fi
3031
# remove standard versions
3132
sudo apt-get remove -qq autoconf automake autotools-dev libtool
3233

34+
# install dependencies
35+
sudo apt-get install -y gpgv
36+
3337
# prepare build environment
3438
cd ci
3539
rm -rf build
3640
mkdir -p build/src
3741
cd build/src
3842

39-
install_release() {
40-
local relpath=$1
41-
local file=$(basename "$relpath")
42-
local dir="${file%%.tar.*}"
43-
44-
local success=0
43+
mirror_fetch() {
44+
local relpath="$1"
4545
for mirror in "${MIRRORS[@]}"; do
4646
local url="$mirror/$relpath"
47-
if wget -t 3 -O "$file" "$url"; then
48-
success=1
49-
break
47+
if wget -t 3 "$url"; then
48+
return 0
5049
fi
5150
done
51+
return 1
52+
}
53+
54+
install_release() {
55+
local relpath="$1"
56+
local file=$(basename "$relpath")
57+
local dir="${file%%.tar.*}"
5258

53-
if [ $success -eq 0 ]; then
59+
if ! mirror_fetch "$relpath"; then
5460
echo "Failed to download $relpath from any mirror" >&2
5561
exit 1
5662
fi
5763

64+
if ! mirror_fetch "$relpath.sig"; then
65+
echo "Failed to download $relpath.sig from any mirror" >&2
66+
exit 1
67+
fi
68+
69+
if ! gpgv --keyring "$KEYRING" "$file.sig" "$file"; then
70+
echo "GPG verification failed for $file"
71+
exit 1
72+
fi
73+
5874
tar xf "$file"
5975
(
6076
cd "$dir"
6177
./configure --prefix=$PREFIX
6278
make install
6379
)
64-
rm "$file"
80+
rm "$file" "$file.sig"
6581
}
6682

6783
# autoconf

ci/fping-deps.gpg

15 KB
Binary file not shown.

ci/update-keyring.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Configuration
6+
GNU_KEYRING_URL="https://ftp.gnu.org/gnu/gnu-keyring.gpg"
7+
TMP_KEYRING="gnu-keyring.gpg"
8+
OUTPUT_KEYRING="ci/fping-deps.gpg"
9+
10+
# Maintainer emails to extract their keys from the GNU keyring.
11+
MAINTAINER_EMAILS=(
12+
"zackw@panix.com" # Autoconf: Zack Weinberg
13+
"karl@freefriends.org" # Automake: Karl Berry
14+
"ileanadumi95@protonmail.com" # Libtool: Ileana Dumitrescu
15+
)
16+
17+
# Step 1: Initialize an isolated environment to avoid side effects.
18+
export GNUPGHOME="$(mktemp -d)"
19+
chmod 700 "$GNUPGHOME"
20+
echo "Initialized isolated GNUPGHOME at $GNUPGHOME"
21+
cleanup() {
22+
rm -rf "$GNUPGHOME"
23+
rm -f "$TMP_KEYRING"
24+
echo "Cleaned up."
25+
}
26+
trap cleanup EXIT
27+
28+
# Step 2: Download the official GNU Keyring (relies on https certificate checking).
29+
echo "Downloading GNU Keyring from $GNU_KEYRING_URL"...
30+
wget -q -O "$TMP_KEYRING" "$GNU_KEYRING_URL"
31+
32+
# Step 3: Extract the specific keys we need.
33+
echo "Extracting maintainer keys from GNU Keyring..."
34+
for EMAIL in "${MAINTAINER_EMAILS[@]}"; do
35+
# Verify that the key exists in the keyring
36+
if ! gpg --no-default-keyring --keyring "./$TMP_KEYRING" --list-keys "$EMAIL" > /dev/null 2>&1; then
37+
echo "Error: No key found for $EMAIL in GNU Keyring!"
38+
exit 1
39+
fi
40+
echo "Found key(s) for $EMAIL"
41+
done
42+
43+
# Export specific keys to our project keyring.
44+
gpg --no-default-keyring --keyring "./$TMP_KEYRING" --export \
45+
"${MAINTAINER_EMAILS[@]}" \
46+
> "$OUTPUT_KEYRING"
47+
48+
echo "Success! Updated $OUTPUT_KEYRING with keys from the official GNU Keyring."

0 commit comments

Comments
 (0)