** Description changed: + SRU Justification: + + [ Impact ] + + * The zkey EKMFWeb KMS plugin commands + 'zkey kms configure --gen-csr <file> ...' and + 'zkey kms configure --gen-self-signed-cert <file> ...' always sign + the generated certificate signing request (CSR) or self-signed + certificate with RSA-PSS when the EKMFWeb identity key is an + RSA key, even though RSA-PSS was never requested. + + * Not all versions of the IBM EKMF Web server accept certificates + signed with RSA-PSS. As a result, users with an RSA-type identity + key template configured in EKMF Web cannot complete + 'zkey kms configure --register <cert>', which fails with: + EKMFWeb: 34: Unexpected error: 'Error during translating public + key from X509 Certificate' + + * Root cause: in libekmfweb's ekmf_generate_csr() and + ekmf_generate_ss_cert() (libekmfweb/ekmfweb.c), the RSA-PSS + parameter structure is always built and its (non-NULL) address is + unconditionally passed down to the underlying libseckey + SK_OPENSSL_generate_csr()/SK_OPENSSL_generate_ss_cert() helpers. + Those helpers build an RSA-PSS key/signature + + * This was introduced by the rework to use libseckey for secure-key + crypto operations (s390-tools 2.17.0, upstream commit + 26c34a49b1e4). + + * The fix (upstream commit e4dcf084c5a5, already released in the + current Ubuntu devel / stonking and in resolute) only builds/passes + the RSA-PSS parameter pointer when the caller really requested + RSA-PSS, otherwise RSA-PKCS#1. + + * This is a small, self-contained, upstream-accepted 2-hunk change + confined to two functions in one file; no ABI/API or on-disk + format changes. + + [ Test Plan ] + + Reproducing this bug requires an s390x system with a Crypto + Express adapter configured for CCA and access to an EKMF Web server + whose identity-key template is of type RSA (this is inherent to the + affected code path: zkey's identity key and its signing algorithm + are provided by IBM CCA hardware and by the server-side EKMF Web + key template). + + 1. Install the updated s390-tools package (2.31.0-0ubuntu5.4 or + later) on an s390x test system with an s390x Crypto Express + (CEX) adapter in CCA-coprocessor mode, and enable the zkey + EKMFWeb plugin: + # zkey kms bind EKMFWeb + # zkey kms configure --apqns <card.domain> + # zkey kms configure --ekmfweb-url https://<ekmfweb-server> + + 2. Configure/point the EKMF Web server-side identity-key template + used for this client to key-type RSA (2048/3072/4096) rather + than ECDSA. + + 3. Generate a CSR (or self-signed certificate) with the identity + key: + # zkey kms configure --gen-csr csr.pem \ + --cert-subject "CN=test.zkey.client;OU=Example;C=US" + or + # zkey kms configure --gen-self-signed-cert cert.pem \ + --cert-subject "CN=test.zkey.client;OU=Example;C=US" + + 4. Inspect the signature algorithm of the generated file: + # openssl req -in csr.pem -noout -text | grep "Signature Algorithm" + # openssl x509 -in cert.pem -noout -text | grep "Signature Algorithm" + + - Before the fix: "Signature Algorithm: rsassaPss" + (RSA-PSS, wrong). + - After the fix: "Signature Algorithm: sha256WithRSAEncryption" + (or the configured digest) - RSA-PKCS#1, correct. + + Note: Due to the CCA hardware and EKMF Web server dependency, + functional verification will be done by the IBM. + + [ Where problems could occur ] + + * The change only affects the two call sites where the RSA-PSS + parameter pointer is now conditionally built instead of always + built. A regression would most likely manifest as: + - CSR/certificate generation using the wrong signing algorithm + again (i.e. the fix doesn't take effect, no change from current + buggy behaviour) - no new failure mode, same as pre-SRU. + - Or, if the condition were inverted/broken, RSA-PSS could now + never be produced even when later enabled via + '--cert-rsa-pss' - this would only affect users + who explicitly opt into RSA-PSS, a feature not built into this + version of the package, so no currently-supported workflow is + at risk. + - Malformed CSR/certificate generation (OpenSSL would simply fail + the signing operation, causing 'zkey kms configure --gen-csr/ + --gen-self-signed-cert' to error out) rather than silently + producing a corrupt file, since SK_OPENSSL_setup_sign_context() + and X509_REQ_sign_ctx()/X509_sign_ctx() would fail cleanly on + an inconsistent pkey/padding combination. + * ECDSA identity keys are unaffected: rsa_pss_params is ignored for + EC keys in libseckey, so no regression is expected there; this is + nonetheless included in the test plan as a sanity/regression + check. + * The change is confined to the zkey EKMFWeb KMS plugin + (libekmfweb/zkey-ekmfweb) code path; no other consumer of + libekmfweb or libseckey in the s390-tools source is affected. + + [ Other Info ] + + * Upstream commit: https://github.com/ibm-s390-linux/s390-tools/commit/e4dcf084c5a54f8030da39707c5fa0fbb7ae9681 + * Already fix-released in current Ubuntu devel / stonking and + in resolute. + * Noble is the only remaining supported series still + affected. + * This fix is being uploaded to noble together with the unrelated + fix for LP: #2162891 (missing 'adduser' dependency) in the same + 2.31.0-0ubuntu5.4 upload; each bug is independently justified. + + + __________ + Description: libekmfweb: Fix gen of cert or CSR to use RSA not RSA-PSS - Symptom: The zkey EKMFWeb-plugin commands 'zkey kms configure --gen-csr - ...' and/or 'zkey kms configure --gen-self-signed-cert ...' - erroneously generate certificates or certificate-signing- - requests signed using RSA-PSS instead of using RSA-PKCS when - an RSA identity key is used (as defined in EKMFWeb key template - for the identity key). - EKMFWeb might not support certificates signed with RSA-PSS - dependent on the version, and thus the import of such a - certificate fails with "EKMFWeb: 34: Unexpected error: 'Error - during translating public key from X509 Certificate'" during - the 'zkey kms configure --register ...' command. + Symptom: The zkey EKMFWeb-plugin commands 'zkey kms configure --gen-csr + ...' and/or 'zkey kms configure --gen-self-signed-cert ...' + erroneously generate certificates or certificate-signing- + requests signed using RSA-PSS instead of using RSA-PKCS when + an RSA identity key is used (as defined in EKMFWeb key template + for the identity key). + EKMFWeb might not support certificates signed with RSA-PSS + dependent on the version, and thus the import of such a + certificate fails with "EKMFWeb: 34: Unexpected error: 'Error + during translating public key from X509 Certificate'" during + the 'zkey kms configure --register ...' command. Problem: Currently a certificate or certificate signing request generated - by the zkey EKMFWeb library erroneously always uses RSA-PSS as - signing algorithm, although EKMFWeb does not support RSA-PSS - certificates in all versions. - This bug was introduced with the rework to use libseckey for - secure key crypto operations with s390-tools version 2.17.0. + by the zkey EKMFWeb library erroneously always uses RSA-PSS as + signing algorithm, although EKMFWeb does not support RSA-PSS + certificates in all versions. + This bug was introduced with the rework to use libseckey for + secure key crypto operations with s390-tools version 2.17.0. Solution: Only pass the RSS-PSS parameters to the low-level function - when the use of RSA-PSS is intended. + when the use of RSA-PSS is intended. Reproduction: Setup the zkey EKMFWeb plugin and use an RSA-type identity key - template in EKMFWeb. Then generate a certificate or CSR and - try to register the certificate with EKMFWeb. + template in EKMFWeb. Then generate a certificate or CSR and + try to register the certificate with EKMFWeb. Upstream-ID: e4dcf084c5a54f8030da39707c5fa0fbb7ae9681
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2130425 Title: [Ubuntu 24.04] libekmfweb: Fix gen of cert or CSR to use RSA not RSA- PSS To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-z-systems/+bug/2130425/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
