* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-07-13 8:03 Matthias Maier
0 siblings, 0 replies; 87+ messages in thread
From: Matthias Maier @ 2022-07-13 8:03 UTC (permalink / raw
To: gentoo-commits
commit: fb983145c049012823bd6781e329facd5ba4eae9
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 08:01:37 2022 +0000
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 08:03:46 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb983145
sec-keys/openpgp-keys-gentoo-developers: update manifest for live ebuild
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 9bc91da807c4..c588fe3e8c8d 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,2 @@
DIST openpgp-keys-gentoo-developers-20220711-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
-DIST openpgp-keys-gentoo-developers-99999999-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
+DIST openpgp-keys-gentoo-developers-99999999-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-07-20 5:34 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2022-07-20 5:34 UTC (permalink / raw
To: gentoo-commits
commit: e927ca871134e7a387a28924f47c83a6b5bb3d56
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 05:32:51 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 05:32:51 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e927ca87
sec-keys/openpgp-keys-gentoo-developers: add 20220718
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20220718.ebuild | 214 +++++++++++++++++++++
2 files changed, 215 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index c588fe3e8c8d..9ae938983cf9 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20220711-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
+DIST openpgp-keys-gentoo-developers-20220718-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
DIST openpgp-keys-gentoo-developers-99999999-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220718.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220718.ebuild
new file mode 100644
index 000000000000..4ff65eaaea85
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220718.ebuild
@@ -0,0 +1,214 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+inherit edo python-any-r1
+
+DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
+HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
+if [[ ${PV} == 9999* ]] ; then
+ SRC_URI="https://qa-reports.gentoo.org/output/active-devs.gpg -> ${P}-active-devs.gpg"
+ PROPERTIES="live"
+else
+ SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ )
+"
+
+python_check_deps() {
+ python_has_version "dev-python/python-gnupg[${PYTHON_USEDEP}]"
+}
+
+src_compile() {
+ export GNUPGHOME="${T}"/.gnupg
+
+ 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 "${DISTDIR}"/${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
+
+ 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')
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-09-03 1:42 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2022-09-03 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 58ed019eadaa8b6d6bc113f3cb7e2deaac9af5ce
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 3 01:37:43 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 3 01:38:44 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58ed019e
sec-keys/openpgp-keys-gentoo-developers: add 20220830
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
...s-99999999.ebuild => openpgp-keys-gentoo-developers-20220830.ebuild} | 2 +-
.../openpgp-keys-gentoo-developers-99999999.ebuild | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 9ae938983cf9..6b13782a0d45 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-20220711-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
DIST openpgp-keys-gentoo-developers-20220718-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
+DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
DIST openpgp-keys-gentoo-developers-99999999-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
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-20220830.ebuild
similarity index 98%
copy from sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-99999999.ebuild
copy to sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
index e1500e00b9e0..4ff65eaaea85 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-20220830.ebuild
@@ -13,7 +13,7 @@ if [[ ${PV} == 9999* ]] ; then
PROPERTIES="live"
else
SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
fi
S="${WORKDIR}"
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 e1500e00b9e0..4ff65eaaea85 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
@@ -13,7 +13,7 @@ if [[ ${PV} == 9999* ]] ; then
PROPERTIES="live"
else
SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-09-03 1:42 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2022-09-03 1:42 UTC (permalink / raw
To: gentoo-commits
commit: a8771d1e3f382efe7a47957b05f3100965a9ccf9
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 3 01:42:41 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 3 01:42:41 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8771d1e
sec-keys/openpgp-keys-gentoo-developers: fix live ebuild
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 -
.../openpgp-keys-gentoo-developers-20220830.ebuild | 23 +++++++++++++++++++---
.../openpgp-keys-gentoo-developers-99999999.ebuild | 23 +++++++++++++++++++---
3 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 6b13782a0d45..b3be0b159ad5 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,4 +1,3 @@
DIST openpgp-keys-gentoo-developers-20220711-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
DIST openpgp-keys-gentoo-developers-20220718-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
-DIST openpgp-keys-gentoo-developers-99999999-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
index 4ff65eaaea85..a3505aa67f03 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
@@ -9,8 +9,9 @@ inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
if [[ ${PV} == 9999* ]] ; then
- SRC_URI="https://qa-reports.gentoo.org/output/active-devs.gpg -> ${P}-active-devs.gpg"
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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
@@ -23,7 +24,7 @@ SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"
-BDEPEND="
+BDEPEND+="
$(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
sec-keys/openpgp-keys-gentoo-auth
test? (
@@ -35,9 +36,25 @@ 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
@@ -54,7 +71,7 @@ src_compile() {
chmod 700 "${GNUPGHOME}" || die
# Convert the binary keyring into an armored one so we can process it
- edo gpg "${mygpgargs[@]}" --import "${DISTDIR}"/${P}-active-devs.gpg
+ 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
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 4ff65eaaea85..a3505aa67f03 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
@@ -9,8 +9,9 @@ inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
if [[ ${PV} == 9999* ]] ; then
- SRC_URI="https://qa-reports.gentoo.org/output/active-devs.gpg -> ${P}-active-devs.gpg"
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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
@@ -23,7 +24,7 @@ SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"
-BDEPEND="
+BDEPEND+="
$(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
sec-keys/openpgp-keys-gentoo-auth
test? (
@@ -35,9 +36,25 @@ 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
@@ -54,7 +71,7 @@ src_compile() {
chmod 700 "${GNUPGHOME}" || die
# Convert the binary keyring into an armored one so we can process it
- edo gpg "${mygpgargs[@]}" --import "${DISTDIR}"/${P}-active-devs.gpg
+ 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
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-09-03 1:49 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2022-09-03 1:49 UTC (permalink / raw
To: gentoo-commits
commit: fdbc65c03e802d0eeb8c4c4ed78df1c7fe68c1f1
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 3 01:48:29 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 3 01:48:34 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fdbc65c0
sec-keys/openpgp-keys-gentoo-developers: drop 20220711, 20220718
Will try to keep older versions around in future but had to rename
a few of the files due to error in script (contents are fine,
just dates were a week wrong).
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20220711.ebuild | 214 ---------------------
.../openpgp-keys-gentoo-developers-20220718.ebuild | 214 ---------------------
3 files changed, 430 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index b3be0b159ad5..db94796079c4 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1 @@
-DIST openpgp-keys-gentoo-developers-20220711-active-devs.gpg 3237775 BLAKE2B 511e4ea8907593b5ed05c79a0bf6ae131856f0511f3f6a744f393a077ad25fe3f6780caac60d4f94965d4c0aa14debae068599f50920caeaad44303a844bf7ed SHA512 c0122037a3bfde1eec0c3ca7a303ff82f532c518427b34814c12949572c18537f617db22563c15d40fd41f0c94e6c50bcd3e0d3d7d1175400057aafbe41ae2b2
-DIST openpgp-keys-gentoo-developers-20220718-active-devs.gpg 3238135 BLAKE2B a500165c89d28d1aef314ef10e639efe5b354cb39cca2c0565b43b55c580eed26d74be1d45b3be3d55d7879f25282d367cca6e04423df59191b7eedfcc1def88 SHA512 e51afcb31f81ee8596c9b2393fae41d8c67fc363d71f91296195369a428371e6151b81fd57a0cff382ad3493e57b6527126abedcdbc72b32f1bd5b2021e029eb
DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220711.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220711.ebuild
deleted file mode 100644
index 4ff65eaaea85..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220711.ebuild
+++ /dev/null
@@ -1,214 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-inherit edo python-any-r1
-
-DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
-HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
-if [[ ${PV} == 9999* ]] ; then
- SRC_URI="https://qa-reports.gentoo.org/output/active-devs.gpg -> ${P}-active-devs.gpg"
- PROPERTIES="live"
-else
- SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- )
-"
-
-python_check_deps() {
- python_has_version "dev-python/python-gnupg[${PYTHON_USEDEP}]"
-}
-
-src_compile() {
- export GNUPGHOME="${T}"/.gnupg
-
- 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 "${DISTDIR}"/${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
-
- 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')
-
- 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-20220718.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220718.ebuild
deleted file mode 100644
index 4ff65eaaea85..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220718.ebuild
+++ /dev/null
@@ -1,214 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-inherit edo python-any-r1
-
-DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
-HOMEPAGE="https://www.gentoo.org/downloads/signatures/"
-if [[ ${PV} == 9999* ]] ; then
- SRC_URI="https://qa-reports.gentoo.org/output/active-devs.gpg -> ${P}-active-devs.gpg"
- PROPERTIES="live"
-else
- SRC_URI="https://qa-reports.gentoo.org/output/keys/active-devs-${PV}.gpg -> ${P}-active-devs.gpg"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- )
-"
-
-python_check_deps() {
- python_has_version "dev-python/python-gnupg[${PYTHON_USEDEP}]"
-}
-
-src_compile() {
- export GNUPGHOME="${T}"/.gnupg
-
- 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 "${DISTDIR}"/${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
-
- 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')
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2022-11-07 23:46 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2022-11-07 23:46 UTC (permalink / raw
To: gentoo-commits
commit: bfc475a440ca341dbea334fb9425d0922763d7e4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 7 23:46:29 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 7 23:46:29 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfc475a4
sec-keys/openpgp-keys-gentoo-developers: add 20221031
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20221031.ebuild | 231 +++++++++++++++++++++
2 files changed, 232 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index db94796079c4..cb0bd0ce423f 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
+DIST openpgp-keys-gentoo-developers-20221031-active-devs.gpg 3275029 BLAKE2B 1d238a0d18760599c8d43fd6e45091acb88e6569226a7740762ac3f94cc9473650c66c9815c3e5cca12f196b1aa306776a67b836e72eb65aac6e80dfdaa0a78d SHA512 25bc32b8e724087345a7beb0f17c5229622436671102296b234e0a938b14e4cc341dab89b66e2f78d42432ecc3ac607e18647a820d3c5ab85b92fd62b1ade058
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild
new file mode 100644
index 000000000000..a3505aa67f03
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ )
+"
+
+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
+
+ 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')
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-01-03 4:48 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-01-03 4:48 UTC (permalink / raw
To: gentoo-commits
commit: 466829e501b0bb3f103f8ec124ebbecfd881a1b8
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 3 04:48:25 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 3 04:48:25 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=466829e5
sec-keys/openpgp-keys-gentoo-developers: drop 20220830
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 -
.../openpgp-keys-gentoo-developers-20220830.ebuild | 231 ---------------------
2 files changed, 232 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 9f7faf577d6a..dded0b60f758 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1,2 @@
-DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
DIST openpgp-keys-gentoo-developers-20221031-active-devs.gpg 3275029 BLAKE2B 1d238a0d18760599c8d43fd6e45091acb88e6569226a7740762ac3f94cc9473650c66c9815c3e5cca12f196b1aa306776a67b836e72eb65aac6e80dfdaa0a78d SHA512 25bc32b8e724087345a7beb0f17c5229622436671102296b234e0a938b14e4cc341dab89b66e2f78d42432ecc3ac607e18647a820d3c5ab85b92fd62b1ade058
DIST openpgp-keys-gentoo-developers-20230102-active-devs.gpg 3059326 BLAKE2B 5806b9680228aaa83a1f668845b01741591e8b235a6fe7e808a73d652393d42dd4ebe4b378063cb0a5f12c8510b1accf358d407175717fc130894b0d497d10f2 SHA512 8002316b16c9b7b294d349d25709ef5dbce055b2865a901b16dd41daa0e27c0e1fcdff633f204a31ba7a25d6ad326a803209dbefd9eadacb7098975b144defd5
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
deleted file mode 100644
index a3505aa67f03..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20220830.ebuild
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- )
-"
-
-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
-
- 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')
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-01-03 4:48 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-01-03 4:48 UTC (permalink / raw
To: gentoo-commits
commit: dcdb15b823c6ff9a2862a8d1ee57054926148f2e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 3 04:48:17 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 3 04:48:17 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcdb15b8
sec-keys/openpgp-keys-gentoo-developers: add 20230102
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230102.ebuild | 231 +++++++++++++++++++++
2 files changed, 232 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index cb0bd0ce423f..9f7faf577d6a 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20220830-active-devs.gpg 3234718 BLAKE2B 80753222b4d2febf0d8568503d646e0258410010eefa35ea3914f5979ea05f12634676212df392f5ddbb153899cd7452ee89d412bea9de8e67abf93243444fa8 SHA512 2676fe541cdad8755f745ebd24badd7b4193bdff71f478f2442fea84e1e07b060564d437ce642b01a37ba8086a8177a84c32abf3dd794be8e587e1740bed2af2
DIST openpgp-keys-gentoo-developers-20221031-active-devs.gpg 3275029 BLAKE2B 1d238a0d18760599c8d43fd6e45091acb88e6569226a7740762ac3f94cc9473650c66c9815c3e5cca12f196b1aa306776a67b836e72eb65aac6e80dfdaa0a78d SHA512 25bc32b8e724087345a7beb0f17c5229622436671102296b234e0a938b14e4cc341dab89b66e2f78d42432ecc3ac607e18647a820d3c5ab85b92fd62b1ade058
+DIST openpgp-keys-gentoo-developers-20230102-active-devs.gpg 3059326 BLAKE2B 5806b9680228aaa83a1f668845b01741591e8b235a6fe7e808a73d652393d42dd4ebe4b378063cb0a5f12c8510b1accf358d407175717fc130894b0d497d10f2 SHA512 8002316b16c9b7b294d349d25709ef5dbce055b2865a901b16dd41daa0e27c0e1fcdff633f204a31ba7a25d6ad326a803209dbefd9eadacb7098975b144defd5
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230102.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230102.ebuild
new file mode 100644
index 000000000000..2d106e87ca20
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230102.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ )
+"
+
+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
+
+ 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')
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 1:51 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 1:51 UTC (permalink / raw
To: gentoo-commits
commit: 5d5f32a811e60cfd8bc7a81d30ea7fb219b0e70f
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 01:41:18 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 01:41:18 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d5f32a8
sec-keys/openpgp-keys-gentoo-developers: add 20230327
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230327.ebuild | 231 +++++++++++++++++++++
2 files changed, 232 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index dded0b60f758..fe8b722a1e67 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20221031-active-devs.gpg 3275029 BLAKE2B 1d238a0d18760599c8d43fd6e45091acb88e6569226a7740762ac3f94cc9473650c66c9815c3e5cca12f196b1aa306776a67b836e72eb65aac6e80dfdaa0a78d SHA512 25bc32b8e724087345a7beb0f17c5229622436671102296b234e0a938b14e4cc341dab89b66e2f78d42432ecc3ac607e18647a820d3c5ab85b92fd62b1ade058
DIST openpgp-keys-gentoo-developers-20230102-active-devs.gpg 3059326 BLAKE2B 5806b9680228aaa83a1f668845b01741591e8b235a6fe7e808a73d652393d42dd4ebe4b378063cb0a5f12c8510b1accf358d407175717fc130894b0d497d10f2 SHA512 8002316b16c9b7b294d349d25709ef5dbce055b2865a901b16dd41daa0e27c0e1fcdff633f204a31ba7a25d6ad326a803209dbefd9eadacb7098975b144defd5
+DIST openpgp-keys-gentoo-developers-20230327-active-devs.gpg 3134134 BLAKE2B 31a06e5552253c494cdb8defdc81198fa55d1d2e33950415125edeff0075243ce170243188c5b016e4ecf4184c99d072d79a8b0de49a642bcdd1b4d01971ff47 SHA512 9b67b485a323f08786552a0e6dcc378cbe331accc2960b7121c344275629933733e5e268d3d5d96b70c40a541a1b6447c983fc11caadc1455d0b7609d9360b9c
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
new file mode 100644
index 000000000000..2d106e87ca20
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ )
+"
+
+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
+
+ 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')
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 1:51 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 1:51 UTC (permalink / raw
To: gentoo-commits
commit: b01af2672de44b88a12d54fce3753c027cf2d5a5
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 01:41:25 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 01:41:25 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b01af267
sec-keys/openpgp-keys-gentoo-developers: drop 20221031, 20230102
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20221031.ebuild | 231 ---------------------
.../openpgp-keys-gentoo-developers-20230102.ebuild | 231 ---------------------
3 files changed, 464 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index fe8b722a1e67..ccf1110a3fa0 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1 @@
-DIST openpgp-keys-gentoo-developers-20221031-active-devs.gpg 3275029 BLAKE2B 1d238a0d18760599c8d43fd6e45091acb88e6569226a7740762ac3f94cc9473650c66c9815c3e5cca12f196b1aa306776a67b836e72eb65aac6e80dfdaa0a78d SHA512 25bc32b8e724087345a7beb0f17c5229622436671102296b234e0a938b14e4cc341dab89b66e2f78d42432ecc3ac607e18647a820d3c5ab85b92fd62b1ade058
-DIST openpgp-keys-gentoo-developers-20230102-active-devs.gpg 3059326 BLAKE2B 5806b9680228aaa83a1f668845b01741591e8b235a6fe7e808a73d652393d42dd4ebe4b378063cb0a5f12c8510b1accf358d407175717fc130894b0d497d10f2 SHA512 8002316b16c9b7b294d349d25709ef5dbce055b2865a901b16dd41daa0e27c0e1fcdff633f204a31ba7a25d6ad326a803209dbefd9eadacb7098975b144defd5
DIST openpgp-keys-gentoo-developers-20230327-active-devs.gpg 3134134 BLAKE2B 31a06e5552253c494cdb8defdc81198fa55d1d2e33950415125edeff0075243ce170243188c5b016e4ecf4184c99d072d79a8b0de49a642bcdd1b4d01971ff47 SHA512 9b67b485a323f08786552a0e6dcc378cbe331accc2960b7121c344275629933733e5e268d3d5d96b70c40a541a1b6447c983fc11caadc1455d0b7609d9360b9c
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild
deleted file mode 100644
index a3505aa67f03..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20221031.ebuild
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- )
-"
-
-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
-
- 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')
-
- 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-20230102.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230102.ebuild
deleted file mode 100644
index 2d106e87ca20..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230102.ebuild
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- )
-"
-
-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
-
- 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')
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 2:27 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 2:27 UTC (permalink / raw
To: gentoo-commits
commit: b9d436d487fa07daea5268dbd402a242785d8a2b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 02:26:38 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 02:26:38 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9d436d4
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 amd64, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 2d106e87ca20..abd8f4c9ba40 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+ KEYWORDS="~alpha amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 2:27 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 2:27 UTC (permalink / raw
To: gentoo-commits
commit: cdcb01b158015bac45b04a884d5b4c42ac97dde6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 02:26:41 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 02:26:41 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cdcb01b1
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 x86, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index abd8f4c9ba40..6e921f4f1143 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+ KEYWORDS="~alpha amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 11:03 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 11:03 UTC (permalink / raw
To: gentoo-commits
commit: 829afff136119a4a23e234020dc853d21a95e2db
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 11:03:27 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 11:03:27 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=829afff1
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 ppc64, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 6e921f4f1143..935b1434a5fa 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv x86"
+ KEYWORDS="~alpha amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 11:24 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 11:24 UTC (permalink / raw
To: gentoo-commits
commit: 2b9df937ced3d23ea1c51f5d4d6a6b17b4150c53
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 11:23:32 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 11:24:17 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b9df937
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 arm, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 935b1434a5fa..2c6122027356 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ~ppc ppc64 ~riscv x86"
+ KEYWORDS="~alpha amd64 arm ~arm64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 11:24 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 11:24 UTC (permalink / raw
To: gentoo-commits
commit: 22f4762b29e46085cb608efe4c96edadefa8425e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 11:23:39 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 11:24:21 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22f4762b
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 arm64, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 196023368821..501e38dba5f9 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ppc ppc64 ~riscv x86"
+ KEYWORDS="~alpha amd64 arm arm64 ~loong ~m68k ~mips ppc ppc64 ~riscv x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 11:24 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 11:24 UTC (permalink / raw
To: gentoo-commits
commit: 548f956aabef90272296d17ad913ffb6cfe7aa82
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 11:23:35 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 11:24:19 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=548f956a
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 ppc, #903507
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 2c6122027356..196023368821 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ~ppc ppc64 ~riscv x86"
+ KEYWORDS="~alpha amd64 arm ~arm64 ~loong ~m68k ~mips ppc ppc64 ~riscv x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 14:58 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-29 14:58 UTC (permalink / raw
To: gentoo-commits
commit: 6c69083ae022269acdd9e8518f016e3b99f2dc37
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 14:58:25 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 14:58:25 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c69083a
sec-keys/openpgp-keys-gentoo-developers: Keyword 20230327 sparc, #903541
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 501e38dba5f9..48f6e69c79a6 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~loong ~m68k ~mips ppc ppc64 ~riscv x86"
+ KEYWORDS="~alpha amd64 arm arm64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-29 18:24 Arthur Zamarin
0 siblings, 0 replies; 87+ messages in thread
From: Arthur Zamarin @ 2023-03-29 18:24 UTC (permalink / raw
To: gentoo-commits
commit: 43d640458f652f5841bb983536849041aee4c6d0
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 18:24:10 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 18:24:10 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43d64045
sec-keys/openpgp-keys-gentoo-developers: Keyword 20230327 hppa, #903541
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 48f6e69c79a6..638dc274000e 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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 ~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}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-31 20:59 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-31 20:59 UTC (permalink / raw
To: gentoo-commits
commit: 4748e8de3338164179d84db0746691243fae59a3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 31 20:35:25 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 31 20:59:00 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4748e8de
sec-keys/openpgp-keys-gentoo-developers: add grep[pcre] test dep
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 1 +
.../openpgp-keys-gentoo-developers-99999999.ebuild | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 638dc274000e..d27316a8d865 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
@@ -29,6 +29,7 @@ BDEPEND+="
sec-keys/openpgp-keys-gentoo-auth
test? (
app-crypt/gnupg
+ sys-apps/grep[pcre]
)
"
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 a3505aa67f03..dcaba74fe284 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
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -29,6 +29,7 @@ BDEPEND+="
sec-keys/openpgp-keys-gentoo-auth
test? (
app-crypt/gnupg
+ sys-apps/grep[pcre]
)
"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-31 20:59 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-31 20:59 UTC (permalink / raw
To: gentoo-commits
commit: 6d37229aa11a188e1e97818ed358df6d0b24b9b5
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 31 20:57:15 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 31 20:59:03 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d37229a
sec-keys/openpgp-keys-gentoo-developers: add missing local in src_test
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 1 +
.../openpgp-keys-gentoo-developers-99999999.ebuild | 1 +
2 files changed, 2 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index d27316a8d865..55b7096d6199 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
@@ -214,6 +214,7 @@ src_test() {
| 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
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 dcaba74fe284..0822f4ba0cbc 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
@@ -214,6 +214,7 @@ src_test() {
| 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
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-31 21:01 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-31 21:01 UTC (permalink / raw
To: gentoo-commits
commit: 23e501581bd167809560092d26db760871b8e366
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 31 21:00:34 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 31 21:00:34 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23e50158
sec-keys/openpgp-keys-gentoo-developers: sync live
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-99999999.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 0822f4ba0cbc..19dd6bb3b88d 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 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-03-31 21:28 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-03-31 21:28 UTC (permalink / raw
To: gentoo-commits
commit: 36dd2bd9b3a53336fda32740718ecd041960b36b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 31 21:27:45 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 31 21:27:54 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36dd2bd9
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 sparc, #903650
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 55b7096d6199..444a7ece8a5b 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-01 0:55 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-04-01 0:55 UTC (permalink / raw
To: gentoo-commits
commit: 476e232590ff7479c100595aedc72388a6df8541
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 1 00:54:55 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 1 00:54:55 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=476e2325
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230327 hppa, #903650
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230327.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
index 444a7ece8a5b..5d30bacbb1b7 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.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}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-04 4:20 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-04-04 4:20 UTC (permalink / raw
To: gentoo-commits
commit: 35dacf2e7008c80b9c52cdd06d8f78597e03d70c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 4 04:18:47 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 4 04:19:14 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35dacf2e
sec-keys/openpgp-keys-gentoo-developers: add 20230403
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230403.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index ccf1110a3fa0..6c322708970e 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-developers-20230327-active-devs.gpg 3134134 BLAKE2B 31a06e5552253c494cdb8defdc81198fa55d1d2e33950415125edeff0075243ce170243188c5b016e4ecf4184c99d072d79a8b0de49a642bcdd1b4d01971ff47 SHA512 9b67b485a323f08786552a0e6dcc378cbe331accc2960b7121c344275629933733e5e268d3d5d96b70c40a541a1b6447c983fc11caadc1455d0b7609d9360b9c
+DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
new file mode 100644
index 000000000000..19dd6bb3b88d
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-08 6:47 Viorel Munteanu
0 siblings, 0 replies; 87+ messages in thread
From: Viorel Munteanu @ 2023-04-08 6:47 UTC (permalink / raw
To: gentoo-commits
commit: 1d8bf6a10d42713a657317312ab8ef3f8e1b5a60
Author: Matoro Mahri <matoro <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Fri Apr 7 19:30:51 2023 +0000
Commit: Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Apr 8 06:46:53 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d8bf6a1
sec-keys/openpgp-keys-gentoo-developers: Keyword 20230403 ia64, #903541
Signed-off-by: Matoro Mahri <matoro <AT> users.noreply.github.com>
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230403.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
index 19dd6bb3b88d..efd0694ab707 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-23 7:05 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-04-23 7:05 UTC (permalink / raw
To: gentoo-commits
commit: 02cbe68e08cc53588ae64afbcc1e69f5ef984861
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 23 06:55:58 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 06:55:58 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02cbe68e
sec-keys/openpgp-keys-gentoo-developers: add 20230417
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230417.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 6c322708970e..be974ada44f9 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230327-active-devs.gpg 3134134 BLAKE2B 31a06e5552253c494cdb8defdc81198fa55d1d2e33950415125edeff0075243ce170243188c5b016e4ecf4184c99d072d79a8b0de49a642bcdd1b4d01971ff47 SHA512 9b67b485a323f08786552a0e6dcc378cbe331accc2960b7121c344275629933733e5e268d3d5d96b70c40a541a1b6447c983fc11caadc1455d0b7609d9360b9c
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
+DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-23 7:09 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-04-23 7:09 UTC (permalink / raw
To: gentoo-commits
commit: 8df5c5eddd6888e8606ef7fbcd588afe849e4b0b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 23 07:08:58 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 07:09:03 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8df5c5ed
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230403 ALLARCHES, #904853
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230403.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
index efd0694ab707..3c30975acd6f 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-04-23 19:46 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-04-23 19:46 UTC (permalink / raw
To: gentoo-commits
commit: b014535bb3d5e8da21b3a85642cf6f67645a888a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 23 19:33:45 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 19:40:44 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b014535b
sec-keys/openpgp-keys-gentoo-developers: drop 20230327
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 -
.../openpgp-keys-gentoo-developers-20230327.ebuild | 233 ---------------------
2 files changed, 234 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index be974ada44f9..40a59ff16a31 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1,2 @@
-DIST openpgp-keys-gentoo-developers-20230327-active-devs.gpg 3134134 BLAKE2B 31a06e5552253c494cdb8defdc81198fa55d1d2e33950415125edeff0075243ce170243188c5b016e4ecf4184c99d072d79a8b0de49a642bcdd1b4d01971ff47 SHA512 9b67b485a323f08786552a0e6dcc378cbe331accc2960b7121c344275629933733e5e268d3d5d96b70c40a541a1b6447c983fc11caadc1455d0b7609d9360b9c
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
deleted file mode 100644
index 5d30bacbb1b7..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230327.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-05-15 4:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-05-15 4:10 UTC (permalink / raw
To: gentoo-commits
commit: f094c789f36c3c740d9f1903068db387f94b0356
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 02:57:08 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 15 04:09:49 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f094c789
sec-keys/openpgp-keys-gentoo-developers: add 20230501
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230501.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 58234f472e92..22676b184e3e 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-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
DIST openpgp-keys-gentoo-developers-20230424-active-devs.gpg 3077177 BLAKE2B 37795ba97540163c722f6642d001767a64a19ed6e2ca64ed1aa6b69f363aac96f25c7f9adb244a35eb8786902048a1b78b1f1b4bccfa26bcf23638c6bb85c07f SHA512 3a610650a1f1aa5e17c33eed5b78521df523fc068004015f42d13eb8b72b08d7f9296420bb70fefae879c0eca2a2128c43149512fce07d01f78c088325e2c453
+DIST openpgp-keys-gentoo-developers-20230501-active-devs.gpg 3083340 BLAKE2B 464837904637d6271348a0f18a882670c75c04a0e88e212efcf6715b840a9a0f6c63933bb341dfdfc0912d52f90dcb35fcd07f375bf3fdac4a35fb0cc03e029b SHA512 b2781930ddab8d17f17393be0e0535144b0a800e4178bce3a15c5cc2a8c973cf95ad51aa9ccfae5763057a5fce434eb6279d92b7064c0744a78e198b78b4f436
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230501.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230501.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230501.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-05-15 4:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-05-15 4:10 UTC (permalink / raw
To: gentoo-commits
commit: cbe3973666b257e09bb09a580e1e6e199eaa56e2
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 02:57:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 15 04:09:50 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbe39736
sec-keys/openpgp-keys-gentoo-developers: drop 20230417, 20230424, 20230501
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 3 -
.../openpgp-keys-gentoo-developers-20230417.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230424.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230501.ebuild | 233 ---------------------
4 files changed, 702 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 5bcf3ef83ac3..864f45eec61c 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,5 +1,2 @@
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
-DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
-DIST openpgp-keys-gentoo-developers-20230424-active-devs.gpg 3077177 BLAKE2B 37795ba97540163c722f6642d001767a64a19ed6e2ca64ed1aa6b69f363aac96f25c7f9adb244a35eb8786902048a1b78b1f1b4bccfa26bcf23638c6bb85c07f SHA512 3a610650a1f1aa5e17c33eed5b78521df523fc068004015f42d13eb8b72b08d7f9296420bb70fefae879c0eca2a2128c43149512fce07d01f78c088325e2c453
-DIST openpgp-keys-gentoo-developers-20230501-active-devs.gpg 3083340 BLAKE2B 464837904637d6271348a0f18a882670c75c04a0e88e212efcf6715b840a9a0f6c63933bb341dfdfc0912d52f90dcb35fcd07f375bf3fdac4a35fb0cc03e029b SHA512 b2781930ddab8d17f17393be0e0535144b0a800e4178bce3a15c5cc2a8c973cf95ad51aa9ccfae5763057a5fce434eb6279d92b7064c0744a78e198b78b4f436
DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230417.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230424.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230424.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230424.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230501.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230501.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230501.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-05-15 4:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-05-15 4:10 UTC (permalink / raw
To: gentoo-commits
commit: 04c283e9d778e5467f7fe0a63746ddc431bda44b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 02:56:27 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 15 04:09:48 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04c283e9
sec-keys/openpgp-keys-gentoo-developers: add 20230424
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230424.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 40a59ff16a31..58234f472e92 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
+DIST openpgp-keys-gentoo-developers-20230424-active-devs.gpg 3077177 BLAKE2B 37795ba97540163c722f6642d001767a64a19ed6e2ca64ed1aa6b69f363aac96f25c7f9adb244a35eb8786902048a1b78b1f1b4bccfa26bcf23638c6bb85c07f SHA512 3a610650a1f1aa5e17c33eed5b78521df523fc068004015f42d13eb8b72b08d7f9296420bb70fefae879c0eca2a2128c43149512fce07d01f78c088325e2c453
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230424.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230424.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230424.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-05-15 4:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-05-15 4:10 UTC (permalink / raw
To: gentoo-commits
commit: e4aadb657142ecf6b58127049883c7da5d22bf0b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 15 02:57:26 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 15 04:09:49 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4aadb65
sec-keys/openpgp-keys-gentoo-developers: add 20230508
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230508.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 22676b184e3e..5bcf3ef83ac3 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233
DIST openpgp-keys-gentoo-developers-20230417-active-devs.gpg 3075471 BLAKE2B a1d35a6fa32cd92662ce7913000f043d15b2875865a7839df69c7c5648b70c20c43d59cc8fbc9d5bcbd4ea48ea7e7f8063a79fef624d39c092b60b6741e793bd SHA512 4637d67ab19512c80547f029ab95ba755308f9a88c7de4d417177201620b1e48fc21b4ae2bf40770222076aab10f812a71046ce198bdcfa1d08283a3211a4755
DIST openpgp-keys-gentoo-developers-20230424-active-devs.gpg 3077177 BLAKE2B 37795ba97540163c722f6642d001767a64a19ed6e2ca64ed1aa6b69f363aac96f25c7f9adb244a35eb8786902048a1b78b1f1b4bccfa26bcf23638c6bb85c07f SHA512 3a610650a1f1aa5e17c33eed5b78521df523fc068004015f42d13eb8b72b08d7f9296420bb70fefae879c0eca2a2128c43149512fce07d01f78c088325e2c453
DIST openpgp-keys-gentoo-developers-20230501-active-devs.gpg 3083340 BLAKE2B 464837904637d6271348a0f18a882670c75c04a0e88e212efcf6715b840a9a0f6c63933bb341dfdfc0912d52f90dcb35fcd07f375bf3fdac4a35fb0cc03e029b SHA512 b2781930ddab8d17f17393be0e0535144b0a800e4178bce3a15c5cc2a8c973cf95ad51aa9ccfae5763057a5fce434eb6279d92b7064c0744a78e198b78b4f436
+DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-05-18 22:21 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-05-18 22:21 UTC (permalink / raw
To: gentoo-commits
commit: d790d32d696ca7788cc37751612cee96d65070b4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu May 18 22:21:12 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 18 22:21:12 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d790d32d
sec-keys/openpgp-keys-gentoo-developers: add 20230515
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230515.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 864f45eec61c..15b1dca95fd2 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
+DIST openpgp-keys-gentoo-developers-20230515-active-devs.gpg 3093773 BLAKE2B 481e754067cf3ecdce5792490bda2ea9a8afa412c3b6442955f588b2a1c084032ec9d191b39a1931a25e72b291f21dc6e6011b27badd39688420d58743aafa20 SHA512 4c5f7b90e228c639b720932841d404b87cb730929c6955d1441771d1213111375c390aae675176f2a3a99b8dc1d24cdf4f4986f0dfd6025f36d4d84c8eb44c02
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230515.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230515.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230515.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-01 5:54 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-01 5:54 UTC (permalink / raw
To: gentoo-commits
commit: 0376c4ac61b2834b81d5c7a7f16cad22249841f6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 1 05:53:24 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 1 05:53:24 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0376c4ac
sec-keys/openpgp-keys-gentoo-developers: add 20230529
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230529.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index d379dbaae2a0..52f94b213260 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233
DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
DIST openpgp-keys-gentoo-developers-20230515-active-devs.gpg 3093773 BLAKE2B 481e754067cf3ecdce5792490bda2ea9a8afa412c3b6442955f588b2a1c084032ec9d191b39a1931a25e72b291f21dc6e6011b27badd39688420d58743aafa20 SHA512 4c5f7b90e228c639b720932841d404b87cb730929c6955d1441771d1213111375c390aae675176f2a3a99b8dc1d24cdf4f4986f0dfd6025f36d4d84c8eb44c02
DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
+DIST openpgp-keys-gentoo-developers-20230529-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230529.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230529.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230529.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-01 5:54 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-01 5:54 UTC (permalink / raw
To: gentoo-commits
commit: 92a6e5fff44afe50674097e9635471c39c67b30d
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 1 05:53:34 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 1 05:53:34 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92a6e5ff
sec-keys/openpgp-keys-gentoo-developers: drop 20230508, 20230515
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20230508.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230515.ebuild | 233 ---------------------
3 files changed, 468 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 52f94b213260..b08e17dfeabb 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,5 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
-DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
-DIST openpgp-keys-gentoo-developers-20230515-active-devs.gpg 3093773 BLAKE2B 481e754067cf3ecdce5792490bda2ea9a8afa412c3b6442955f588b2a1c084032ec9d191b39a1931a25e72b291f21dc6e6011b27badd39688420d58743aafa20 SHA512 4c5f7b90e228c639b720932841d404b87cb730929c6955d1441771d1213111375c390aae675176f2a3a99b8dc1d24cdf4f4986f0dfd6025f36d4d84c8eb44c02
DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
DIST openpgp-keys-gentoo-developers-20230529-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230508.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230515.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230515.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230515.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-01 5:54 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-01 5:54 UTC (permalink / raw
To: gentoo-commits
commit: 44feaeb7a66b3a11317cd3077c4d7924a5befe51
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 1 05:52:44 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 1 05:52:44 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44feaeb7
sec-keys/openpgp-keys-gentoo-developers: add 20230522
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230522.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 15b1dca95fd2..d379dbaae2a0 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-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230508-active-devs.gpg 3084780 BLAKE2B e7bdf7d2dd4031c63b8acc326c4f11b1f31639d97fa18eb37ec40805789e6c574d5443b0028f204375d0854e661ed2893ca960e9663b41c67b91d87d4e50466d SHA512 bcd0bc704e36dbfdb37cce3739336af7767c64eb9e443607c743c608274676b779e158bdb34ab22d6da6921c3c7b43ecd729c856600c530757fb7da020bf9d67
DIST openpgp-keys-gentoo-developers-20230515-active-devs.gpg 3093773 BLAKE2B 481e754067cf3ecdce5792490bda2ea9a8afa412c3b6442955f588b2a1c084032ec9d191b39a1931a25e72b291f21dc6e6011b27badd39688420d58743aafa20 SHA512 4c5f7b90e228c639b720932841d404b87cb730929c6955d1441771d1213111375c390aae675176f2a3a99b8dc1d24cdf4f4986f0dfd6025f36d4d84c8eb44c02
+DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 3:08 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 3:08 UTC (permalink / raw
To: gentoo-commits
commit: 540eaf11d864afb72f00befb1353f8f27af51414
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 03:07:14 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 03:07:14 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=540eaf11
sec-keys/openpgp-keys-gentoo-developers: add 20230605
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230605.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index b08e17dfeabb..1dd9f7104f27 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-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
DIST openpgp-keys-gentoo-developers-20230529-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
+DIST openpgp-keys-gentoo-developers-20230605-active-devs.gpg 3090284 BLAKE2B 38e913e1d45a4fe18135c25e8f887400ff6a19fd93a3a5d645aae9635e4ad9251ed13c4f2a8b78bf6b0cc54acb0c8a96d7869bb9f2ab62124c9f41a614a0e857 SHA512 a94493497a2aa389fbd8b2675990036cc6d09a9563a4fe8e7fa15f2b74eead7a55189315c97dbb68ce7a047abe4111d6d1dea39ca4ba357c11465bde99e9575f
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230605.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230605.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230605.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 3:08 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 3:08 UTC (permalink / raw
To: gentoo-commits
commit: caf529eb34ddb192d13708ebd3302f6aff2b68c9
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 03:07:52 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 03:07:52 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=caf529eb
sec-keys/openpgp-keys-gentoo-developers: add 20230612
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230612.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 1dd9f7104f27..060457b6b878 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233
DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
DIST openpgp-keys-gentoo-developers-20230529-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
DIST openpgp-keys-gentoo-developers-20230605-active-devs.gpg 3090284 BLAKE2B 38e913e1d45a4fe18135c25e8f887400ff6a19fd93a3a5d645aae9635e4ad9251ed13c4f2a8b78bf6b0cc54acb0c8a96d7869bb9f2ab62124c9f41a614a0e857 SHA512 a94493497a2aa389fbd8b2675990036cc6d09a9563a4fe8e7fa15f2b74eead7a55189315c97dbb68ce7a047abe4111d6d1dea39ca4ba357c11465bde99e9575f
+DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
new file mode 100644
index 000000000000..efd0694ab707
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 3:08 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 3:08 UTC (permalink / raw
To: gentoo-commits
commit: 8993bf204688352fcba7c29a5a039378c07b7faf
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 03:08:06 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 03:08:06 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8993bf20
sec-keys/openpgp-keys-gentoo-developers: drop 20230522, 20230529
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20230522.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230529.ebuild | 233 ---------------------
3 files changed, 468 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 060457b6b878..98ae84c85c89 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,5 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
-DIST openpgp-keys-gentoo-developers-20230522-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
-DIST openpgp-keys-gentoo-developers-20230529-active-devs.gpg 3094133 BLAKE2B f6c9ea88ab0bb97e4a43731705d346e75b21b0ccd0c7fbf6c0e4c1cd8408cd7e27c14e3e6bf2c1a60853d27bc8ec6881d2d5832e15bb6bd265a15f95e61d1b46 SHA512 72febc57dbeb9a4ea8431f2d36870181e91b019b414fbba1660689fea574f10881e39ca36ab9b6a648b3297cfef10123b191c5c7d643c07087a267b0f993f580
DIST openpgp-keys-gentoo-developers-20230605-active-devs.gpg 3090284 BLAKE2B 38e913e1d45a4fe18135c25e8f887400ff6a19fd93a3a5d645aae9635e4ad9251ed13c4f2a8b78bf6b0cc54acb0c8a96d7869bb9f2ab62124c9f41a614a0e857 SHA512 a94493497a2aa389fbd8b2675990036cc6d09a9563a4fe8e7fa15f2b74eead7a55189315c97dbb68ce7a047abe4111d6d1dea39ca4ba357c11465bde99e9575f
DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230522.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230529.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230529.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230529.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 3:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 3:10 UTC (permalink / raw
To: gentoo-commits
commit: 1c9e9921058a4fa8638bdeb21a89f57b2f018c64
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 03:09:49 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 03:09:49 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c9e9921
sec-keys/openpgp-keys-gentoo-developers: sync live
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-99999999.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 1a85a072b1d8..fda85a259ff6 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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 3:10 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 3:10 UTC (permalink / raw
To: gentoo-commits
commit: 8ddbe9701d35cd9084db3e765c392b04c6b510cb
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 03:09:36 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 03:09:36 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ddbe970
sec-keys/openpgp-keys-gentoo-developers: enable py3.12
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230612.ebuild | 2 +-
.../openpgp-keys-gentoo-developers-99999999.ebuild | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
index efd0694ab707..fda85a259ff6 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{10..12} )
inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
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 19dd6bb3b88d..1a85a072b1d8 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
@@ -3,7 +3,7 @@
EAPI=8
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{10..12} )
inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-14 4:07 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-14 4:07 UTC (permalink / raw
To: gentoo-commits
commit: 43ab5cec16866f54fd7acc88f2fee5d4aeab7d35
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 04:06:58 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 04:06:58 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43ab5cec
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20230612 ALLARCHES, #908470
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230612.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-24 5:02 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-24 5:02 UTC (permalink / raw
To: gentoo-commits
commit: a6c4569a99b46b13cebe2394b6a1d94c4777c25d
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 24 04:58:28 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 24 05:01:49 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6c4569a
sec-keys/openpgp-keys-gentoo-developers: add 20230619
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230619.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 98ae84c85c89..d22ad0788d5f 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-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
DIST openpgp-keys-gentoo-developers-20230605-active-devs.gpg 3090284 BLAKE2B 38e913e1d45a4fe18135c25e8f887400ff6a19fd93a3a5d645aae9635e4ad9251ed13c4f2a8b78bf6b0cc54acb0c8a96d7869bb9f2ab62124c9f41a614a0e857 SHA512 a94493497a2aa389fbd8b2675990036cc6d09a9563a4fe8e7fa15f2b74eead7a55189315c97dbb68ce7a047abe4111d6d1dea39ca4ba357c11465bde99e9575f
DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
+DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230619.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230619.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230619.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-06-24 5:02 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-06-24 5:02 UTC (permalink / raw
To: gentoo-commits
commit: 7c70a8506d1ed74f7a9f119c1ecba16449c87e58
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 24 04:58:35 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 24 05:01:50 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c70a850
sec-keys/openpgp-keys-gentoo-developers: drop 20230403, 20230605
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20230403.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230605.ebuild | 233 ---------------------
3 files changed, 468 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index d22ad0788d5f..d7f954e7dda8 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,4 +1,2 @@
-DIST openpgp-keys-gentoo-developers-20230403-active-devs.gpg 3033398 BLAKE2B 233549fa600d855df1f4130224c63b10d0df3312886bef1c0486553db3025554a4fff7af104a3f0869390d53837a8d0182d830432e855273da28c753ea579d7e SHA512 33264b9ef002656f5c58dc2b2ff568d01b624c68e2e42db0d388b9a99b45c2d605df0d5db7b5029c0946f524fa7168252ba87908336e6f9ad0717c20d43cd112
-DIST openpgp-keys-gentoo-developers-20230605-active-devs.gpg 3090284 BLAKE2B 38e913e1d45a4fe18135c25e8f887400ff6a19fd93a3a5d645aae9635e4ad9251ed13c4f2a8b78bf6b0cc54acb0c8a96d7869bb9f2ab62124c9f41a614a0e857 SHA512 a94493497a2aa389fbd8b2675990036cc6d09a9563a4fe8e7fa15f2b74eead7a55189315c97dbb68ce7a047abe4111d6d1dea39ca4ba357c11465bde99e9575f
DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
deleted file mode 100644
index 3c30975acd6f..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230403.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230605.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230605.ebuild
deleted file mode 100644
index efd0694ab707..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230605.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-07-19 20:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-07-19 20:25 UTC (permalink / raw
To: gentoo-commits
commit: 418259603db476fe1579aacfa42862d7a3407257
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 19 20:22:42 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 19 20:22:42 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41825960
sec-keys/openpgp-keys-gentoo-developers: add 20230703
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230703.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 94ba224a72d1..27c514b7fdd7 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-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
DIST openpgp-keys-gentoo-developers-20230626-active-devs.gpg 3115295 BLAKE2B 60f1aa4c7ac4a7066c27b888ec815ea92eb66c028435ca45fdb7db7067dc80fd6a639054cd98acd0780cea0a90dfd58875e7979e8d1825762290c3e21d807d80 SHA512 fb9e7324b7f029ca63b96406477a725fd53a8d3e2020e8d0b25b6ea1e94dc9723bfcf57fcffabed090f879c325f5a533e32554b1a2896cb8c6dc08f9516c057c
+DIST openpgp-keys-gentoo-developers-20230703-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230703.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230703.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230703.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-07-19 20:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-07-19 20:25 UTC (permalink / raw
To: gentoo-commits
commit: 76592757bc94450e7add7babd487a314f9bef5e6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 19 20:24:34 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 19 20:24:34 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76592757
sec-keys/openpgp-keys-gentoo-developers: add 20230717
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230717.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 4d8749c0e05c..deabe3e8a074 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -3,3 +3,4 @@ DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a2
DIST openpgp-keys-gentoo-developers-20230626-active-devs.gpg 3115295 BLAKE2B 60f1aa4c7ac4a7066c27b888ec815ea92eb66c028435ca45fdb7db7067dc80fd6a639054cd98acd0780cea0a90dfd58875e7979e8d1825762290c3e21d807d80 SHA512 fb9e7324b7f029ca63b96406477a725fd53a8d3e2020e8d0b25b6ea1e94dc9723bfcf57fcffabed090f879c325f5a533e32554b1a2896cb8c6dc08f9516c057c
DIST openpgp-keys-gentoo-developers-20230703-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
DIST openpgp-keys-gentoo-developers-20230710-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
+DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-07-19 20:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-07-19 20:25 UTC (permalink / raw
To: gentoo-commits
commit: c330087215881ae1aee9c766286765dc9982bbbe
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 19 20:23:48 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 19 20:23:48 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3300872
sec-keys/openpgp-keys-gentoo-developers: add 20230710
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230710.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 27c514b7fdd7..4d8749c0e05c 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8
DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
DIST openpgp-keys-gentoo-developers-20230626-active-devs.gpg 3115295 BLAKE2B 60f1aa4c7ac4a7066c27b888ec815ea92eb66c028435ca45fdb7db7067dc80fd6a639054cd98acd0780cea0a90dfd58875e7979e8d1825762290c3e21d807d80 SHA512 fb9e7324b7f029ca63b96406477a725fd53a8d3e2020e8d0b25b6ea1e94dc9723bfcf57fcffabed090f879c325f5a533e32554b1a2896cb8c6dc08f9516c057c
DIST openpgp-keys-gentoo-developers-20230703-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
+DIST openpgp-keys-gentoo-developers-20230710-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230710.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230710.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230710.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-07-19 20:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-07-19 20:25 UTC (permalink / raw
To: gentoo-commits
commit: 16a648f65ea25acbe44cec575337653a128abd48
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 19 20:21:39 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 19 20:21:39 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16a648f6
sec-keys/openpgp-keys-gentoo-developers: add 20230626
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230626.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index d7f954e7dda8..94ba224a72d1 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
+DIST openpgp-keys-gentoo-developers-20230626-active-devs.gpg 3115295 BLAKE2B 60f1aa4c7ac4a7066c27b888ec815ea92eb66c028435ca45fdb7db7067dc80fd6a639054cd98acd0780cea0a90dfd58875e7979e8d1825762290c3e21d807d80 SHA512 fb9e7324b7f029ca63b96406477a725fd53a8d3e2020e8d0b25b6ea1e94dc9723bfcf57fcffabed090f879c325f5a533e32554b1a2896cb8c6dc08f9516c057c
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230626.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230626.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230626.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-08-04 11:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-08-04 11:25 UTC (permalink / raw
To: gentoo-commits
commit: f51fdd758fad79c7d157776135ce0b8e58458c79
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 4 11:25:00 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 4 11:25:41 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f51fdd75
sec-keys/openpgp-keys-gentoo-developers: add 20230731
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230731.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 762a16587016..87b6590aa3a8 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
+DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21a16fe51f5d98f994299969a231fd77ba4904afe13acb40a8238f64f93efdfe824867897d607327d8208c7c59b4aad839453d88ff92b24b52e093c38d6e594 SHA512 4065ea276b0a911841faf8bec4f5b5c0a763fef0243d1538bae0c29e89cd0e1278d95143e0b9f24efdfd0bef5fd4f945a8666bb0b59f58fc0ede117228e6f45d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230731.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230731.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230731.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-08-04 11:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-08-04 11:25 UTC (permalink / raw
To: gentoo-commits
commit: 1648f66d20cf49934a76a50f0dd5609563fdce53
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 4 11:15:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 4 11:16:16 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1648f66d
sec-keys/openpgp-keys-gentoo-developers: stabilize 20230717 for ALLARCHES
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230717.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-08-04 11:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-08-04 11:25 UTC (permalink / raw
To: gentoo-commits
commit: a8ea3078fd538d962e252e37efe8ba02a77e13b5
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 4 11:24:29 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 4 11:25:39 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8ea3078
sec-keys/openpgp-keys-gentoo-developers: add 20230724
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230724.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 5d0a9d2f8448..762a16587016 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
+DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-08-04 11:25 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-08-04 11:25 UTC (permalink / raw
To: gentoo-commits
commit: 5753c2b39559972d6d781532fc13f2b714013309
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 4 11:16:12 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 4 11:16:17 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5753c2b3
sec-keys/openpgp-keys-gentoo-developers: drop versions
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 5 -
.../openpgp-keys-gentoo-developers-20230612.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230619.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230626.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230703.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230710.ebuild | 233 ---------------------
6 files changed, 1170 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index deabe3e8a074..5d0a9d2f8448 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,6 +1 @@
-DIST openpgp-keys-gentoo-developers-20230612-active-devs.gpg 3093884 BLAKE2B bd8ca7f39b9b31187479f73031358af3285b5ca320794e660af3f93750c38e75be4e1d19fafc5735fc46d1ba6bebdc82a5e1954e72b1f2bf01b3e348ba0389a1 SHA512 8a98a086f6696632552e4b6a40168bafffae85f8da8fc9a993125c0c03fb45174fa46f05572c3c17d3effe3a77ccaeef5ab34cf1ebd430d0bbfff140ecf617c1
-DIST openpgp-keys-gentoo-developers-20230619-active-devs.gpg 3104963 BLAKE2B 1a23171097c697d2991617b6e0920cfed2d78f111241436251db1ed97e1a79ed5649931a788013a85402f928f5e348620d99144e6ea50f9639869bfe1a477766 SHA512 3b82bdcffc2663891bf962b566754cd15608c0227ef928b357133b87576c82f9e31b082e5969192ddbf5cf02d854483b96bf81386c7369c074537edefa62d35e
-DIST openpgp-keys-gentoo-developers-20230626-active-devs.gpg 3115295 BLAKE2B 60f1aa4c7ac4a7066c27b888ec815ea92eb66c028435ca45fdb7db7067dc80fd6a639054cd98acd0780cea0a90dfd58875e7979e8d1825762290c3e21d807d80 SHA512 fb9e7324b7f029ca63b96406477a725fd53a8d3e2020e8d0b25b6ea1e94dc9723bfcf57fcffabed090f879c325f5a533e32554b1a2896cb8c6dc08f9516c057c
-DIST openpgp-keys-gentoo-developers-20230703-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
-DIST openpgp-keys-gentoo-developers-20230710-active-devs.gpg 3133493 BLAKE2B e87e34262d41b1fe1c49ed3cf7da93268a7c5b451ed06ab6e28554b7f09fafcc01b0c1171d1014539105891bde55f3b91fbefbe28538eda35a4e0d85fdf220e2 SHA512 f94890230712bf71ffc25e17566249d974c7b2dc956356770db29ab0eec8ea9fcf09d99e65ece232643dbd9e088b29eb691100c73e5fcd09abb027bd61dcd77d
DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230612.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230619.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230619.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230619.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230626.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230626.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230626.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230703.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230703.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230703.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230710.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230710.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230710.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-01 2:29 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-01 2:29 UTC (permalink / raw
To: gentoo-commits
commit: 5f6ef04681852dfbddb8af3a70640d6299af01da
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 02:27:54 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 02:27:54 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f6ef046
sec-keys/openpgp-keys-gentoo-developers: add 20230807
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230807.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 87b6590aa3a8..de9e803c20aa 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-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21a16fe51f5d98f994299969a231fd77ba4904afe13acb40a8238f64f93efdfe824867897d607327d8208c7c59b4aad839453d88ff92b24b52e093c38d6e594 SHA512 4065ea276b0a911841faf8bec4f5b5c0a763fef0243d1538bae0c29e89cd0e1278d95143e0b9f24efdfd0bef5fd4f945a8666bb0b59f58fc0ede117228e6f45d
+DIST openpgp-keys-gentoo-developers-20230807-active-devs.gpg 3110732 BLAKE2B 10a5ee919a8c53a847b04a1c4b57e5934112d21daffd9a91cbd27d6813b687870f11632d908f10a435e6ea82b3228838d9486040dff900e2fabfda0019224521 SHA512 c6e40d79091821d5c4286e9e65a1611b3c974202c2cd1e2f2d751fa10eba761b4ca4db9009bc8b77dead4d3627038ea208e9fc0fe93ac3098076f9a7721f2f75
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230807.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230807.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230807.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-01 2:29 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-01 2:29 UTC (permalink / raw
To: gentoo-commits
commit: 251b7e7e165bad3e9e6363dab328ef693351ac3a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 02:29:42 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 02:29:42 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=251b7e7e
sec-keys/openpgp-keys-gentoo-developers: add 20230828
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230828.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 5e35db5b9a86..b814f5f880fb 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -4,3 +4,4 @@ DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21
DIST openpgp-keys-gentoo-developers-20230807-active-devs.gpg 3110732 BLAKE2B 10a5ee919a8c53a847b04a1c4b57e5934112d21daffd9a91cbd27d6813b687870f11632d908f10a435e6ea82b3228838d9486040dff900e2fabfda0019224521 SHA512 c6e40d79091821d5c4286e9e65a1611b3c974202c2cd1e2f2d751fa10eba761b4ca4db9009bc8b77dead4d3627038ea208e9fc0fe93ac3098076f9a7721f2f75
DIST openpgp-keys-gentoo-developers-20230814-active-devs.gpg 3099095 BLAKE2B 5519cecf793f214f4860109796872850c5f1aece0b5efc9b79554db75e512033b96baa9630e2456e45484fcc8903c19e2789859d316bbfc2fb6547eb857e38a0 SHA512 82daf2251d61d179fcd00f9e9e0dbea005e90bd541e2edc209abe3be91637a1a39d64860b29705f35685ff911d946129c6c869ec291a328253b92c1dd7bee529
DIST openpgp-keys-gentoo-developers-20230821-active-devs.gpg 3099455 BLAKE2B c3a090a12639d73597cf74f8e8ee392cf0416f7b0411add1b1af0db20461b1b78ed6c14d028b6ed8d82218a158409bc483ce17bb86acae037350adcfd5f83e31 SHA512 78eae46850dfffec063651309526010ead55a3f0d6914d87e4c9fe15d6679ef45f3dc7b8587a7d6a172c0cb5545c1fd86b6756164132c957a1d442482eec214e
+DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-01 2:29 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-01 2:29 UTC (permalink / raw
To: gentoo-commits
commit: 98e04bb3345598297388895a23c8032223b064be
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 02:28:35 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 02:28:35 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98e04bb3
sec-keys/openpgp-keys-gentoo-developers: add 20230814
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230814.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index de9e803c20aa..7ca22f564074 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 817
DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21a16fe51f5d98f994299969a231fd77ba4904afe13acb40a8238f64f93efdfe824867897d607327d8208c7c59b4aad839453d88ff92b24b52e093c38d6e594 SHA512 4065ea276b0a911841faf8bec4f5b5c0a763fef0243d1538bae0c29e89cd0e1278d95143e0b9f24efdfd0bef5fd4f945a8666bb0b59f58fc0ede117228e6f45d
DIST openpgp-keys-gentoo-developers-20230807-active-devs.gpg 3110732 BLAKE2B 10a5ee919a8c53a847b04a1c4b57e5934112d21daffd9a91cbd27d6813b687870f11632d908f10a435e6ea82b3228838d9486040dff900e2fabfda0019224521 SHA512 c6e40d79091821d5c4286e9e65a1611b3c974202c2cd1e2f2d751fa10eba761b4ca4db9009bc8b77dead4d3627038ea208e9fc0fe93ac3098076f9a7721f2f75
+DIST openpgp-keys-gentoo-developers-20230814-active-devs.gpg 3099095 BLAKE2B 5519cecf793f214f4860109796872850c5f1aece0b5efc9b79554db75e512033b96baa9630e2456e45484fcc8903c19e2789859d316bbfc2fb6547eb857e38a0 SHA512 82daf2251d61d179fcd00f9e9e0dbea005e90bd541e2edc209abe3be91637a1a39d64860b29705f35685ff911d946129c6c869ec291a328253b92c1dd7bee529
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230814.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230814.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230814.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-01 2:29 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-01 2:29 UTC (permalink / raw
To: gentoo-commits
commit: 6c82ff88b77e9da9ac0fa29effee8cdbc23b058a
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 02:29:12 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 02:29:12 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c82ff88
sec-keys/openpgp-keys-gentoo-developers: add 20230821
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230821.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 7ca22f564074..5e35db5b9a86 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -3,3 +3,4 @@ DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 817
DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21a16fe51f5d98f994299969a231fd77ba4904afe13acb40a8238f64f93efdfe824867897d607327d8208c7c59b4aad839453d88ff92b24b52e093c38d6e594 SHA512 4065ea276b0a911841faf8bec4f5b5c0a763fef0243d1538bae0c29e89cd0e1278d95143e0b9f24efdfd0bef5fd4f945a8666bb0b59f58fc0ede117228e6f45d
DIST openpgp-keys-gentoo-developers-20230807-active-devs.gpg 3110732 BLAKE2B 10a5ee919a8c53a847b04a1c4b57e5934112d21daffd9a91cbd27d6813b687870f11632d908f10a435e6ea82b3228838d9486040dff900e2fabfda0019224521 SHA512 c6e40d79091821d5c4286e9e65a1611b3c974202c2cd1e2f2d751fa10eba761b4ca4db9009bc8b77dead4d3627038ea208e9fc0fe93ac3098076f9a7721f2f75
DIST openpgp-keys-gentoo-developers-20230814-active-devs.gpg 3099095 BLAKE2B 5519cecf793f214f4860109796872850c5f1aece0b5efc9b79554db75e512033b96baa9630e2456e45484fcc8903c19e2789859d316bbfc2fb6547eb857e38a0 SHA512 82daf2251d61d179fcd00f9e9e0dbea005e90bd541e2edc209abe3be91637a1a39d64860b29705f35685ff911d946129c6c869ec291a328253b92c1dd7bee529
+DIST openpgp-keys-gentoo-developers-20230821-active-devs.gpg 3099455 BLAKE2B c3a090a12639d73597cf74f8e8ee392cf0416f7b0411add1b1af0db20461b1b78ed6c14d028b6ed8d82218a158409bc483ce17bb86acae037350adcfd5f83e31 SHA512 78eae46850dfffec063651309526010ead55a3f0d6914d87e4c9fe15d6679ef45f3dc7b8587a7d6a172c0cb5545c1fd86b6756164132c957a1d442482eec214e
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230821.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230821.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230821.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-03 7:24 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-03 7:24 UTC (permalink / raw
To: gentoo-commits
commit: bbb666b51dc8715997e537300d5f110a90288fde
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 3 07:23:27 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 3 07:23:51 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbb666b5
sec-keys/openpgp-keys-gentoo-developers: stabilize 20230828 for ALLARCHES
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230828.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-03 7:24 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-03 7:24 UTC (permalink / raw
To: gentoo-commits
commit: 2480b01919bf56bcbba13f70b2b4a0836dcb922e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 3 07:23:43 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 3 07:23:51 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2480b019
sec-keys/openpgp-keys-gentoo-developers: drop versions
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 5 -
.../openpgp-keys-gentoo-developers-20230724.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230731.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230807.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230814.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230821.ebuild | 233 ---------------------
6 files changed, 1170 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index b814f5f880fb..aed5c197ea31 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,7 +1,2 @@
DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
-DIST openpgp-keys-gentoo-developers-20230724-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
-DIST openpgp-keys-gentoo-developers-20230731-active-devs.gpg 3108002 BLAKE2B c21a16fe51f5d98f994299969a231fd77ba4904afe13acb40a8238f64f93efdfe824867897d607327d8208c7c59b4aad839453d88ff92b24b52e093c38d6e594 SHA512 4065ea276b0a911841faf8bec4f5b5c0a763fef0243d1538bae0c29e89cd0e1278d95143e0b9f24efdfd0bef5fd4f945a8666bb0b59f58fc0ede117228e6f45d
-DIST openpgp-keys-gentoo-developers-20230807-active-devs.gpg 3110732 BLAKE2B 10a5ee919a8c53a847b04a1c4b57e5934112d21daffd9a91cbd27d6813b687870f11632d908f10a435e6ea82b3228838d9486040dff900e2fabfda0019224521 SHA512 c6e40d79091821d5c4286e9e65a1611b3c974202c2cd1e2f2d751fa10eba761b4ca4db9009bc8b77dead4d3627038ea208e9fc0fe93ac3098076f9a7721f2f75
-DIST openpgp-keys-gentoo-developers-20230814-active-devs.gpg 3099095 BLAKE2B 5519cecf793f214f4860109796872850c5f1aece0b5efc9b79554db75e512033b96baa9630e2456e45484fcc8903c19e2789859d316bbfc2fb6547eb857e38a0 SHA512 82daf2251d61d179fcd00f9e9e0dbea005e90bd541e2edc209abe3be91637a1a39d64860b29705f35685ff911d946129c6c869ec291a328253b92c1dd7bee529
-DIST openpgp-keys-gentoo-developers-20230821-active-devs.gpg 3099455 BLAKE2B c3a090a12639d73597cf74f8e8ee392cf0416f7b0411add1b1af0db20461b1b78ed6c14d028b6ed8d82218a158409bc483ce17bb86acae037350adcfd5f83e31 SHA512 78eae46850dfffec063651309526010ead55a3f0d6914d87e4c9fe15d6679ef45f3dc7b8587a7d6a172c0cb5545c1fd86b6756164132c957a1d442482eec214e
DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230724.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230731.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230731.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230731.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230807.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230807.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230807.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230814.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230814.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230814.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230821.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230821.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230821.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-07 8:04 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-07 8:04 UTC (permalink / raw
To: gentoo-commits
commit: 5d6e53f22b3f7e463a394c816c36dd5c8b1d7b4b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 7 08:02:28 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 7 08:02:28 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d6e53f2
sec-keys/openpgp-keys-gentoo-developers: add 20230904
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230904.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index aed5c197ea31..4c5bf1179f8f 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
+DIST openpgp-keys-gentoo-developers-20230904-active-devs.gpg 3101925 BLAKE2B d49e8c43979ce0c57275e866d753cdf8ddd56a323f49706431a3fa2c30c432a197107051cc7600bafb25626dac0b60f3a787b6106b29dfa0573828bdebad8f2e SHA512 9f3bae591970a26e194e97e5e44a2bb5e510d4e87bc2e334ad75edbb90be5413b12b34b73123ff7d65b26069b7c64fbd0db4747837921965a041adb2f0d5028a
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230904.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230904.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230904.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-16 12:53 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-16 12:53 UTC (permalink / raw
To: gentoo-commits
commit: da5fb443d43dea9b2ceed2cc74b885db82412333
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 16 12:52:59 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 16 12:52:59 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da5fb443
sec-keys/openpgp-keys-gentoo-developers: add 20230911
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230911.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 4c5bf1179f8f..0d9aee280a5f 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-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
DIST openpgp-keys-gentoo-developers-20230904-active-devs.gpg 3101925 BLAKE2B d49e8c43979ce0c57275e866d753cdf8ddd56a323f49706431a3fa2c30c432a197107051cc7600bafb25626dac0b60f3a787b6106b29dfa0573828bdebad8f2e SHA512 9f3bae591970a26e194e97e5e44a2bb5e510d4e87bc2e334ad75edbb90be5413b12b34b73123ff7d65b26069b7c64fbd0db4747837921965a041adb2f0d5028a
+DIST openpgp-keys-gentoo-developers-20230911-active-devs.gpg 3107469 BLAKE2B eae368d380cb93e03c66926b04fa86ca21c0a7cc591668bd28b62d7483e3be483610c373a871fbcbe2a10361ee981d7f00f9d6204c244b838cc74b70edd7639c SHA512 224e548915e9d878b22837f695ecf1b1a24f7ea2be45fe2e057cd5a4a814ae4132ba8dd6e2e032a4d4662e7ed0063e84e90e445ee46ced6dc56955fa3a968097
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230911.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230911.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230911.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-25 1:48 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-25 1:48 UTC (permalink / raw
To: gentoo-commits
commit: 24eea3cebc4d5d4bcfa3b193e4fb961d07b4d47c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 25 01:47:57 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 01:48:20 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24eea3ce
sec-keys/openpgp-keys-gentoo-developers: add 20230918
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230918.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 0d9aee280a5f..c580b378321d 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 817
DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
DIST openpgp-keys-gentoo-developers-20230904-active-devs.gpg 3101925 BLAKE2B d49e8c43979ce0c57275e866d753cdf8ddd56a323f49706431a3fa2c30c432a197107051cc7600bafb25626dac0b60f3a787b6106b29dfa0573828bdebad8f2e SHA512 9f3bae591970a26e194e97e5e44a2bb5e510d4e87bc2e334ad75edbb90be5413b12b34b73123ff7d65b26069b7c64fbd0db4747837921965a041adb2f0d5028a
DIST openpgp-keys-gentoo-developers-20230911-active-devs.gpg 3107469 BLAKE2B eae368d380cb93e03c66926b04fa86ca21c0a7cc591668bd28b62d7483e3be483610c373a871fbcbe2a10361ee981d7f00f9d6204c244b838cc74b70edd7639c SHA512 224e548915e9d878b22837f695ecf1b1a24f7ea2be45fe2e057cd5a4a814ae4132ba8dd6e2e032a4d4662e7ed0063e84e90e445ee46ced6dc56955fa3a968097
+DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230918.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230918.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230918.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-27 3:03 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-27 3:03 UTC (permalink / raw
To: gentoo-commits
commit: f61b88e831f9ba7e51fb3cf7de18108689fd928f
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 27 03:03:41 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 27 03:03:41 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f61b88e8
sec-keys/openpgp-keys-gentoo-developers: drop 20230717, 20230904, 20230911
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 3 -
.../openpgp-keys-gentoo-developers-20230717.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230904.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230911.ebuild | 233 ---------------------
4 files changed, 702 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index b993bfda85d7..60f75abc8174 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,6 +1,3 @@
-DIST openpgp-keys-gentoo-developers-20230717-active-devs.gpg 3104679 BLAKE2B 81777f536f342de356bdc9e5bc6b8b3319bec058c5fff663c80db6b9acbfc625703bf66bbc271c9dbb53de714dc581637ae01bfcd750174579410813c64717c4 SHA512 6f6f5d50d24acaec7774497fb8dc01e240e9b8f93578b5b08ef097b02299c2116deb87264fa3ce3144dc6fbb28d9e2d7363ed2505f5e264d783901b581262105
DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
-DIST openpgp-keys-gentoo-developers-20230904-active-devs.gpg 3101925 BLAKE2B d49e8c43979ce0c57275e866d753cdf8ddd56a323f49706431a3fa2c30c432a197107051cc7600bafb25626dac0b60f3a787b6106b29dfa0573828bdebad8f2e SHA512 9f3bae591970a26e194e97e5e44a2bb5e510d4e87bc2e334ad75edbb90be5413b12b34b73123ff7d65b26069b7c64fbd0db4747837921965a041adb2f0d5028a
-DIST openpgp-keys-gentoo-developers-20230911-active-devs.gpg 3107469 BLAKE2B eae368d380cb93e03c66926b04fa86ca21c0a7cc591668bd28b62d7483e3be483610c373a871fbcbe2a10361ee981d7f00f9d6204c244b838cc74b70edd7639c SHA512 224e548915e9d878b22837f695ecf1b1a24f7ea2be45fe2e057cd5a4a814ae4132ba8dd6e2e032a4d4662e7ed0063e84e90e445ee46ced6dc56955fa3a968097
DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230717.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230904.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230904.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230904.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230911.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230911.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230911.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-27 3:03 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-27 3:03 UTC (permalink / raw
To: gentoo-commits
commit: 512aa127a93c6cbadb5894255e9cb66492a980ec
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 27 03:02:57 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 27 03:02:57 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=512aa127
sec-keys/openpgp-keys-gentoo-developers: add 20230925
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20230925.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index c580b378321d..b993bfda85d7 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -3,3 +3,4 @@ DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd
DIST openpgp-keys-gentoo-developers-20230904-active-devs.gpg 3101925 BLAKE2B d49e8c43979ce0c57275e866d753cdf8ddd56a323f49706431a3fa2c30c432a197107051cc7600bafb25626dac0b60f3a787b6106b29dfa0573828bdebad8f2e SHA512 9f3bae591970a26e194e97e5e44a2bb5e510d4e87bc2e334ad75edbb90be5413b12b34b73123ff7d65b26069b7c64fbd0db4747837921965a041adb2f0d5028a
DIST openpgp-keys-gentoo-developers-20230911-active-devs.gpg 3107469 BLAKE2B eae368d380cb93e03c66926b04fa86ca21c0a7cc591668bd28b62d7483e3be483610c373a871fbcbe2a10361ee981d7f00f9d6204c244b838cc74b70edd7639c SHA512 224e548915e9d878b22837f695ecf1b1a24f7ea2be45fe2e057cd5a4a814ae4132ba8dd6e2e032a4d4662e7ed0063e84e90e445ee46ced6dc56955fa3a968097
DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
+DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-09-27 3:03 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-09-27 3:03 UTC (permalink / raw
To: gentoo-commits
commit: 73fa1524f8905bf84122d73df15e63fa0bfd3f49
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 27 03:03:09 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 27 03:03:09 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73fa1524
sec-keys/openpgp-keys-gentoo-developers: stabilize 20230925 for ALLARCHES
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20230925.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-10-08 1:04 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-10-08 1:04 UTC (permalink / raw
To: gentoo-commits
commit: dbf1d7f149cae21161dd4af9e9ee14a6c38c3fe7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 8 00:24:22 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 8 00:26:51 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbf1d7f1
sec-keys/openpgp-keys-gentoo-developers: add 20231002
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231002.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 60f75abc8174..310169f339b4 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-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
+DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-10-21 23:11 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-10-21 23:11 UTC (permalink / raw
To: gentoo-commits
commit: d0a1a039c6e2fa5385afcc6b35435261a901cdf4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 21 23:10:35 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 21 23:10:35 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0a1a039
sec-keys/openpgp-keys-gentoo-developers: add 20231009
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231009.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 310169f339b4..806c69c67665 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd
DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
+DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231009.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231009.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231009.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-10-21 23:11 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-10-21 23:11 UTC (permalink / raw
To: gentoo-commits
commit: 1ddadbb67ff6baf9da3effefde3c7f24afffd83f
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 21 23:11:13 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 21 23:11:13 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ddadbb6
sec-keys/openpgp-keys-gentoo-developers: add 20231016
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231016.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 806c69c67665..1b0034f6f595 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -3,3 +3,4 @@ DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
+DIST openpgp-keys-gentoo-developers-20231016-active-devs.gpg 3112154 BLAKE2B d08ce599a3faa7dfdd84cca42110590449ac0ab6bb2e4b98b9f79fc9783a8a095d1d25f00e1b6b8c44b338a24de7cba24464206183a73a6a54da4e035dcd7dd0 SHA512 033373cb3f85adc37d29a5468c8d7e6c1a9fe67a7eb907b8abceeabdcc204d43dc6cae4c03fe67b2fcf156ff757785f2a72039002496e845b1f5bc33d085da7e
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231016.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231016.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231016.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-06 17:15 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-06 17:15 UTC (permalink / raw
To: gentoo-commits
commit: bdb273efc24badb451c9d3abe52c50715e4b5e81
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 6 17:14:53 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 6 17:14:53 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdb273ef
sec-keys/openpgp-keys-gentoo-developers: add 20231030
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231030.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 67ecd42760c4..c58caba043e4 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -5,3 +5,4 @@ DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 138
DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
DIST openpgp-keys-gentoo-developers-20231016-active-devs.gpg 3112154 BLAKE2B d08ce599a3faa7dfdd84cca42110590449ac0ab6bb2e4b98b9f79fc9783a8a095d1d25f00e1b6b8c44b338a24de7cba24464206183a73a6a54da4e035dcd7dd0 SHA512 033373cb3f85adc37d29a5468c8d7e6c1a9fe67a7eb907b8abceeabdcc204d43dc6cae4c03fe67b2fcf156ff757785f2a72039002496e845b1f5bc33d085da7e
DIST openpgp-keys-gentoo-developers-20231023-active-devs.gpg 3115884 BLAKE2B 341492ad68bc6b3a1ae8602e3706d13e7916443f690cd7900c01c0c85031b3f031496dfc78c63675899885e92623b8ae1aed38f80edcb0ebcc15d08a6bc62abb SHA512 cff6a2251440ae99ad9522d192db58fd37d62d2f578f5401b2aea0507345c1eb11e3e25e15572409057457811a001fb383d38f746d02bdcf0c32ef7476c6c971
+DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-06 17:15 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-06 17:15 UTC (permalink / raw
To: gentoo-commits
commit: e60d2438ffb29f13b0853095933b00fdf6f50cd4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 6 17:14:20 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 6 17:14:20 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e60d2438
sec-keys/openpgp-keys-gentoo-developers: add 20231023
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231023.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 1b0034f6f595..67ecd42760c4 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -4,3 +4,4 @@ DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e7
DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
DIST openpgp-keys-gentoo-developers-20231016-active-devs.gpg 3112154 BLAKE2B d08ce599a3faa7dfdd84cca42110590449ac0ab6bb2e4b98b9f79fc9783a8a095d1d25f00e1b6b8c44b338a24de7cba24464206183a73a6a54da4e035dcd7dd0 SHA512 033373cb3f85adc37d29a5468c8d7e6c1a9fe67a7eb907b8abceeabdcc204d43dc6cae4c03fe67b2fcf156ff757785f2a72039002496e845b1f5bc33d085da7e
+DIST openpgp-keys-gentoo-developers-20231023-active-devs.gpg 3115884 BLAKE2B 341492ad68bc6b3a1ae8602e3706d13e7916443f690cd7900c01c0c85031b3f031496dfc78c63675899885e92623b8ae1aed38f80edcb0ebcc15d08a6bc62abb SHA512 cff6a2251440ae99ad9522d192db58fd37d62d2f578f5401b2aea0507345c1eb11e3e25e15572409057457811a001fb383d38f746d02bdcf0c32ef7476c6c971
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231023.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231023.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231023.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-25 5:36 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-25 5:36 UTC (permalink / raw
To: gentoo-commits
commit: 79ef89be91846e11fa8881226e134d35973678ef
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 05:30:05 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 05:30:05 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79ef89be
sec-keys/openpgp-keys-gentoo-developers: drop 20231002, 20231009, 20231016, 20231023
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 4 -
.../openpgp-keys-gentoo-developers-20231002.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20231009.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20231016.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20231023.ebuild | 233 ---------------------
5 files changed, 936 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 5fb50ed72724..0cbe4fc2e680 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,6 +1,2 @@
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
-DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
-DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
-DIST openpgp-keys-gentoo-developers-20231016-active-devs.gpg 3112154 BLAKE2B d08ce599a3faa7dfdd84cca42110590449ac0ab6bb2e4b98b9f79fc9783a8a095d1d25f00e1b6b8c44b338a24de7cba24464206183a73a6a54da4e035dcd7dd0 SHA512 033373cb3f85adc37d29a5468c8d7e6c1a9fe67a7eb907b8abceeabdcc204d43dc6cae4c03fe67b2fcf156ff757785f2a72039002496e845b1f5bc33d085da7e
-DIST openpgp-keys-gentoo-developers-20231023-active-devs.gpg 3115884 BLAKE2B 341492ad68bc6b3a1ae8602e3706d13e7916443f690cd7900c01c0c85031b3f031496dfc78c63675899885e92623b8ae1aed38f80edcb0ebcc15d08a6bc62abb SHA512 cff6a2251440ae99ad9522d192db58fd37d62d2f578f5401b2aea0507345c1eb11e3e25e15572409057457811a001fb383d38f746d02bdcf0c32ef7476c6c971
DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231002.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20231009.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231009.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231009.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20231016.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231016.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231016.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20231023.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231023.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231023.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-25 5:36 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-25 5:36 UTC (permalink / raw
To: gentoo-commits
commit: ab7c4191a26bb35bfc49663ad541ee893d0144e3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 05:31:40 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 05:31:40 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab7c4191
sec-keys/openpgp-keys-gentoo-developers: add 20231113
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231113.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 1991806dbc81..d07af4964334 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-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
DIST openpgp-keys-gentoo-developers-20231106-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
+DIST openpgp-keys-gentoo-developers-20231113-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231113.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231113.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231113.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-25 5:36 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-25 5:36 UTC (permalink / raw
To: gentoo-commits
commit: ab71711a461ab6023730e8fb3c544c0db19276a7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 05:31:01 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 05:31:01 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab71711a
sec-keys/openpgp-keys-gentoo-developers: add 20231106
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231106.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 0cbe4fc2e680..1991806dbc81 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
+DIST openpgp-keys-gentoo-developers-20231106-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231106.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231106.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231106.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-25 5:36 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-25 5:36 UTC (permalink / raw
To: gentoo-commits
commit: d75e5ae7a001d618dc75c04e33f43fc3a37235f7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 05:32:21 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 05:32:21 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d75e5ae7
sec-keys/openpgp-keys-gentoo-developers: add 20231120
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20231120.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index d07af4964334..c2ce63ceeda8 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -2,3 +2,4 @@ DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e7
DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
DIST openpgp-keys-gentoo-developers-20231106-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
DIST openpgp-keys-gentoo-developers-20231113-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
+DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
new file mode 100644
index 000000000000..fda85a259ff6
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-11-25 5:36 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-11-25 5:36 UTC (permalink / raw
To: gentoo-commits
commit: 4ceb4a0e5298a5cd0b0260819396c516c4267c23
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 05:29:48 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 05:29:48 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ceb4a0e
sec-keys/openpgp-keys-gentoo-developers: drop 20230828, 20230918
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20230828.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20230918.ebuild | 233 ---------------------
3 files changed, 468 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index c58caba043e4..5fb50ed72724 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,5 +1,3 @@
-DIST openpgp-keys-gentoo-developers-20230828-active-devs.gpg 3102805 BLAKE2B efd321e8ebb76d32e47df8085c9bb0d393c59d747b54cb5cf6febcc301a92a7c2a2b8bebd95b8f1b8fa9a6683aefc673809d8418408434bc41a1cf2bf8076938 SHA512 9e2e7408c2371edbe037243971fe6d45931cf526dff1d6014e472c056f8ed6881632d86497e9d6cd6b535574fb99c2af43fb63074911f4af476b5f590cc272dd
-DIST openpgp-keys-gentoo-developers-20230918-active-devs.gpg 3093946 BLAKE2B 43f7781068ead0375c0bd510a286c1568b5dce05c66f1f0f42e2d0d96fdb5dfbb884f4b182527078998d68c4f432db5a20ac9cfa54cf1299142978b662c59b62 SHA512 772bcbae91bf5e0e3c2e6519b8dd5f27c81bc5e17acb8bb739aefcae762e6316c7d5b292972a11655466cb16a4fcc93f296fea3b3c3c48ec41ffeb957c815e2b
DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231002-active-devs.gpg 3102348 BLAKE2B 13854c1e9daf64c055642cfcfd59dc77119ff3bb98e6a46ec8d4eee093be3c1d39ce284b524da2156e6d28b3b936c8c98de76a6fcca013ab519c6211d05773f9 SHA512 8ebe8d600d47a721ce5f08ad07317164f31c7ef540ed81be7555500e9ffc82fa9a46afeccd08b530936fff10318e094b4ba061108e84886fdb033f7d327eb690
DIST openpgp-keys-gentoo-developers-20231009-active-devs.gpg 3105229 BLAKE2B a5921932d982f3bab8e49100cbf086e684dd5d040f342c1a557455c13b8a8d7533cc7134597967dcfa5f9f3c7bc0a05d7a2889d2bf23f36a8470d8cc9efb1617 SHA512 eeeeaca4be15e20c38e32778b71e9395e8ebcaaf97fcef92a29cf4962d140b6c04b476fb09b197d0e037350450830fbdec4846d5064e3f5b13d860d034724e7d
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230828.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20230918.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230918.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230918.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-12-15 6:44 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-12-15 6:44 UTC (permalink / raw
To: gentoo-commits
commit: f8adb203cdf2c3b5429c1c533a47c0302cde78b7
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 15 06:44:35 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 15 06:44:35 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8adb203
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20231030 ALLARCHES, #919944
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20231030.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-12-28 3:43 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-12-28 3:43 UTC (permalink / raw
To: gentoo-commits
commit: 638c3982caf75744470469ec5c3bcecfec60a03d
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 03:34:17 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 03:34:17 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=638c3982
sec-keys/openpgp-keys-gentoo-developers: drop 20230925, 20231106, 20231113
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 3 -
.../openpgp-keys-gentoo-developers-20230925.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20231106.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20231113.ebuild | 233 ---------------------
4 files changed, 702 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index c2ce63ceeda8..7494ba918caf 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,5 +1,2 @@
-DIST openpgp-keys-gentoo-developers-20230925-active-devs.gpg 3094306 BLAKE2B 0e70a39a2102630a5285b2b2313a7b3c83cca71f76f75ce5fa0dc0432002d5e57926ce82158f4f9c44c2f671a5a44076781a6ca8a1ce330d5bd97ba2e3726a97 SHA512 395c499833a07506b7f44bfbab2851361ece5885dd53d606699eefb523b60a13078ae87e6ebd46f9a7644adfc8920fe141ac777ec260b747d13c3359631fa27b
DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
-DIST openpgp-keys-gentoo-developers-20231106-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
-DIST openpgp-keys-gentoo-developers-20231113-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20230925.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20231106.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231106.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231106.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20231113.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231113.ebuild
deleted file mode 100644
index fda85a259ff6..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231113.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2023-12-29 23:32 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2023-12-29 23:32 UTC (permalink / raw
To: gentoo-commits
commit: 07bc8b9910d7749cc5977e3d30813d7c7c667078
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 29 23:31:52 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 29 23:31:52 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07bc8b99
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20231120 ALLARCHES, #921008
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20231120.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
index fda85a259ff6..a8a3226d3007 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-02-29 7:52 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-02-29 7:52 UTC (permalink / raw
To: gentoo-commits
commit: 379f80120fbc734789aded9ce5a8d927d2293adc
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 29 07:51:23 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 29 07:52:41 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=379f8012
sec-keys/openpgp-keys-gentoo-developers: drop 20231030
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 -
.../openpgp-keys-gentoo-developers-20231030.ebuild | 233 ---------------------
2 files changed, 234 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 7494ba918caf..ce8b65e50bfa 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1 @@
-DIST openpgp-keys-gentoo-developers-20231030-active-devs.gpg 3116604 BLAKE2B cf90b160f4ba7f3b0b2b7884f80f36e573893afbc4f3d6373993af7334c1f38426cedcfd9ebf4f6b38591568baa21afa5c243e2101887200bc51d205003fc3be SHA512 009f7b9eb9d8136406658544b559698a4b17c507ac91931463345c712780eee3935ad35aa9b9f5b5d85083ebc1ea646bf51877a165be184a9cbd8f73b8b1c3d7
DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231030.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-02-29 7:52 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-02-29 7:52 UTC (permalink / raw
To: gentoo-commits
commit: afdadc11c5d39367869c6690d5348882c7139a48
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 29 07:52:31 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 29 07:52:41 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afdadc11
sec-keys/openpgp-keys-gentoo-developers: add 20240226
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20240226.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index ce8b65e50bfa..ba94b9acd081 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
+DIST openpgp-keys-gentoo-developers-20240226-active-devs.gpg 3293697 BLAKE2B d47d351c638808e49a8d5966f532eb3cbc8c261c4667eab38731c2d072ba99bdc5d8523a6d21cb90184c760b2a13374bf3d4b470f0c0511fcd9d0e53cc462a3d SHA512 8f4c9bfc689ed7cccad039b2b06ee63285ef639a019fffd7d204017ff109ff590a1c591088c6f5bf19078e41f066a86712f3d2cd6a0735df64f5fc5086e47232
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
new file mode 100644
index 000000000000..b7e16ffc58b3
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-04-27 22:38 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-04-27 22:38 UTC (permalink / raw
To: gentoo-commits
commit: 748ac10bdcd7bb312403d149518098419f557ad4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 27 22:36:44 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 27 22:36:44 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=748ac10b
sec-keys/openpgp-keys-gentoo-developers: add 20240422
Signed-off-by: Sam James <sam <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20240422.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index ba94b9acd081..2893dbafe2af 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,2 +1,3 @@
DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
DIST openpgp-keys-gentoo-developers-20240226-active-devs.gpg 3293697 BLAKE2B d47d351c638808e49a8d5966f532eb3cbc8c261c4667eab38731c2d072ba99bdc5d8523a6d21cb90184c760b2a13374bf3d4b470f0c0511fcd9d0e53cc462a3d SHA512 8f4c9bfc689ed7cccad039b2b06ee63285ef639a019fffd7d204017ff109ff590a1c591088c6f5bf19078e41f066a86712f3d2cd6a0735df64f5fc5086e47232
+DIST openpgp-keys-gentoo-developers-20240422-active-devs.gpg 3204733 BLAKE2B b761e0f3f281545748eb8719b3ddd8eb55444090749218a579a94fddfafc735e3d36461662699fb1081fa70913d4449e51460f83d6ad10206c64ccdd313578e6 SHA512 b83232b2ed135bec63b5437aa49812b620de2de4d77874bc19b6d3caf2d7c0d295d58583b1cdc706ddc4e6d415c3391e6c6d1dc68b48556c865f36670575affe
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
new file mode 100644
index 000000000000..b7e16ffc58b3
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ sec-keys/openpgp-keys-gentoo-auth
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-04-29 5:44 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-04-29 5:44 UTC (permalink / raw
To: gentoo-commits
commit: 6f06181d9cbf73be7a981d135cba368d4d99e88d
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 29 05:44:04 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 29 05:44:04 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f06181d
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20240226 ALLARCHES, #930865
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20240226.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
index b7e16ffc58b3..ab693b185062 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-07-03 16:21 Michał Górny
0 siblings, 0 replies; 87+ messages in thread
From: Michał Górny @ 2024-07-03 16:21 UTC (permalink / raw
To: gentoo-commits
commit: 9522b106554f625bdd9b8780862672fb5ffc420e
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 3 16:21:01 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 3 16:21:01 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9522b106
sec-keys/openpgp-keys-gentoo-developers: Remove old
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 2 -
.../openpgp-keys-gentoo-developers-20231120.ebuild | 233 ---------------------
.../openpgp-keys-gentoo-developers-20240226.ebuild | 233 ---------------------
3 files changed, 468 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index 2893dbafe2af..d6d5645375c8 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1,3 +1 @@
-DIST openpgp-keys-gentoo-developers-20231120-active-devs.gpg 3117324 BLAKE2B 30a10227a2970b828bb7eafe710356cea9e8983e9c808ca3bc9858e8ae9e9d8efec5a982f03101f273f82cf8ec55afcf0005b29e578ea039376bf093f2f9ab0a SHA512 70333f7647672e586eed3ae62d479d0b8bbb67e0eec2e7068cb8e2cbb60e2c5540ce8d06c08c3f80ce338824e203fddc04422eb002512eb8d5f1513a4a7b5c37
-DIST openpgp-keys-gentoo-developers-20240226-active-devs.gpg 3293697 BLAKE2B d47d351c638808e49a8d5966f532eb3cbc8c261c4667eab38731c2d072ba99bdc5d8523a6d21cb90184c760b2a13374bf3d4b470f0c0511fcd9d0e53cc462a3d SHA512 8f4c9bfc689ed7cccad039b2b06ee63285ef639a019fffd7d204017ff109ff590a1c591088c6f5bf19078e41f066a86712f3d2cd6a0735df64f5fc5086e47232
DIST openpgp-keys-gentoo-developers-20240422-active-devs.gpg 3204733 BLAKE2B b761e0f3f281545748eb8719b3ddd8eb55444090749218a579a94fddfafc735e3d36461662699fb1081fa70913d4449e51460f83d6ad10206c64ccdd313578e6 SHA512 b83232b2ed135bec63b5437aa49812b620de2de4d77874bc19b6d3caf2d7c0d295d58583b1cdc706ddc4e6d415c3391e6c6d1dc68b48556c865f36670575affe
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
deleted file mode 100644
index a8a3226d3007..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20231120.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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-20240226.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
deleted file mode 100644
index ab693b185062..000000000000
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240226.ebuild
+++ /dev/null
@@ -1,233 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{10..12} )
-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 ~ia64 ~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}]')
- sec-keys/openpgp-keys-gentoo-auth
- test? (
- app-crypt/gnupg
- 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
-
- 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?
-}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-07-14 15:03 James Le Cuirot
0 siblings, 0 replies; 87+ messages in thread
From: James Le Cuirot @ 2024-07-14 15:03 UTC (permalink / raw
To: gentoo-commits
commit: 3c03efbb8642efb32038dc69a4de0fc875ccbdad
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 14:43:41 2024 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 15:02:15 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c03efbb
sec-keys/openpgp-keys-gentoo-developers: Min openpgp-keys-gentoo-auth version
20230329 was now resulting in no developer keys being added, even in the older
openpgp-keys-gentoo-developers version.
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20240422.ebuild | 2 +-
.../openpgp-keys-gentoo-developers-99999999.ebuild | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
index ab693b185062..537b42c72cc6 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
@@ -26,7 +26,7 @@ RESTRICT="!test? ( test )"
BDEPEND+="
$(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
- sec-keys/openpgp-keys-gentoo-auth
+ >=sec-keys/openpgp-keys-gentoo-auth-20240703
test? (
app-crypt/gnupg
sys-apps/grep[pcre]
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 fda85a259ff6..d5cf1e259a4d 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
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -26,7 +26,7 @@ RESTRICT="!test? ( test )"
BDEPEND+="
$(python_gen_any_dep 'dev-python/python-gnupg[${PYTHON_USEDEP}]')
- sec-keys/openpgp-keys-gentoo-auth
+ >=sec-keys/openpgp-keys-gentoo-auth-20240703
test? (
app-crypt/gnupg
sys-apps/grep[pcre]
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-07-14 15:03 James Le Cuirot
0 siblings, 0 replies; 87+ messages in thread
From: James Le Cuirot @ 2024-07-14 15:03 UTC (permalink / raw
To: gentoo-commits
commit: 16dd15c27d35a8f9df1efe68299da7d2b56e2468
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 15:01:51 2024 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 15:02:17 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16dd15c2
sec-keys/openpgp-keys-gentoo-developers: Version bump to 20240708
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
sec-keys/openpgp-keys-gentoo-developers/Manifest | 1 +
.../openpgp-keys-gentoo-developers-20240708.ebuild | 233 +++++++++++++++++++++
2 files changed, 234 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/Manifest b/sec-keys/openpgp-keys-gentoo-developers/Manifest
index d6d5645375c8..cab413f97110 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/Manifest
+++ b/sec-keys/openpgp-keys-gentoo-developers/Manifest
@@ -1 +1,2 @@
DIST openpgp-keys-gentoo-developers-20240422-active-devs.gpg 3204733 BLAKE2B b761e0f3f281545748eb8719b3ddd8eb55444090749218a579a94fddfafc735e3d36461662699fb1081fa70913d4449e51460f83d6ad10206c64ccdd313578e6 SHA512 b83232b2ed135bec63b5437aa49812b620de2de4d77874bc19b6d3caf2d7c0d295d58583b1cdc706ddc4e6d415c3391e6c6d1dc68b48556c865f36670575affe
+DIST openpgp-keys-gentoo-developers-20240708-active-devs.gpg 3122417 BLAKE2B f1a1727be347f66b9114f55dba31ed461785a5e8c633415896bb072fd5a6239db526e68d0ac3423e7cd6336a23542c9e48a02f36e18f83f0c7bd177ffd1fb1f8 SHA512 02626833edfb7ff943b96f8885df22ca24cec1a0ea7c9d23d702deb79b921bbe8fb8640d3f2275ffc413924b8f8a079a277b155157a142f519298e3771513f9e
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
new file mode 100644
index 000000000000..d5cf1e259a4d
--- /dev/null
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+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 ~ia64 ~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}]')
+ >=sec-keys/openpgp-keys-gentoo-auth-20240703
+ test? (
+ app-crypt/gnupg
+ 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
+
+ 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?
+}
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-07-14 22:33 James Le Cuirot
0 siblings, 0 replies; 87+ messages in thread
From: James Le Cuirot @ 2024-07-14 22:33 UTC (permalink / raw
To: gentoo-commits
commit: f1ba93721c337063b5a372498e49ba11e5dc2a22
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 22:29:43 2024 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 22:29:43 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1ba9372
sec-keys/openpgp-keys-gentoo-developers: Fix src_test after adding check
keyring-mangler now fails with no valid keys, but there were no valid keys in
the test. Fix this by importing our already-sanitised list.
Closes: https://bugs.gentoo.org/936051
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20240422.ebuild | 3 +++
.../openpgp-keys-gentoo-developers-20240708.ebuild | 3 +++
.../openpgp-keys-gentoo-developers-99999999.ebuild | 3 +++
3 files changed, 9 insertions(+)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
index 537b42c72cc6..f0c8cb1b5c51 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240422.ebuild
@@ -143,6 +143,9 @@ src_test() {
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
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
index d5cf1e259a4d..8b5c37e28529 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
@@ -143,6 +143,9 @@ src_test() {
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
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 d5cf1e259a4d..8b5c37e28529 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
@@ -143,6 +143,9 @@ src_test() {
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
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-07-17 5:54 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-07-17 5:54 UTC (permalink / raw
To: gentoo-commits
commit: c6e3975d9f6dd8e104e5bf4d838d712472aafbe4
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 17 05:21:20 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul 17 05:52:59 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6e3975d
sec-keys/openpgp-keys-gentoo-developers: enable py3.13
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20240708.ebuild | 2 +-
.../openpgp-keys-gentoo-developers-99999999.ebuild | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
index 8b5c37e28529..d6ca7cfafa87 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
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 8b5c37e28529..d6ca7cfafa87 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
@@ -3,7 +3,7 @@
EAPI=8
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
inherit edo python-any-r1
DESCRIPTION="Gentoo Authority Keys (GLEP 79)"
^ permalink raw reply related [flat|nested] 87+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/
@ 2024-08-29 3:51 Sam James
0 siblings, 0 replies; 87+ messages in thread
From: Sam James @ 2024-08-29 3:51 UTC (permalink / raw
To: gentoo-commits
commit: b227cb3dd8909c9a128850df2575d48b455c06aa
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 29 03:50:30 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 29 03:50:30 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b227cb3d
sec-keys/openpgp-keys-gentoo-developers: Stabilize 20240708 ALLARCHES, #938652
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../openpgp-keys-gentoo-developers-20240708.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
index d6ca7cfafa87..f4414480caf2 100644
--- a/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.ebuild
+++ b/sec-keys/openpgp-keys-gentoo-developers/openpgp-keys-gentoo-developers-20240708.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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86"
fi
S="${WORKDIR}"
^ permalink raw reply related [flat|nested] 87+ messages in thread
end of thread, other threads:[~2024-08-29 3:51 UTC | newest]
Thread overview: 87+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-25 5:36 [gentoo-commits] repo/gentoo:master commit in: sec-keys/openpgp-keys-gentoo-developers/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-08-29 3:51 Sam James
2024-07-17 5:54 Sam James
2024-07-14 22:33 James Le Cuirot
2024-07-14 15:03 James Le Cuirot
2024-07-14 15:03 James Le Cuirot
2024-07-03 16:21 Michał Górny
2024-04-29 5:44 Sam James
2024-04-27 22:38 Sam James
2024-02-29 7:52 Sam James
2024-02-29 7:52 Sam James
2023-12-29 23:32 Sam James
2023-12-28 3:43 Sam James
2023-12-15 6:44 Sam James
2023-11-25 5:36 Sam James
2023-11-25 5:36 Sam James
2023-11-25 5:36 Sam James
2023-11-25 5:36 Sam James
2023-11-06 17:15 Sam James
2023-11-06 17:15 Sam James
2023-10-21 23:11 Sam James
2023-10-21 23:11 Sam James
2023-10-08 1:04 Sam James
2023-09-27 3:03 Sam James
2023-09-27 3:03 Sam James
2023-09-27 3:03 Sam James
2023-09-25 1:48 Sam James
2023-09-16 12:53 Sam James
2023-09-07 8:04 Sam James
2023-09-03 7:24 Sam James
2023-09-03 7:24 Sam James
2023-09-01 2:29 Sam James
2023-09-01 2:29 Sam James
2023-09-01 2:29 Sam James
2023-09-01 2:29 Sam James
2023-08-04 11:25 Sam James
2023-08-04 11:25 Sam James
2023-08-04 11:25 Sam James
2023-08-04 11:25 Sam James
2023-07-19 20:25 Sam James
2023-07-19 20:25 Sam James
2023-07-19 20:25 Sam James
2023-07-19 20:25 Sam James
2023-06-24 5:02 Sam James
2023-06-24 5:02 Sam James
2023-06-14 4:07 Sam James
2023-06-14 3:10 Sam James
2023-06-14 3:10 Sam James
2023-06-14 3:08 Sam James
2023-06-14 3:08 Sam James
2023-06-14 3:08 Sam James
2023-06-01 5:54 Sam James
2023-06-01 5:54 Sam James
2023-06-01 5:54 Sam James
2023-05-18 22:21 Sam James
2023-05-15 4:10 Sam James
2023-05-15 4:10 Sam James
2023-05-15 4:10 Sam James
2023-05-15 4:10 Sam James
2023-04-23 19:46 Sam James
2023-04-23 7:09 Sam James
2023-04-23 7:05 Sam James
2023-04-08 6:47 Viorel Munteanu
2023-04-04 4:20 Sam James
2023-04-01 0:55 Sam James
2023-03-31 21:28 Sam James
2023-03-31 21:01 Sam James
2023-03-31 20:59 Sam James
2023-03-31 20:59 Sam James
2023-03-29 18:24 Arthur Zamarin
2023-03-29 14:58 Sam James
2023-03-29 11:24 Sam James
2023-03-29 11:24 Sam James
2023-03-29 11:24 Sam James
2023-03-29 11:03 Sam James
2023-03-29 2:27 Sam James
2023-03-29 2:27 Sam James
2023-03-29 1:51 Sam James
2023-03-29 1:51 Sam James
2023-01-03 4:48 Sam James
2023-01-03 4:48 Sam James
2022-11-07 23:46 Sam James
2022-09-03 1:49 Sam James
2022-09-03 1:42 Sam James
2022-09-03 1:42 Sam James
2022-07-20 5:34 Sam James
2022-07-13 8:03 Matthias Maier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox