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 1653163 - certmap fails when Issuer DN has comma in name
Summary: certmap fails when Issuer DN has comma in name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.6
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 7.7
Assignee: mreynolds
QA Contact: RHDS QE
URL:
Whiteboard:
Depends On:
Blocks: 1653165 1660120
TreeView+ depends on / blocked
 
Reported: 2018-11-26 06:25 UTC by Fraser Tweedale
Modified: 2021-01-08 02:43 UTC (History)
10 users (show)

Fixed In Version: 389-ds-base-1.3.9.1-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: certmap.conf parsing did not normalize Distinguished Names (DN) correctly. Consequence: certmap.conf processing failed and did not allow client authentication to take place. Fix: Properly normalize the DN's in certmap.conf Result: TLS client authentication works correctly regardless of the DN format used in certmap.conf
Clone Of:
: 1653165 1660120 (view as bug list)
Environment:
Last Closed: 2019-08-06 12:59:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2152 0 None None None 2019-08-06 12:59:32 UTC

Description Fraser Tweedale 2018-11-26 06:25:54 UTC
(Clone of https://pagure.io/389-ds-base/issue/49543)

Description of problem:

When issuer Dn has a comma in it (or presumably other characters that reqiure escaping),
certmap fails because a comparison between the stringified Issuer DN from the certificate,
and the issuer DN from the certmap file, fails. For example, if the Issuer DN is:

  CN=Certificate Authority,O="Acme, Inc.",ST=Massachusetts,C=US

This gets read from the certificate via the ldapu_get_cert_issuer_dn, which uses
NSS' CERT_NameToAscii to return a stringified version of the DN. CERT_NameToAscii
uses the RFC 1485 rules to serialise the DN, so the string looks like:

  CN=Certificate Authority,O="Acme, Inc.",ST=Massachusetts,C=US

This string then gets processed by ldapu_dn_normalize which turns it into:

  CN=Certificate Authority,O="Acme, Inc.",ST=Massachusetts,C=US

, which is wrong.

The comparison then fails when compared with the DN in the certmap.conf, which
is properly escaped (a basic strcasecmp):

  CN=Certificate Authority,O=Acme\, Inc.,ST=Massachusetts,C=US


Version-Release number of selected component (if applicable):


How reproducible: always


Steps to Reproduce:

1.    configure a certmap with an issuer that has comma in a name.
2.    attempt certificate bind with valid certificate issued by the certmap issuer.


Actual results:

Bind fails, and doesn't even reach the internal search op for a user
matching the certificate. (failure to match the issuer caused fallback to default certmap).


Expected results:

Bind succeeds, or at least uses the correct certmap such that internal search ops to look
up a matching user are executed.


Additional info:

Comment 2 Fraser Tweedale 2018-11-26 06:33:13 UTC
Requesting for 7.6.z and 7.7.

Patch has been merged to 389-ds-base upstream master (70bdd335d151e58e227fc2263ece9aedc0803152).  Moving to POST.

Comment 5 bsmejkal 2019-05-06 11:00:19 UTC
Hi Fraser,
did you manage to reproduce this bug outside of IPA context? If so, could you provide the steps for verifying on 389-ds-base, please?
If not, will there be a release of certmonger for RHEL 7.7 with fixes for this issue? 
I can't verify this bug with certmonger because the patch https://pagure.io/certmonger/pull-request/108 is not applied cleanly to the old build.
We tried to build a custom package of certmonger for RHEL 7.7 but we weren't successful to apply the patch and therefore we are blocked.

Thanks.

Comment 6 Fraser Tweedale 2019-05-08 11:36:30 UTC
I haven't got a non-IDM reproducer.  I'll bump up the priority.  Keeping needinfo.

Comment 7 bsmejkal 2019-06-06 14:29:43 UTC
Hi Fraser,
any news on the non-IDM reproducer or certmonger release? We would like to verify this bug as soon as possible.
Thanks.

Comment 8 bsmejkal 2019-06-07 15:48:19 UTC
389-ds-base-1.3.9.1 contains applied patch with required changes.


Build tested:
389-ds-base-1.3.9.1-8.el7.x86_64

Issuer in cert:
Issuer: C = US, ST = Massachusetts, O = "Acme, Inc.", CN = "Acme, Inc."

Issuer in certmap.conf:
certmap default CN=Acme\, Inc.,O=Acme\, Inc.,ST=Massachusetts,C=US

User bind with certificate is successful.


Marking as VERIFIED, SanityOnly.

Comment 10 errata-xmlrpc 2019-08-06 12:59: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, 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-2019:2152

Comment 11 Fraser Tweedale 2021-01-08 02:43:15 UTC
Bug was verified; removing very ancient needinfo.


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