From fda2eca0841dd171bc13ca3776096d2ca0050476 Mon Sep 17 00:00:00 2001 From: Gary Verhaegen Date: Thu, 1 Oct 2020 21:01:42 +0200 Subject: [PATCH] periodically check signatures (#7543) This is a first, very incomplete step in the spirit of small, incremental PRs. Known missing features: - Should check all versions, not just the 30 most recent ones. - Should also download from GCP backup and compare. - Should alert on Slack if anything is unexpected. - Should handle versions prior to us starting to sign (and do what?). - Should also check artifacts in Artifactory, not just GitHub Releases. - Optionally should save to GCP if we don't have a backup already. So at the moment it's just downloading the artifacts for the 30 most recent releases and printing a message stating whether we have a signature and whether it's valid. CHANGELOG_BEGIN CHANGELOG_END --- ci/bash-lib.yml | 49 ++++++++++++++++++++++++++++++++ ci/cron/daily-compat.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) diff --git a/ci/bash-lib.yml b/ci/bash-lib.yml index 0679ffa273..169c6dde14 100644 --- a/ci/bash-lib.yml +++ b/ci/bash-lib.yml @@ -49,5 +49,54 @@ steps: trap - EXIT eval "$restore_trap" } + gpg_verify() { + local key gpg_dir signature_file res + signature_file=$1 + key=$(mktemp) + cat > $key <$LOG 2>&1 + PIDS="$PIDS $!" + done + for pid in $PIDS; do + wait $pid >$LOG 2>&1 + done + for f in !(*.asc); do + p=github/$VERSION/$f + if ! test -f $f.asc; then + echo $p: no signature file + else + if gpg_verify $f.asc >$LOG 2>&1; then + echo $p: signature matches + else + echo $p: signature does not match + fi + fi + done + cd "$DIR" + rm -rf "$VERSION" + done + displayName: check releases + env: + GCRED: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)