Bug 2012258
| Summary: | certmonger creates CSRs with invalid DER syntax for X509v3 extensions with critical=FALSE | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Rob Crittenden <rcritten> | |
| Component: | certmonger | Assignee: | Rob Crittenden <rcritten> | |
| Status: | CLOSED ERRATA | QA Contact: | ipa-qe <ipa-qe> | |
| Severity: | high | Docs Contact: | ||
| Priority: | high | |||
| Version: | 8.5 | CC: | ssidhaye | |
| Target Milestone: | rc | Keywords: | Triaged | |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
|
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | certmonger-0.79.13-5.el8 | Doc Type: | Bug Fix | |
| Doc Text: |
Cause: certmonger is encoding a DER default boolean value in the Certificate Signing Request it generates.
Consequence: The resulting CSR is not compliant with strict DER readers
Fix: Apply the OPTIONAL flag and use the upstream NSS CSR template.
Result: The CSR that certmonger generates is valid.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 2012261 2015511 (view as bug list) | Environment: | ||
| Last Closed: | 2022-05-10 13:38:10 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 2012261, 2015511 | |||
Fixed in master: 9312d1892c611d9f0e814cb915488182da2b76cc e3e4679693efc60bc7a25983909ddfa6883ab2ec The ipa-server-install command was successful [root@10 ~]# kinit admin Password for admin: [root@10 ~]# rpm -q ipa-server ipa-server certmonger ipa-server-4.9.6-9.module+el8.6.0+13273+4b1dd6b2.x86_64 ipa-server-4.9.6-9.module+el8.6.0+13273+4b1dd6b2.x86_64 certmonger-0.79.13-5.el8.x86_64 [root@10 ~]# vim infile [root@10 ~]# ipactl status Directory Service: RUNNING krb5kdc Service: RUNNING kadmin Service: RUNNING named Service: RUNNING httpd Service: RUNNING ipa-custodia Service: RUNNING pki-tomcatd Service: RUNNING ipa-otpd Service: RUNNING ipa-dnskeysyncd Service: RUNNING ipa: INFO: The ipactl command was successful [root@10 ~]# openssl asn1parse -inform PEM -in infile | grep -B 1 -A 1 BOOLEAN 567:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Key Usage 572:d=5 hl=2 l= 1 prim: BOOLEAN :255 575:d=5 hl=2 l= 4 prim: OCTET STRING [HEX DUMP]:030204B0 [root@10 ~]# Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (certmonger bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:1789 |
Description of problem: certmonger's template for X509v3 extensions is wrong and generate invalid DER for extensions with critical=FALSE. Since FALSE is the default value, a standard conform CSR or cert must not encode the critical flag. $ openssl asn1parse -inform PEM -in freeipa.csr ... 421:d=7 hl=2 l= 3 prim: OBJECT :X509v3 Subject Alternative Name 426:d=7 hl=2 l= 1 prim: BOOLEAN :0 429:d=7 hl=3 l= 135 prim: OCTET STRING [HEX DUMP]:... The line BOOLEAN 0 should not be present. /* RFC 5280, 4.1 */ const SEC_ASN1Template cm_certext_cert_extension_template[] = { { .kind = SEC_ASN1_SEQUENCE, .offset = 0, .sub = NULL, .size = sizeof(CERTCertExtension), }, { .kind = SEC_ASN1_OBJECT_ID, .offset = offsetof(CERTCertExtension, id), .sub = NULL, .size = sizeof(SECItem), }, { .kind = SEC_ASN1_BOOLEAN, .offset = offsetof(CERTCertExtension, critical), .sub = NULL, .size = sizeof(SECItem), }, { .kind = SEC_ASN1_OCTET_STRING, .offset = offsetof(CERTCertExtension, value), .sub = NULL, .size = sizeof(SECItem), }, {0, 0, NULL, 0}, }; The correct kind for the critical extension is SEC_ASN1_OPTIONAL | SEC_ASN1_BOOLEAN. https://github.com/servo/nss/blob/949eb9848f4fa5f83756f3ab7fdf9b0d3f20d37f/lib/certdb/certdb.c#L50 https://github.com/pyca/cryptography/issues/6368 https://pagure.io/freeipa/issue/9005 Version-Release number of selected component (if applicable): certmonger-0.79.13-3 How reproducible: Steps to Reproduce: 1. install an IPA server 2. pull the csr= value from /var/lib/certmonger/reqeusts/<some id> into a separate file 3. openssl asn1parse -inform PEM -in /path/to/file Expected results: There should be no BOOLEAN value for the critical flag, so nothing between the SAN and the start of the HEX DUMP.