condorcore-keyring/update-keys
Pierre Schmitz 40ea22c053 Define a list of revoked keys
Use the file packager-revoked-keyids to revoke certain keys.
2013-05-25 12:48:49 +02:00

74 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
export LANG=C
TMPDIR=$(mktemp -d)
trap "rm -rf '${TMPDIR}'" EXIT
KEYSERVER='hkp://pool.sks-keyservers.net'
GPG="gpg --quiet --batch --no-tty --no-permission-warning --keyserver "${KEYSERVER}" --homedir ${TMPDIR}"
pushd "$(dirname "$0")" >/dev/null
$GPG --gen-key <<EOF
%echo Generating Arch Linux Keyring keychain master key...
Key-Type: RSA
Key-Length: 1024
Key-Usage: sign
Name-Real: Arch Linux Keyring Keychain Master Key
Name-Email: archlinux-keyring@localhost
Expire-Date: 0
%commit
%echo Done
EOF
rm -rf master packager packager-revoked archlinux-trusted archlinux-revoked
mkdir master packager packager-revoked
while read -ra data; do
keyid="${data[0]}"
username="${data[@]:1}"
${GPG} --recv-keys ${keyid} &>/dev/null
printf 'minimize\nquit\ny\n' | \
${GPG} --command-fd 0 --edit-key ${keyid}
${GPG} --yes --lsign-key ${keyid} &>/dev/null
${GPG} --armor --no-emit-version --output master/${username}.asc --export ${keyid}
echo "${keyid}:4:" >> archlinux-trusted
done < master-keyids
${GPG} --import-ownertrust < archlinux-trusted 2>/dev/null
while read -ra data; do
keyid="${data[0]}"
username="${data[@]:1}"
${GPG} --recv-keys ${keyid} &>/dev/null
printf 'clean\nquit\ny\n' | \
${GPG} --command-fd 0 --edit-key ${keyid}
FD=$(mktemp)
exec 4>"${FD}"
if ! ${GPG} --list-keys --with-colons ${keyid} 2>/dev/null | grep -q '^pub:f:'; then
echo "key is not fully trusted: ${keyid} ${username}"
else
${GPG} --armor --no-emit-version --output packager/${username}.asc --export ${keyid}
fi
done < packager-keyids
while read -ra data; do
keyid="${data[0]}"
username="${data[1]}"
${GPG} --recv-keys ${keyid} &>/dev/null
printf 'clean\nquit\ny\n' | \
${GPG} --command-fd 0 --edit-key ${keyid}
FD=$(mktemp)
exec 4>"${FD}"
if ! ${GPG} --list-keys --with-colons ${keyid} 2>/dev/null | grep -q '^pub:f:'; then
${GPG} --armor --no-emit-version --output packager-revoked/${username}.asc --export ${keyid}
echo "${keyid}" >> archlinux-revoked
else
echo "key is still fully trusted: ${keyid} ${username}"
fi
done < packager-revoked-keyids
cat master/*.asc packager/*.asc packager-revoked/*.asc > archlinux.gpg
popd >/dev/null