summaryrefslogtreecommitdiff
path: root/sec-keys
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-08-02 03:04:46 -0500
committerroot <root@alpha.trunkmasters.com>2026-08-02 03:04:46 -0500
commit964d39efcc2b2e0270dd6ab8341eb85bb5275852 (patch)
treed9c187d35f14c1f5bc6ca70898cae4706daee5b7 /sec-keys
parent6344ec0d45ab5c6dc7f52b9c7ba2a4fdfa37fb17 (diff)
downloadbaldeagleos-repo-964d39efcc2b2e0270dd6ab8341eb85bb5275852.tar.gz
baldeagleos-repo-964d39efcc2b2e0270dd6ab8341eb85bb5275852.tar.xz
baldeagleos-repo-964d39efcc2b2e0270dd6ab8341eb85bb5275852.zip
Adding metadata
Diffstat (limited to 'sec-keys')
-rw-r--r--sec-keys/openpgp-keys-gentoo-developers/Manifest1
-rw-r--r--sec-keys/openpgp-keys-gentoo-developers/metadata.xml1
-rw-r--r--sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20260727.ebuild236
-rw-r--r--sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild2
-rw-r--r--sec-keys/openpgp-keys-gentoo-infrastructure/Manifest1
-rw-r--r--sec-keys/openpgp-keys-gentoo-infrastructure/metadata.xml1
-rw-r--r--sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-20260727.ebuild238
-rw-r--r--sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-99999999.ebuild2
8 files changed, 480 insertions, 2 deletions
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 226621bb0f67..102011dab801 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1,4 @@
DIST openpgp-keys-gentoo-developers-20260323-active-devs.gpg 3072609 BLAKE2B 94e2872bb2e122a40688466b624be402b621c4335cf939f01feabd3d3f4a4d96b283ab587649db3c272d12d61d1ee1e34ff24e764d53245f7f961f00fbfc4977 SHA512 22058b0794785537e46a8535a4d478960b0fc39e95564e1d938352dccdd7b122f3928a1443265d6d5ec7f95a551fdc1a2ddc2a35b40dd5a5bf300e9235fbb13d
DIST openpgp-keys-gentoo-developers-20260406-active-devs.gpg 3179093 BLAKE2B eff7cd01391730c121dad546ba5631b155cc05f9883959ad98c852dbacdfdd9e743ba05ef1555baaad0e0de7c4c2a23f01d9986c9c2fbc15b02c90409640abb4 SHA512 79fa4dfd989b9470e7c5ad1246d534c93c5164e37c64f2957277630dda44be0f3656eb00a9f31fd599f070853bc3d9b38c995599a06eeaab180fae95ecb52b74
DIST openpgp-keys-gentoo-developers-20260622-active-devs.gpg 3197645 BLAKE2B c5d845ab69a0a7bc0dbb25992f10a05082f1ff80adcf3ce30493bbb00334ff8959f948dc252ac3ad0d8dc3b3f9c92ac7cf840101290b21f312e5a8b7d9a91179 SHA512 9219107899cd82ac3fe209b6ea09df53b9028af46a8a002240a097c042ccb90f5a9ba1da9a7c672c48a2d99b6206b0fc8382b306622c73f672824b7bdf3c7ca8
+DIST openpgp-keys-gentoo-developers-20260727-active-devs.gpg 3316557 BLAKE2B d8f1d1cd4a0dbf9814beb84cc88314c85b89e79dd50692b9891620d486b3d0289d87fe4381177ada0c7e44c1205700d0c36d27b4009f7be2fcbd72e33d4c0965 SHA512 59542c6aa9682d0bd0d4538bd8522008184b9883639daa7a288b5734e781997a14b66d0dc4427c7331f5bc1d22dc3bf511c56445e5232e72c53352942ad5126d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/metadata.xml b/sec-keys/openpgp-keys-gentoo-developers/metadata.xml
index 1852c8beba1b..cd7e366e3876 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/metadata.xml
+++ b/sec-keys/openpgp-keys-gentoo-developers/metadata.xml
@@ -6,5 +6,6 @@
<name>Sam James</name>
</maintainer>
<stabilize-allarches />
+ <straight-to-stable />
<origin>baldeagleos-repo</origin>
</pkgmetadata>
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20260727.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20260727.ebuild
new file mode 100644
index 000000000000..9dab7dff910a
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20260727.ebuild
@@ -0,0 +1,236 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{13..14} )
+inherit edo python-any-r1
+
+DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
+HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
+if [[ ${PV} == 9999* ]] ; then
+ PROPERTIES="live"
+
+ BDEPEND="net-misc/curl"
+else
+ SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~sparc x86"
+fi
+
+S="${WORKDIR}"
+
+LICENSE="public-domain"
+SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+BDEPEND+="
+ $(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
+ || ( app-crypt/gnupg[nls] app-crypt/freepg[nls] )
+ >=sec-keys/openpgp-keys-gentoo-auth-20240703
+ test? (
+ sys-apps/grep[pcre]
+ )
+"
+
+python_check_deps() {
+ python_has_version "dev-python/python-gnupg[${PYTHON_USEDEP}]"
+}
+
+src_unpack() {
+ if [[ ${PV} == 9999* ]] ; then
+ curl https://qa-reports.gentoo.org/output/active-devs.gpg -o ${P}-active-devs.gpg || die
+ else
+ default
+ fi
+}
+
+src_compile() {
+ export GNUPGHOME="${T}"/.gnupg
+
+ get_gpg_keyring_dir() {
+ if [[ ${PV} == 9999* ]] ; then
+ echo "${WORKDIR}"
+ else
+ echo "${DISTDIR}"
+ fi
+ }
+
+ local mygpgargs=(
+ --no-autostart
+ --no-default-keyring
+ --homedir "${GNUPGHOME}"
+ )
+
+ # From verify-sig.eclass:
+ # "GPG upstream knows better than to follow the spec, so we can't
+ # override this directory. However, there is a clean fallback
+ # to GNUPGHOME."
+ addpredict /run/user
+
+ mkdir "${GNUPGHOME}" || die
+ chmod 700 "${GNUPGHOME}" || die
+
+ # Convert the binary keyring into an armored one so we can process it
+ edo gpg "${mygpgargs[@]}" --import "$(get_gpg_keyring_dir)"/${P}-active-devs.gpg
+ edo gpg "${mygpgargs[@]}" --export --armor > "${WORKDIR}"/gentoo-developers.asc
+
+ # Now strip out the keys which are expired and/or missing a signature
+ # from our L2 developer authority key
+ edo "${EPYTHON}" "${FILESDIR}"/keyring-mangler.py \
+ "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc \
+ "${WORKDIR}"/gentoo-developers.asc \
+ "${WORKDIR}"/gentoo-developers-sanitised.asc
+}
+
+src_test() {
+ export GNUPGHOME="${T}"/tests/.gnupg
+
+ local mygpgargs=(
+ # We don't have --no-autostart here because we need
+ # to let it spawn an agent for the key generation.
+ --no-default-keyring
+ --homedir "${GNUPGHOME}"
+ )
+
+ # From verify-sig.eclass:
+ # "GPG upstream knows better than to follow the spec, so we can't
+ # override this directory. However, there is a clean fallback
+ # to GNUPGHOME."
+ addpredict /run/user
+
+ # Check each of the keys to verify they're trusted by
+ # the L2 developer key.
+ mkdir -p "${GNUPGHOME}" || die
+ chmod 700 "${GNUPGHOME}" || die
+ cd "${T}"/tests || die
+
+ # First, grab the L1 key, and mark it as ultimately trusted.
+ edo gpg "${mygpgargs[@]}" --import "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc
+ edo gpg "${mygpgargs[@]}" --import-ownertrust "${BROOT}"/usr/share/openpgp-keys/gentoo-auth-ownertrust.txt
+
+ # Generate a temporary key which isn't signed by anything to check
+ # whether we're detecting unexpected keys.
+ #
+ # The test is whether this appears in the sanitised keyring we
+ # produce in src_compile (it should not be in there).
+ #
+ # https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
+ edo gpg "${mygpgargs[@]}" --batch --gen-key <<-EOF
+ %echo Generating temporary key for testing...
+
+ %no-protection
+ %transient-key
+ %pubring ${P}-ebuild-test-key.asc
+
+ Key-Type: 1
+ Key-Length: 2048
+ Subkey-Type: 1
+ Subkey-Length: 2048
+ Name-Real: Larry The Cow
+ Name-Email: larry@example.com
+ Expire-Date: 0
+ Handle: ${P}-ebuild-test-key
+
+ %commit
+ %echo Temporary key generated!
+ EOF
+
+ # Import the new injected key that shouldn't be signed by anything into a temporary testing keyring
+ edo gpg "${mygpgargs[@]}" --import "${T}"/tests/${P}-ebuild-test-key.asc
+
+ # Sign a tiny file with the to-be-injected key for testing rejection below
+ echo "Hello world!" > "${T}"/tests/signme || die
+ edo gpg "${mygpgargs[@]}" -u "Larry The Cow <larry@example.com>" --sign "${T}"/tests/signme || die
+
+ # keyring-mangler will fail with no valid keys so import the sanitised list from src_compile.
+ edo gpg "${mygpgargs[@]}" --import "${WORKDIR}"/gentoo-developers-sanitised.asc
+
+ edo gpg "${mygpgargs[@]}" --export --armor > "${T}"/tests/tainted-keyring.asc
+
+ # keyring-mangler.py should now produce a keyring *without* it
+ edo "${EPYTHON}" "${FILESDIR}"/keyring-mangler.py \
+ "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc \
+ "${T}"/tests/tainted-keyring.asc \
+ "${T}"/tests/gentoo-developers-sanitised.asc | tee "${T}"/tests/keyring-mangler.log
+ assert "Key mangling in tests failed?"
+
+ # Check the log to verify the injected key got detected
+ grep -q "Dropping key.*Larry The Cow" "${T}"/tests/keyring-mangler.log || die "Did not remove injected key from test keyring!"
+
+ # gnupg doesn't have an easy way for us to actually just.. ask
+ # if a key is known via WoT. So, sign a file using the key
+ # we just made, and then try to gpg --verify it, and check exit code.
+ #
+ # Let's now double check by seeing if a file signed by the injected key
+ # is rejected.
+ if gpg "${mygpgargs[@]}" --keyring "${T}"/tests/gentoo-developers-sanitised.asc --verify "${T}"/tests/signme.gpg ; then
+ die "'gpg --verify' using injected test key succeeded! This shouldn't happen!"
+ fi
+
+ # Bonus lame sanity check
+ edo gpg "${mygpgargs[@]}" --check-trustdb 2>&1 | tee "${T}"/tests/trustdb.log
+ assert "trustdb call failed!"
+
+ check_trust_levels() {
+ local mode=${1}
+
+ while IFS= read -r line; do
+ # gpg: depth: 0 valid: 1 signed: 2 trust: 0-, 0q, 0n, 0m, 0f, 1u
+ # gpg: depth: 1 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 2f, 0u
+ if [[ ${line} == *depth* ]] ; then
+ depth=$(echo ${line} | grep -Po "depth: [0-9]")
+ trust=$(echo ${line} | grep -Po "trust:.*")
+
+ trust_uncalculated=$(echo ${trust} | grep -Po "[0-9]-")
+ [[ ${trust_uncalculated} == 0 ]] || ${mode}
+
+ trust_insufficient=$(echo ${trust} | grep -Po "[0-9]q")
+ [[ ${trust_insufficient} == 0 ]] || ${mode}
+
+ trust_never=$(echo ${trust} | grep -Po "[0-9]n")
+ [[ ${trust_never} == 0 ]] || ${mode}
+
+ trust_marginal=$(echo ${trust} | grep -Po "[0-9]m")
+ [[ ${trust_marginal} == 0 ]] || ${mode}
+
+ trust_full=$(echo ${trust} | grep -Po "[0-9]f")
+ [[ ${trust_full} != 0 ]] || ${mode}
+
+ trust_ultimate=$(echo ${trust} | grep -Po "[0-9]u")
+ [[ ${trust_ultimate} == 1 ]] || ${mode}
+
+ echo "${trust_uncalculated}, ${trust_insufficient}"
+ fi
+ done < "${T}"/tests/trustdb.log
+ }
+
+ # First, check with the bad key still in the test keyring.
+ # This is supposed to fail, so we want it to return 1
+ check_trust_levels "return 1" && die "Trustdb passed when it should have failed!"
+
+ # Now check without the bad key in the test keyring.
+ # This one should pass.
+ #
+ # Drop the bad key first (https://superuser.com/questions/174583/how-to-delete-gpg-secret-keys-by-force-without-fingerprint)
+ keys=$(gpg "${mygpgargs[@]}" --fingerprint --with-colons --batch "Larry The Cow <larry@example.com>" \
+ | grep "^fpr" \
+ | sed -n 's/^fpr:::::::::\([[:alnum:]]\+\):/\1/p')
+
+ local key
+ for key in ${keys[@]} ; do
+ nonfatal edo gpg "${mygpgargs[@]}" --batch --yes --delete-secret-keys ${key}
+ done
+
+ edo gpg "${mygpgargs[@]}" --batch --yes --delete-keys "Larry The Cow <larry@example.com>"
+ check_trust_levels "return 0" || die "Trustdb failed when it should have passed!"
+
+ gpgconf --kill gpg-agent || die
+}
+
+src_install() {
+ insinto /usr/share/openpgp-keys
+ newins gentoo-developers-sanitised.asc gentoo-developers.asc
+
+ # TODO: install an ownertrust file like sec-keys/openpgp-keys-gentoo-auth?
+}
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild
index 06adca6a47cf..9dab7dff910a 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild
@@ -14,7 +14,7 @@ if [[ ${PV} == 9999* ]] ; then
BDEPEND="net-misc/curl"
else
SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~sparc x86"
fi
S="${WORKDIR}"
diff --git a/sec-keys/openpgp-keys-gentoo-infrastructure/Manifest b/sec-keys/openpgp-keys-gentoo-infrastructure/Manifest
index 0480a89f3282..a4c2eb72208c 100644
--- a/sec-keys/openpgp-keys-gentoo-infrastructure/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-infrastructure/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-infrastructure-20260202-infra-devs.gpg 297079 BLAKE2B 5c265c5a716b3e00c5c5bacfef72d01f73e40166c185ea723b3b3f80f0aba45563715b3bc492559a717abbfa99b7842a46c03f182bd4dee2a83d5e89628eb108 SHA512 4a7a42fb83e50643b6c7a42d1dcc4a235620e88f8931778fab1fc02f9361b276ce4a2e42a546c717c47c33e4492ac483027f9fdaf8b2288854c910de29f06931
+DIST openpgp-keys-gentoo-infrastructure-20260727-infra-devs.gpg 320875 BLAKE2B 3960df4a65e0a30ba603ac51375bd2f295806ca638cb89af658677ccf4c7f774fb772ccfb95feaf4c657fff1abfbd82d026954c6783b3c04718aed7b14b9c624 SHA512 8c0f4a995e825a6d8a6de3b31130053ba521ea874507d25c0ed9b4681e9fc11d41da4754e2e100bdd96cd43882ee220c0c875e9d07309aeea972209325833def
diff --git a/sec-keys/openpgp-keys-gentoo-infrastructure/metadata.xml b/sec-keys/openpgp-keys-gentoo-infrastructure/metadata.xml
index 1852c8beba1b..cd7e366e3876 100644
--- a/sec-keys/openpgp-keys-gentoo-infrastructure/metadata.xml
+++ b/sec-keys/openpgp-keys-gentoo-infrastructure/metadata.xml
@@ -6,5 +6,6 @@
<name>Sam James</name>
</maintainer>
<stabilize-allarches />
+ <straight-to-stable />
<origin>baldeagleos-repo</origin>
</pkgmetadata>
diff --git a/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-20260727.ebuild b/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-20260727.ebuild
new file mode 100644
index 000000000000..700a402959ea
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-20260727.ebuild
@@ -0,0 +1,238 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{13..14} )
+inherit edo python-any-r1
+
+DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
+HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
+if [[ ${PV} == 9999* ]] ; then
+ PROPERTIES="live"
+
+ BDEPEND="net-misc/curl"
+else
+ SRC_URI="https://qa-reports.gentoo.org/output/keys/infra-devs-${PV}.gpg -> ${P}-infra-devs.gpg"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~sparc x86"
+fi
+
+S="${WORKDIR}"
+
+LICENSE="public-domain"
+SLOT="0"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+BDEPEND+="
+ $(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
+ || ( app-crypt/gnupg[nls] app-crypt/freepg[nls] )
+ >=sec-keys/openpgp-keys-gentoo-auth-20260206
+ test? (
+ sys-apps/grep[pcre]
+ )
+"
+
+python_check_deps() {
+ python_has_version "dev-python/python-gnupg[${PYTHON_USEDEP}]"
+}
+
+src_unpack() {
+ if [[ ${PV} == 9999* ]] ; then
+ curl https://qa-reports.gentoo.org/output/infra-devs.gpg -o ${P}-infra-devs.gpg || die
+ else
+ default
+ fi
+}
+
+src_compile() {
+ export TMPDIR="$(mktemp -d --tmpdir=/tmp g-infra-XXX || die)"
+ export GNUPGHOME="${TMPDIR}"/.gnupg
+
+ get_gpg_keyring_dir() {
+ if [[ ${PV} == 9999* ]] ; then
+ echo "${WORKDIR}"
+ else
+ echo "${DISTDIR}"
+ fi
+ }
+
+ local mygpgargs=(
+ --no-autostart
+ --no-default-keyring
+ --homedir "${GNUPGHOME}"
+ )
+
+ # From verify-sig.eclass:
+ # "GPG upstream knows better than to follow the spec, so we can't
+ # override this directory. However, there is a clean fallback
+ # to GNUPGHOME."
+ addpredict /run/user
+
+ mkdir "${GNUPGHOME}" || die
+ chmod 700 "${GNUPGHOME}" || die
+
+ # Convert the binary keyring into an armored one so we can process it
+ edo gpg "${mygpgargs[@]}" --import "$(get_gpg_keyring_dir)"/${P}-infra-devs.gpg
+ edo gpg "${mygpgargs[@]}" --export --armor > "${WORKDIR}"/gentoo-infrastructure.asc
+
+ # Now strip out the keys which are expired and/or missing a signature
+ # from our L2 infrastructure authority key
+ edo "${EPYTHON}" "${FILESDIR}"/keyring-mangler.py \
+ "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc \
+ "${WORKDIR}"/gentoo-infrastructure.asc \
+ "${WORKDIR}"/gentoo-infrastructure-sanitised.asc
+}
+
+src_test() {
+ export TMPDIR="$(mktemp -d --tmpdir=/tmp g-infra-XXX || die)"
+ export GNUPGHOME="${TMPDIR}"/tests/.gnupg
+
+ local mygpgargs=(
+ # We don't have --no-autostart here because we need
+ # to let it spawn an agent for the key generation.
+ --no-default-keyring
+ --homedir "${GNUPGHOME}"
+ )
+
+ # From verify-sig.eclass:
+ # "GPG upstream knows better than to follow the spec, so we can't
+ # override this directory. However, there is a clean fallback
+ # to GNUPGHOME."
+ addpredict /run/user
+
+ # Check each of the keys to verify they're trusted by
+ # the L2 developer key.
+ mkdir -p "${GNUPGHOME}" || die
+ chmod 700 "${GNUPGHOME}" || die
+ cd "${TMPDIR}"/tests || die
+
+ # First, grab the L1 key, and mark it as ultimately trusted.
+ edo gpg "${mygpgargs[@]}" --import "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc
+ edo gpg "${mygpgargs[@]}" --import-ownertrust "${BROOT}"/usr/share/openpgp-keys/gentoo-auth-ownertrust.txt
+
+ # Generate a temporary key which isn't signed by anything to check
+ # whether we're detecting unexpected keys.
+ #
+ # The test is whether this appears in the sanitised keyring we
+ # produce in src_compile (it should not be in there).
+ #
+ # https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
+ edo gpg "${mygpgargs[@]}" --batch --gen-key <<-EOF
+ %echo Generating temporary key for testing...
+
+ %no-protection
+ %transient-key
+ %pubring ${P}-ebuild-test-key.asc
+
+ Key-Type: 1
+ Key-Length: 2048
+ Subkey-Type: 1
+ Subkey-Length: 2048
+ Name-Real: Larry The Cow
+ Name-Email: larry@example.com
+ Expire-Date: 0
+ Handle: ${P}-ebuild-test-key
+
+ %commit
+ %echo Temporary key generated!
+ EOF
+
+ # Import the new injected key that shouldn't be signed by anything into a temporary testing keyring
+ edo gpg "${mygpgargs[@]}" --import "${TMPDIR}"/tests/${P}-ebuild-test-key.asc
+
+ # Sign a tiny file with the to-be-injected key for testing rejection below
+ echo "Hello world!" > "${TMPDIR}"/tests/signme || die
+ edo gpg "${mygpgargs[@]}" -u "Larry The Cow <larry@example.com>" --sign "${TMPDIR}"/tests/signme || die
+
+ # keyring-mangler will fail with no valid keys so import the sanitised list from src_compile.
+ edo gpg "${mygpgargs[@]}" --import "${WORKDIR}"/gentoo-infrastructure-sanitised.asc
+
+ edo gpg "${mygpgargs[@]}" --export --armor > "${TMPDIR}"/tests/tainted-keyring.asc
+
+ # keyring-mangler.py should now produce a keyring *without* it
+ edo "${EPYTHON}" "${FILESDIR}"/keyring-mangler.py \
+ "${BROOT}"/usr/share/openpgp-keys/gentoo-auth.asc \
+ "${TMPDIR}"/tests/tainted-keyring.asc \
+ "${TMPDIR}"/tests/gentoo-infrastructure-sanitised.asc | tee "${TMPDIR}"/tests/keyring-mangler.log
+ assert "Key mangling in tests failed?"
+
+ # Check the log to verify the injected key got detected
+ grep -q "Dropping key.*Larry The Cow" "${TMPDIR}"/tests/keyring-mangler.log || die "Did not remove injected key from test keyring!"
+
+ # gnupg doesn't have an easy way for us to actually just.. ask
+ # if a key is known via WoT. So, sign a file using the key
+ # we just made, and then try to gpg --verify it, and check exit code.
+ #
+ # Let's now double check by seeing if a file signed by the injected key
+ # is rejected.
+ if gpg "${mygpgargs[@]}" --keyring "${TMPDIR}"/tests/gentoo-infrastructure-sanitised.asc --verify "${TMPDIR}"/tests/signme.gpg ; then
+ die "'gpg --verify' using injected test key succeeded! This shouldn't happen!"
+ fi
+
+ # Bonus lame sanity check
+ edo gpg "${mygpgargs[@]}" --check-trustdb 2>&1 | tee "${TMPDIR}"/tests/trustdb.log
+ assert "trustdb call failed!"
+
+ check_trust_levels() {
+ local mode=${1}
+
+ while IFS= read -r line; do
+ # gpg: depth: 0 valid: 1 signed: 2 trust: 0-, 0q, 0n, 0m, 0f, 1u
+ # gpg: depth: 1 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 2f, 0u
+ if [[ ${line} == *depth* ]] ; then
+ depth=$(echo ${line} | grep -Po "depth: [0-9]")
+ trust=$(echo ${line} | grep -Po "trust:.*")
+
+ trust_uncalculated=$(echo ${trust} | grep -Po "[0-9]-")
+ [[ ${trust_uncalculated} == 0 ]] || ${mode}
+
+ trust_insufficient=$(echo ${trust} | grep -Po "[0-9]q")
+ [[ ${trust_insufficient} == 0 ]] || ${mode}
+
+ trust_never=$(echo ${trust} | grep -Po "[0-9]n")
+ [[ ${trust_never} == 0 ]] || ${mode}
+
+ trust_marginal=$(echo ${trust} | grep -Po "[0-9]m")
+ [[ ${trust_marginal} == 0 ]] || ${mode}
+
+ trust_full=$(echo ${trust} | grep -Po "[0-9]f")
+ [[ ${trust_full} != 0 ]] || ${mode}
+
+ trust_ultimate=$(echo ${trust} | grep -Po "[0-9]u")
+ [[ ${trust_ultimate} == 1 ]] || ${mode}
+
+ echo "${trust_uncalculated}, ${trust_insufficient}"
+ fi
+ done < "${TMPDIR}"/tests/trustdb.log
+ }
+
+ # First, check with the bad key still in the test keyring.
+ # This is supposed to fail, so we want it to return 1
+ check_trust_levels "return 1" && die "Trustdb passed when it should have failed!"
+
+ # Now check without the bad key in the test keyring.
+ # This one should pass.
+ #
+ # Drop the bad key first (https://superuser.com/questions/174583/how-to-delete-gpg-secret-keys-by-force-without-fingerprint)
+ keys=$(gpg "${mygpgargs[@]}" --fingerprint --with-colons --batch "Larry The Cow <larry@example.com>" \
+ | grep "^fpr" \
+ | sed -n 's/^fpr:::::::::\([[:alnum:]]\+\):/\1/p')
+
+ local key
+ for key in ${keys[@]} ; do
+ nonfatal edo gpg "${mygpgargs[@]}" --batch --yes --delete-secret-keys ${key}
+ done
+
+ edo gpg "${mygpgargs[@]}" --batch --yes --delete-keys "Larry The Cow <larry@example.com>"
+ check_trust_levels "return 0" || die "Trustdb failed when it should have passed!"
+
+ gpgconf --kill gpg-agent || die
+}
+
+src_install() {
+ insinto /usr/share/openpgp-keys
+ newins gentoo-infrastructure-sanitised.asc gentoo-infrastructure.asc
+
+ # TODO: install an ownertrust file like sec-keys/openpgp-keys-gentoo-auth?
+}
diff --git a/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-99999999.ebuild b/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-99999999.ebuild
index a754fd5247eb..700a402959ea 100644
--- a/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-99999999.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-infrastructure/openpgp-keys-gentoo-infrastructure-99999999.ebuild
@@ -14,7 +14,7 @@ if [[ ${PV} == 9999* ]] ; then
BDEPEND="net-misc/curl"
else
SRC_URI="https://qa-reports.gentoo.org/output/keys/infra-devs-${PV}.gpg -> ${P}-infra-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~sparc x86"
fi
S="${WORKDIR}"