RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2012258 - certmonger creates CSRs with invalid DER syntax for X509v3 extensions with critical=FALSE
Summary: certmonger creates CSRs with invalid DER syntax for X509v3 extensions with cr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: certmonger
Version: 8.5
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Rob Crittenden
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks: 2012261 2015511
TreeView+ depends on / blocked
 
Reported: 2021-10-08 17:02 UTC by Rob Crittenden
Modified: 2022-05-10 14:02 UTC (History)
1 user (show)

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.
Clone Of:
: 2012261 2015511 (view as bug list)
Environment:
Last Closed: 2022-05-10 13:38:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-7059 0 None None None 2021-10-08 17:06:25 UTC
Red Hat Issue Tracker RHELPLAN-99315 0 None None None 2021-10-08 17:06:32 UTC
Red Hat Product Errata RHBA-2022:1789 0 None None None 2022-05-10 13:38:20 UTC

Description Rob Crittenden 2021-10-08 17:02:03 UTC
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.

Comment 1 Rob Crittenden 2021-10-08 17:04:16 UTC
Fixed in master:

9312d1892c611d9f0e814cb915488182da2b76cc
e3e4679693efc60bc7a25983909ddfa6883ab2ec

Comment 5 Sumedh Sidhaye 2021-11-24 14:48:46 UTC
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 ~]#

Comment 7 errata-xmlrpc 2022-05-10 13:38:10 UTC
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


Note You need to log in before you can comment on or make changes to this bug.