rpm-sequoia: New recipe for version 1.7.0
PATCH v6 1/3 rpm-sequoia: New recipe for version 1.7.0
rpm 4.20 removed the built-in code to handle signed packages and uses rpm-sequoia as a more feature complete library.
Also ship a crypto policy file which is used to validate signing keys.
--- meta/conf/distro/include/maintainers.inc | 1 + .../rpm-sequoia/rpm-sequoia-crates.inc | 486 ++++++++++++++++++ .../rpm-sequoia/rpm-sequoia.config | 51 ++ .../rpm-sequoia/rpm-sequoia_1.7.0.bb | 63 +++ 4 files changed, 601 insertions(+) create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crates.inc create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb
meta/conf/distro/include/maintainers.inc +1 -0
@@ -744,6 +744,7 @@ RECIPE_MAINTAINER:pn-rpcbind = "Hongxu Jia <[email protected]>" RECIPE_MAINTAINER:pn-rng-tools = "Anuj Mittal <[email protected]>" RECIPE_MAINTAINER:pn-rpcsvc-proto = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-rpm = "Robert Yang <[email protected]>" +RECIPE_MAINTAINER:pn-rpm-sequoia = "Zoltán Böszörményi <[email protected]>" RECIPE_MAINTAINER:pn-rsync = "Yi Zhao <[email protected]>" RECIPE_MAINTAINER:pn-rt-tests = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-ruby = "Ross Burton <[email protected]>"
meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crates.inc new file +486 -0
486 lines not on this page · raw message
meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config new file +51 -0
51 lines not on this page · raw message
meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v6 2/3 sign_rpm.bbclass: Use the crypto policy file shipped by rpm-sequoia
Set SEQUOIA_CRYPTO_POLICY to the path of the crypto policy file shipped by rpm-sequoia-native. This allows signing rpm packages on hosts that do not have the crypto policy file for rpm-sequoia.
--- meta/classes/sign_rpm.bbclass | 3 +++ 1 file changed, 3 insertions(+)
meta/classes/sign_rpm.bbclass +3 -0
@@ -40,6 +40,9 @@ RPM_GPG_BACKEND ?= 'local' RPM_FILE_CHECKSUM_DIGEST ?= '8' RPM_GPG_SIGN_CHUNK ?= "${BB_NUMBER_THREADS}" +# The file "rpm-sequoia.config" is shipped by rpm-sequoia[-native]. +# Use it to sign rpms. +export SEQUOIA_CRYPTO_POLICY = "${RECIPE_SYSROOT_NATIVE}${sysconfdir}/crypto-policies/back-ends/rpm-sequoia.config" python () { if d.getVar('RPM_GPG_PASSPHRASE_FILE'):
Signature · 1 line
2.48.1
PATCH v6 3/3 oeqa/selftest/cases/signing.py: Re-enable self-test
In reply to Zoltán BöszörményiEnable building rpm with rpm-seqouia for the test.
sign_rpm.bbclass already takes care of signing rpm packages.
Add a crypto policy file (identical to the one shipped by rpm-sequoia) and use its path in SEQUOIA_CRYPTO_POLICY envvar for runCmd('rpmkeys') commands.
--- .../files/signing/rpm-sequoia.config | 51 +++++++++++++++++++ meta/lib/oeqa/selftest/cases/signing.py | 11 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 meta-selftest/files/signing/rpm-sequoia.config
meta-selftest/files/signing/rpm-sequoia.config new file +51 -0
@@ -0,0 +1,51 @@ +[hash_algorithms] +md5.collision_resistance = "never" +md5.second_preimage_resistance = "never" +sha1.collision_resistance = "always" +sha1.second_preimage_resistance = "always" +ripemd160.collision_resistance = "never" +ripemd160.second_preimage_resistance = "never" +sha224.collision_resistance = "always" +sha224.second_preimage_resistance = "always" +sha256.collision_resistance = "always" +sha256.second_preimage_resistance = "always" +sha384.collision_resistance = "always" +sha384.second_preimage_resistance = "always" +sha512.collision_resistance = "always" +sha512.second_preimage_resistance = "always" +default_disposition = "never" + +[symmetric_algorithms] +idea = "never" +tripledes = "never" +cast5 = "never" +blowfish = "never" +aes128 = "always" +aes192 = "never" +aes256 = "always" +twofish = "never" +camellia128 = "always" +camellia192 = "never" +camellia256 = "always" +default_disposition = "never" + +[asymmetric_algorithms] +rsa1024 = "never" +rsa2048 = "always" +rsa3072 = "always" +rsa4096 = "always" +dsa1024 = "always" +dsa2048 = "always" +dsa3072 = "always" +dsa4096 = "always" +nistp256 = "always" +nistp384 = "always" +nistp521 = "always" +cv25519 = "always" +elgamal1024 = "never" +elgamal2048 = "never" +elgamal3072 = "never" +elgamal4096 = "never" +brainpoolp256 = "never" +brainpoolp512 = "never" +default_disposition = "never"
meta/lib/oeqa/selftest/cases/signing.py +10 -1
@@ -21,6 +21,7 @@ class Signing(OESelftestTestCase): gpg_dir = "" pub_key_path = "" secret_key_path = "" + sequoia_config_path = "" def setup_gpg(self): bitbake('gnupg-native -c addto_recipe_sysroot')
@@ -30,6 +31,7 @@ class Signing(OESelftestTestCase): self.pub_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.pub") self.secret_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.secret") + self.sequoia_config_path = os.path.join(self.testlayer_path, 'files', 'signing', "rpm-sequoia.config") nsysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native")
@@ -71,7 +73,6 @@ class Signing(OESelftestTestCase): """ import oe.packagedata - self.skipTest('This test requires rpm-sequoia support in rpm') self.setup_gpg() package_classes = get_bb_var('PACKAGE_CLASSES')
@@ -84,6 +85,8 @@ class Signing(OESelftestTestCase): feature += 'RPM_GPG_PASSPHRASE = "test123"\n' feature += 'RPM_GPG_NAME = "testuser"\n' feature += 'GPG_PATH = "%s"\n' % self.gpg_dir + feature += 'PACKAGECONFIG:append:pn-rpm-native = " sequoia"\n' + feature += 'PACKAGECONFIG:append:pn-rpm = " sequoia"\n' self.write_config(feature)
@@ -106,6 +109,9 @@ class Signing(OESelftestTestCase): pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm'))) + # Use our crypto policy file for runCmd('rpmkeys') + os.environ['SEQUOIA_CRYPTO_POLICY'] = self.sequoia_config_path + # Use a temporary rpmdb rpmdb = tempfile.mkdtemp(prefix='oeqa-rpmdb')
@@ -118,6 +124,9 @@ class Signing(OESelftestTestCase): self.assertIn('digests signatures OK', ret.output, 'Package signed incorrectly.') shutil.rmtree(rpmdb) + # Make sure SEQUOIA_CRYPTO_POLICY envvar is unset + del os.environ['SEQUOIA_CRYPTO_POLICY'] + #Check that an image can be built from signed packages self.add_command_to_tearDown('bitbake -c clean core-image-minimal') bitbake('-c clean core-image-minimal')
Signature · 1 line
2.48.1
Re: [OE-core][PATCH v6 3/3] oeqa/selftest/cases/signing.py: Re-enable self-test
Quoted 3 lines · Zoltán Böszörményi
Add a crypto policy file (identical to the one shipped by rpm-sequoia) and use its path in
SEQUOIA_CRYPTO_POLICYenvvar for runCmd('rpmkeys') commands.
This complicated maintaining the policy file even further. Rather, you should set the location of the policy in the rpm recipe where the wrappers are defined:
do_install:append:class-native() {
for tool in ${WRAPPER_TOOLS}; do
test -x ${D}$tool && create_wrapper ${D}$tool \
RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
RPM_NO_CHROOT_FOR_SCRIPTS=1
done
}
This should allow dropping patch 2/3 (the tweak to sign_rpm class) as well.
Alex
Re: [OE-core][PATCH v6 3/3] oeqa/selftest/cases/signing.py: Re-enable self-test
2025. 02. 05. 12:04 keltezéssel, Alexander Kanavin írta:
Quoted 14 lines · Zoltán Böszörményi
Quoted 3 lines
Add a crypto policy file (identical to the one shipped by rpm-sequoia) and use its path in
SEQUOIA_CRYPTO_POLICYenvvar for runCmd('rpmkeys') commands.This complicated maintaining the policy file even further. Rather, you should set the location of the policy in the rpm recipe where the wrappers are defined:
do_install:append:class-native() { for tool in ${WRAPPER_TOOLS}; do test -x ${D}$tool && create_wrapper ${D}$tool \ RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \ RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
Quoted 6 lines
MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
RPM_NO_CHROOT_FOR_SCRIPTS=1
done
}This should allow dropping patch 2/3 (the tweak to
sign_rpmclass) as well.
Thanks for the pointers, I am running the self test with this.
Quoted 46 lines · Zoltán Böszörményi
Also ship a crypto policy file which is used to validate signing keys.
.../rpm-sequoia/rpm-sequoia.config | 51 +++++
b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.configmeta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config new file +41
-0@@ -0,0 +1,51 @@ +[hash_algorithms] +md5.collision_resistance = "never" +md5.second_preimage_resistance = "never" +sha1.collision_resistance = "always" +sha1.second_preimage_resistance = "always" +ripemd160.collision_resistance = "never" +ripemd160.second_preimage_resistance = "never" +sha224.collision_resistance = "always" +sha224.second_preimage_resistance = "always" +sha256.collision_resistance = "always" +sha256.second_preimage_resistance = "always" +sha384.collision_resistance = "always" +sha384.second_preimage_resistance = "always" +sha512.collision_resistance = "always" +sha512.second_preimage_resistance = "always" +default_disposition = "never" + +[symmetric_algorithms] +idea = "never" +tripledes = "never" +cast5 = "never" +blowfish = "never" +aes128 = "always" +aes192 = "never" +aes256 = "always" +twofish = "never" +camellia128 = "always" +camellia192 = "never" +camellia256 = "always" +default_disposition = "never" + +[asymmetric_algorithms] +rsa1024 = "never" +rsa2048 = "always" +rsa3072 = "always" +rsa4096 = "always" +dsa1024 = "always" +dsa2048 = "always" +dsa3072 = "always" +dsa4096 = "always" +nistp256 = "always"
meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config line 51
Quoted 10 lines
meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config new file +10
-0+nistp384 = "always" +nistp521 = "always" +cv25519 = "always" +elgamal1024 = "never" +elgamal2048 = "never" +elgamal3072 = "never" +elgamal4096 = "never" +brainpoolp256 = "never" +brainpoolp512 = "never" +default_disposition = "never"
You need to very clearly explain how this was created (or where it was copied from), and how it should be kept up to date. Either in the file itself, or in the recipe that includes it. Otherwise it's a 'magic file' that no one knows how to maintain. Hardcoded lists of crypto algorithms are notoriously prone to becoming outdated, insecure, or both.
Alex
2025. 02. 05. 11:56 keltezéssel, Alexander Kanavin írta:
Quoted 55 lines · Zoltán Böszörményi
Quoted 54 lines
Also ship a crypto policy file which is used to validate signing keys.
.../rpm-sequoia/rpm-sequoia.config | 51 +++++
b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.configmeta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config new file +49
-0@@ -0,0 +1,51 @@ +[hash_algorithms] +md5.collision_resistance = "never" +md5.second_preimage_resistance = "never" +sha1.collision_resistance = "always" +sha1.second_preimage_resistance = "always" +ripemd160.collision_resistance = "never" +ripemd160.second_preimage_resistance = "never" +sha224.collision_resistance = "always" +sha224.second_preimage_resistance = "always" +sha256.collision_resistance = "always" +sha256.second_preimage_resistance = "always" +sha384.collision_resistance = "always" +sha384.second_preimage_resistance = "always" +sha512.collision_resistance = "always" +sha512.second_preimage_resistance = "always" +default_disposition = "never" + +[symmetric_algorithms] +idea = "never" +tripledes = "never" +cast5 = "never" +blowfish = "never" +aes128 = "always" +aes192 = "never" +aes256 = "always" +twofish = "never" +camellia128 = "always" +camellia192 = "never" +camellia256 = "always" +default_disposition = "never" + +[asymmetric_algorithms] +rsa1024 = "never" +rsa2048 = "always" +rsa3072 = "always" +rsa4096 = "always" +dsa1024 = "always" +dsa2048 = "always" +dsa3072 = "always" +dsa4096 = "always" +nistp256 = "always" +nistp384 = "always" +nistp521 = "always" +cv25519 = "always" +elgamal1024 = "never" +elgamal2048 = "never" +elgamal3072 = "never" +elgamal4096 = "never" +brainpoolp256 = "never"
Quoted 8 lines
meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config line 51
Quoted 2 lines
meta/recipes-devtools/rpm-sequoia/rpm-sequoia/rpm-sequoia.config new file +2
-0+brainpoolp512 = "never" +default_disposition = "never"You need to very clearly explain how this was created (or where it was copied from), and how it should be kept up to date. Either in the file itself, or in the recipe that includes it. Otherwise it's a 'magic file' that no one knows how to maintain. Hardcoded lists of crypto algorithms are notoriously prone to becoming outdated, insecure, or both.
Okay, how about using a git:// SRC_URI entry for fedora-crypto-policies? That should be self explanatory and no "magic file".
However, I had to do this abomination of a workaround to exclude the directory from being manhandled by "cargo build":
# This is a workaround for the lack of excluding directories
# in cargo_common.bbclass: a git:// or gitsm:// SRC_URI is # added to cargo_home/config as a [patch."..."] if both # name= and destsuffix= are set, but the second git:// repo # is not Rust based. # # The main source has name=sequoia set, but no destsuffix=. # # The crypto policy file for rpm-sequoia is generated from # fedora-crypto-policies, for which the SRC_URI entry # has destsuffix= set but name= isn't.
SRCREV_FORMAT = "sequoia"SRC_URI = " \git://github.com/rpm-software-management/rpm-sequoia.git;protocol=https;branch=main;name=sequoia \git://gitlab.com/redhat-crypto/fedora-crypto-policies.git;protocol=https;branch=master;destsuffix=fedora-crypto-policies \
"
SRCREV_sequoia = "0667e04ae7fb8cf0490919978d69883d16400e41"
# SRCREV for fedora-crypto-policies
SRCREV = "4d262e79be1cd15c84cad55ad88c53a2d7712e85"
Quoted 5 lines · Böszörményi Zoltán
Okay, how about using a
git://SRC_URIentry for fedora-crypto-policies? That should be self explanatory and no "magic file".However, I had to do this abomination of a workaround to exclude the directory from being manhandled by "cargo build":
I'd be ok with a separate recipe for it.
Alex
2025. 02. 05. 16:34 keltezéssel, Alexander Kanavin írta:
Quoted 7 lines · Böszörményi Zoltán
Quoted 5 lines
Okay, how about using a
git://SRC_URIentry for fedora-crypto-policies? That should be self explanatory and no "magic file".However, I had to do this abomination of a workaround to exclude the directory from being manhandled by "cargo build":
I'd be ok with a separate recipe for it.
For all of the fedora-crypto-policies contents, or just for the one for rpm-sequoia?
Quoted 3 lines · Böszörményi Zoltán
Quoted 1 line
I'd be ok with a separate recipe for it.
For all of the fedora-crypto-policies contents, or just for the one for rpm-sequoia?
We can just pick the one file we need out of it in do_install.
Alex