Skip to content

Commit

Permalink
Merge pull request #3824 from cyphar/release-gpgkeys
Browse files Browse the repository at this point in the history
release: add runc.keyring file
  • Loading branch information
AkihiroSuda authored Apr 19, 2023
2 parents fdc2515 + 056ec0c commit 3a2c0c2
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ permissions:
contents: read

jobs:
keyring:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: check runc.keyring
run: make validate-keyring

lint:
permissions:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ verify-dependencies: vendor
|| (echo -e "git status:\n $$(git status -- go.mod go.sum vendor/)\nerror: vendor/, go.mod and/or go.sum not up to date. Run \"make vendor\" to update"; exit 1) \
&& echo "all vendor files are up to date."

validate-keyring:
script/keyring_validate.sh

.PHONY: runc all recvtty sd-helper seccompagent static releaseall release \
localrelease dbuild lint man runcimage \
test localtest unittest localunittest integration localintegration \
rootlessintegration localrootlessintegration shell install install-bash \
install-man clean cfmt shfmt localshfmt shellcheck \
vendor verify-changelog verify-dependencies
vendor verify-changelog verify-dependencies validate-keyring
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

You can find official releases of `runc` on the [release](https://github.com/opencontainers/runc/releases) page.

All releases are signed by one of the keys listed in the [`runc.keyring` file in the root of this repository](runc.keyring).

## Security

The reporting process and disclosure communications are outlined [here](https://github.com/opencontainers/org/blob/master/SECURITY.md).
Expand Down
124 changes: 124 additions & 0 deletions runc.keyring
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
pub rsa4096 2016-06-21 [SC] [expires: 2031-06-18]
5F36C6C61B5460124A75F5A69E18AA267DDB8DB4
uid [ultimate] Aleksa Sarai <asarai@suse.com>
uid [ultimate] Aleksa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v//+iY6Z9xGz4zHL+9nWND/Kll3xHeuWjYGZ2nmcovSnEW4
0eiMn1c6KMgs/CCR4+9bm7MdgaF73pjM4xzHBIBetLLkcKQIrniX2Fq+WgscJfFx
+0ha7Xb2TTpSy8PRiYHowVUaMPwyqSsAUwrSenLuwyiKr+EW4Wzo+YM2w9a86yw1
GfWuiyk0Z4sGoPoPEjmD4y6Xlf8kIfuZeb+joHd6W1nMf7cxDkNLQqX6sWvs62Tv
Lsx2jApPKD2PyTyyxItJKc6NXFVM+Uww323ZYVWMkz+VKalHRiv6xzGqArhpAIH6
fn+1WjjqkrrLU4I7smjlulZCy/NZLOKqQYaqM+7BgC2mOPMb5CM99cg4SrK86dFr
3Cf22+OTmC6/Wb5Gu4PzTzkYIJDnt3BJQYjJlp4zyOHluN6notrWagLIB06oX+jQ
pxGySHW++Cha/JCUb0mfeHIJKvRor3v7YaSJoFIo//rz6XJ9WVZfsKnOte/3s9m7
qkEvLArbe2o7pUJ2mxZZw/nAk/Y39FYAMvgMA9f+uv18O7u+ojYjS6DlrmNuIEg/
mp8FqVxVNdIS2capSF4+eOn3a4kcF0018xbTLA2AwQ2o9eF5G9qTdSVrN865VPCd
KWr9ByCKAwVHsaSgVSJE/dse4f1toqeEHHbWk682U4RqOWZR4bA0
=3/jE
-----END PGP PUBLIC KEY BLOCK-----

pub ed25519 2019-06-21 [C]
C9C370B246B09F6DBCFC744C34401015D1D2D386
uid [ultimate] Aleksa Sarai <cyphar@cyphar.com>
sub ed25519 2022-09-30 [S] [expires: 2024-09-29]
sub cv25519 2022-09-30 [E] [expires: 2024-09-29]
sub ed25519 2022-09-30 [A] [expires: 2024-09-29]

-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: github=cyphar

mDMEXQxvLxYJKwYBBAHaRw8BAQdArRQoZs9YzYtQIiPA1qdvUT8Q0wbPZyRV65Tz
QNTIZla0IEFsZWtzYSBTYXJhaSA8Y3lwaGFyQGN5cGhhci5jb20+iJAEExYIADgF
CwkIBwI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qx2BY8K5wEk9fusA/jAhbeJw57bZYvK4MghfUa9tRocyII84UmOA
cgDbPPIFuDMEYza6bhYJKwYBBAHaRw8BAQdAgHXd0yf6MPXJZCZ3TFz8xLymyPsD
TF2SQwwqM4+nYbeIfgQYFgoAJhYhBMnDcLJGsJ9tvPx0TDRAEBXR0tOGBQJjNrpu
AhsgBQkDwmcAAAoJEDRAEBXR0tOGB8UA/0wf8uECKMmXGQ4DNi+ei2E9Ft6GL8qw
UGjwM/EKH2RoAP9HNRRKBjDxs/AZ3pBx1Q8hnHELLo0kXPc+3BG6Pht5BA==
=KN4V
-----END PGP PUBLIC KEY BLOCK-----

37 changes: 37 additions & 0 deletions script/keyring_addkey.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Copyright (C) 2023 SUSE LLC.
# Copyright (C) 2023 Open Containers Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -Eeuxo pipefail

root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")"
keyring_file="$root/runc.keyring"

function bail() {
echo "$@" >&2
exit 1
}

[[ "$#" -eq 2 ]] || bail "usage: $0 <github-handle> <keyid>"

github_handle="${1}"
gpg_keyid="${2}"

cat >>"$keyring_file" <<EOF
$(gpg --list-keys "$gpg_keyid")
$(gpg --armor --comment="github=$github_handle" --export --export-options=export-minimal,export-clean "$gpg_keyid")
EOF
98 changes: 98 additions & 0 deletions script/keyring_validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash
# Copyright (C) 2023 SUSE LLC.
# Copyright (C) 2023 Open Containers Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -Eeuo pipefail

project="runc"
root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")"

function log() {
echo "[*]" "$@" >&2
}

function bail() {
log "$@"
exit 1
}

# Temporary GPG keyring for messing around with.
tmp_gpgdir="$(mktemp -d --tmpdir "$project-validate-tmpkeyring.XXXXXX")"
trap 'rm -r "$tmp_gpgdir"' EXIT

# Get the set of MAINTAINERS.
readarray -t maintainers < <(sed -E 's|.* <.*> \(@?(.*)\)$|\1|' <"$root/MAINTAINERS")
echo "$project maintainers:"
printf " %s\n" "${maintainers[@]}"

# Create a dummy gpg keyring from the set of MAINTAINERS.
while IFS="" read -r username || [ -n "$username" ]; do
curl -sSL "https://github.com/$username.gpg" |
gpg --no-default-keyring --keyring="$tmp_gpgdir/$username.keyring" --import
done < <(printf '%s\n' "${maintainers[@]}")

# Make sure all of the keys in the keyring have a github=... comment.
awk <"$root/$project.keyring" '
/^-----BEGIN PGP PUBLIC KEY BLOCK-----$/ { key_idx++; in_pgp=1; has_comment=0; }
# PGP comments are never broken up over several lines, and we only have one
# comment entry in our keyring file anyway.
in_pgp && /^Comment:.* github=\w+.*/ { has_comment=1 }
/^-----END PGP PUBLIC KEY BLOCK-----$/ {
if (!has_comment) {
print "[!] Key", key_idx, "in '$project'.keyring is missing a github= comment."
exit 1
}
}
'

# Check that each entry in the kering is actually a maintainer's key.
while IFS="" read -d $'\0' -r block || [ -n "$block" ]; do
username="$(sed -En "s|^Comment:.* github=(\w+).*|\1|p" <<<"$block")"

# FIXME: This is to work around codespell thinking that f-p-r is a
# misspelling of some other word, and the lack of support for inline
# ignores in codespell.
fprfield="f""p""r"

# Check the username is actually a maintainer. This is just a sanity check,
# since you can put whatever you like in the Comment field.
[ -f "$tmp_gpgdir/$username.keyring" ] || bail "User $username in runc.keyring is not a maintainer!"
grep "(@$username)$" "$root/MAINTAINERS" >/dev/null || bail "User $username in runc.keyring is not a maintainer!"

# Check that the key in the block actually matches a known key for that
# maintainer. Note that a block can contain multiple keys, so we need to
# check all of them. Since we have to handle multiple keys anyway, we'll
# also verify all of the subkeys (this is simpler to implement anyway since
# the --with-colons format outputs fingerprints for both primary and
# subkeys in the same way).
#
# Fingerprints have a field 1 of $fprfield and field 10 containing the
# fingerprint. See <https://github.com/gpg/gnupg/blob/master/doc/DETAILS>
# for more details.
while IFS="" read -r key || [ -n "$key" ]; do
gpg --no-default-keyring --keyring="$tmp_gpgdir/$username.keyring" \
--list-keys --with-colons | grep "$fprfield:::::::::$key:" >/dev/null ||
bail "(Sub?)Key $key in $project.keyring is NOT actually one of $username's keys!"
log "Successfully verified $username's (sub?)key $key is legitimate."
done < <(gpg --no-default-keyring \
--import --import-options=show-only --with-colons <<<"$block" |
grep "^$fprfield:" | cut -d: -f10)
done < <(awk <"$project.keyring" '
/^-----BEGIN PGP PUBLIC KEY BLOCK-----$/ { in_block=1 }
in_block { print }
/^-----END PGP PUBLIC KEY BLOCK-----$/ { in_block=0; printf("\0"); }
')
Loading

0 comments on commit 3a2c0c2

Please sign in to comment.