2012-02-12 10:04:59 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-10-19 03:47:12 -05:00
|
|
|
set -e
|
|
|
|
|
2012-02-12 15:42:01 -06:00
|
|
|
export LANG=C
|
|
|
|
|
2012-02-12 10:04:59 -06:00
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
trap "rm -rf '${TMPDIR}'" EXIT
|
|
|
|
|
2012-04-07 11:38:26 -05:00
|
|
|
KEYSERVER='hkp://pool.sks-keyservers.net'
|
2019-08-05 16:16:04 -05:00
|
|
|
GPG=(gpg --homedir "${TMPDIR}")
|
|
|
|
|
|
|
|
cat << __EOF__ > "${TMPDIR}"/gpg.conf
|
|
|
|
quiet
|
|
|
|
batch
|
|
|
|
no-tty
|
|
|
|
no-permission-warning
|
2019-08-05 16:25:45 -05:00
|
|
|
export-options no-export-attributes,export-clean
|
2019-08-05 16:16:04 -05:00
|
|
|
keyserver ${KEYSERVER}
|
2019-08-05 16:30:35 -05:00
|
|
|
armor
|
|
|
|
no-emit-version
|
2019-08-05 16:16:04 -05:00
|
|
|
__EOF__
|
2012-02-12 10:04:59 -06:00
|
|
|
|
2019-08-05 16:47:41 -05:00
|
|
|
cd "$(dirname "$0")"
|
2012-02-12 15:42:01 -06:00
|
|
|
|
2019-08-05 16:05:17 -05:00
|
|
|
"${GPG[@]}" --gen-key <<EOF
|
2019-01-23 16:12:15 -06:00
|
|
|
%echo Generating Arch Linux keyring temporary master key...
|
2012-02-12 15:42:01 -06:00
|
|
|
Key-Type: RSA
|
2019-01-23 16:12:15 -06:00
|
|
|
Key-Length: 2048
|
2012-02-12 15:42:01 -06:00
|
|
|
Key-Usage: sign
|
2019-01-23 16:12:15 -06:00
|
|
|
Name-Real: Arch Linux keyring temporary master key
|
2012-02-12 15:42:01 -06:00
|
|
|
Name-Email: archlinux-keyring@localhost
|
|
|
|
Expire-Date: 0
|
2015-02-07 03:28:34 -06:00
|
|
|
%no-protection
|
2012-02-12 15:42:01 -06:00
|
|
|
%commit
|
|
|
|
%echo Done
|
|
|
|
EOF
|
|
|
|
|
2019-08-05 16:05:17 -05:00
|
|
|
"${GPG[@]}" --import < archlinux.gpg
|
2019-01-23 03:27:58 -06:00
|
|
|
|
2017-03-20 14:40:37 -06:00
|
|
|
rm -rf master{,-revoked} packager{,-revoked} archlinux-{trusted,revoked}
|
|
|
|
mkdir master packager master-revoked packager-revoked
|
2012-02-12 15:42:01 -06:00
|
|
|
|
2019-01-23 14:59:37 -06:00
|
|
|
# refresh/receive all keys
|
2012-02-12 15:42:01 -06:00
|
|
|
while read -ra data; do
|
|
|
|
keyid="${data[0]}"
|
|
|
|
username="${data[@]:1}"
|
2019-08-05 16:05:17 -05:00
|
|
|
if "${GPG[@]}" --list-keys ${keyid} >/dev/null &>/dev/null; then
|
|
|
|
"${GPG[@]}" --refresh-keys ${keyid} &>/dev/null
|
2019-01-23 14:59:37 -06:00
|
|
|
else
|
2019-08-05 16:05:17 -05:00
|
|
|
"${GPG[@]}" --recv-keys ${keyid} &>/dev/null
|
2019-01-23 14:59:37 -06:00
|
|
|
fi
|
|
|
|
done < <(cat master-keyids master-revoked-keyids packager-keyids packager-revoked-keyids)
|
|
|
|
|
|
|
|
# master-keyids
|
|
|
|
while read -ra data; do
|
|
|
|
keyid="${data[0]}"
|
|
|
|
username="${data[@]:1}"
|
2019-08-05 16:05:17 -05:00
|
|
|
"${GPG[@]}" --yes --lsign-key ${keyid} &>/dev/null
|
2019-10-07 06:12:53 -05:00
|
|
|
"${GPG[@]}" --comment "master-key: ${username} (${keyid})" --export ${keyid} >> master/${username}.asc
|
2012-03-03 11:16:04 -06:00
|
|
|
echo "${keyid}:4:" >> archlinux-trusted
|
2012-02-12 15:42:01 -06:00
|
|
|
done < master-keyids
|
2019-08-05 16:05:17 -05:00
|
|
|
"${GPG[@]}" --import-ownertrust < archlinux-trusted 2>/dev/null
|
2012-02-12 15:42:01 -06:00
|
|
|
|
2019-01-23 14:59:37 -06:00
|
|
|
# master-revoked-keyids
|
2017-03-20 14:40:37 -06:00
|
|
|
while read -ra data; do
|
|
|
|
keyid="${data[0]}"
|
|
|
|
username="${data[1]}"
|
2019-10-07 06:12:53 -05:00
|
|
|
"${GPG[@]}" --comment "revoked master-key: ${username} (${keyid})" --export ${keyid} >> master-revoked/${username}.asc
|
2017-10-17 07:01:23 -05:00
|
|
|
echo "${keyid}" >> archlinux-revoked
|
2017-03-20 14:40:37 -06:00
|
|
|
done < master-revoked-keyids
|
|
|
|
|
2019-01-23 14:59:37 -06:00
|
|
|
# packager-keyids
|
2013-06-10 07:18:32 -05:00
|
|
|
while read -ra data; do
|
|
|
|
keyid="${data[0]}"
|
|
|
|
username="${data[@]:1}"
|
2019-08-05 16:05:17 -05:00
|
|
|
if ! "${GPG[@]}" --list-keys --with-colons ${keyid} 2>/dev/null | grep -q '^pub:f:'; then
|
2019-10-09 09:51:15 -05:00
|
|
|
echo "WARNING: key is not fully trusted: ${keyid} ${username}"
|
|
|
|
"${GPG[@]}" --comment "marginal trust: ${username} (${keyid})" --export ${keyid} >> packager/${username}.asc
|
2012-02-12 15:42:01 -06:00
|
|
|
else
|
2019-10-07 06:12:53 -05:00
|
|
|
"${GPG[@]}" --comment "packager: ${username} (${keyid})" --export ${keyid} >> packager/${username}.asc
|
2012-02-12 15:42:01 -06:00
|
|
|
fi
|
|
|
|
done < packager-keyids
|
|
|
|
|
2019-01-23 14:59:37 -06:00
|
|
|
# packager-revoked-keyids
|
2013-05-25 05:48:49 -05:00
|
|
|
while read -ra data; do
|
|
|
|
keyid="${data[0]}"
|
|
|
|
username="${data[1]}"
|
2019-10-07 06:12:53 -05:00
|
|
|
"${GPG[@]}" --comment "revoked packager: ${username} (${keyid})" --export ${keyid} >> packager-revoked/${username}.asc
|
2017-10-17 07:01:23 -05:00
|
|
|
echo "${keyid}" >> archlinux-revoked
|
2013-05-25 05:48:49 -05:00
|
|
|
done < packager-revoked-keyids
|
|
|
|
|
2017-03-20 14:40:37 -06:00
|
|
|
cat master/*.asc master-revoked/*.asc packager/*.asc packager-revoked/*.asc > archlinux.gpg
|