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 1608375 - CMC Revocations throws exception with same reqIssuer & certissuer
Summary: CMC Revocations throws exception with same reqIssuer & certissuer
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pki-core
Version: 7.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Christina Fu
QA Contact: Asha Akkiangady
URL:
Whiteboard:
Depends On:
Blocks: 1612880
TreeView+ depends on / blocked
 
Reported: 2018-07-25 12:15 UTC by Geetika Kapoor
Modified: 2018-10-30 11:07 UTC (History)
4 users (show)

Fixed In Version: pki-core-10.5.9-6.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
: 1612880 (view as bug list)
Environment:
Last Closed: 2018-10-30 11:07:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch to resolve possible encoding mismatch between the actual CA cert and the X500Name gleaned from the CMC revocation request (3.94 KB, patch)
2018-08-02 23:27 UTC, Christina Fu
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3195 0 None None None 2018-10-30 11:07:43 UTC

Description Geetika Kapoor 2018-07-25 12:15:53 UTC
Description of problem:

When reqIssuer & certissuer are same in during CMC Revocation, it should work but during testing it is observed that it fails with certificate issuer DN and revocation request issuer DN do not match.

For debugging purpose, I added some stdout stataments in code and below is what i see:


Code : add print message for reqIssuer and cert issuer

                    // for Shared Secret case, check if issuer DN matches
                    if (reqSecret != null) {
                        CMS.debug(method + "shared secret revocation:
checking issuer DN");
                        CMS.debug("Geetika:" + reqIssuerPrincipal);
                        CMS.debug("Geetika:" + certIssuerPrincipal);
                        if ((reqIssuerPrincipal == null) ||
                                !
reqIssuerPrincipal.equals(certIssuerPrincipal)) {
                            msg = " certificate issuer DN and revocation
request issuer DN do not match";
                            CMS.debug(method + msg);


Output:

[24/Jul/2018:13:14:52][http-bio-28443-exec-2]: CMCOutputTemplate:
processRevokeRequestControl: shared secret revocation: checking issuer DN
[24/Jul/2018:13:14:52][http-bio-28443-exec-2]: Geetika:CN=Company Root
CA2,O=Company,C=US
[24/Jul/2018:13:14:52][http-bio-28443-exec-2]: Geetika:CN=Company Root
CA2,O=Company,C=US
[24/Jul/2018:13:14:52][http-bio-28443-exec-2]: CMCOutputTemplate:
processRevokeRequestControl:  certificate issuer DN and revocation
request issuer DN do not match

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

rpm -qa pki-ca
pki-ca-10.5.1-14.el7_5.noarch

How reproducible:

always

Steps to Reproduce:
1. Create a certificate.Use any mechanism let it be selfsigned(unsigned) or UserSigned.
2. Try to revoke that certificate.
3.

Actual results:


Seeing error  " certificate issuer DN and revocation request
issuer DN do not match".

Expected results:

Ideally, it should work and proceed with revocation.

Additional info:

Comment 3 Christina Fu 2018-08-02 01:19:05 UTC
Hi Geetika,
While I could not reproduce your reported issue (it works for me), I suspect there might be encoding differences.

Although I think I can produce a fix for it, I think it would help if you could enlighten me with your setup.  For example, 
Please make sure you keep the instance/setup for helping out with the investigation and testing the fix.

Could you please attach the following to the bug:
1. The Base 64 encoding of the CA Signing certificate (just the cert.  Not pkcs7. Not pretty print)
   How you issue the CA signing certificate?  Please describe.

2. The Base 64 encoding of the user certificate that is to be revoked (just the cert.  Not pkcs7. Not pretty print)

Also, please answer the following questions:
1. Does your CS.cfg contain the following setting?
             X500Name.directoryStringEncodingOrder
2. If so, what is the value being set to?

thanks!

Comment 5 Geetika Kapoor 2018-08-02 09:51:50 UTC
Hi Christina,

I have attached all the certs and needed inputs.

Thanks

Comment 6 Christina Fu 2018-08-02 23:27:47 UTC
Created attachment 1472828 [details]
patch to resolve possible encoding mismatch between the actual CA cert  and the X500Name gleaned from the CMC revocation request

Hi Geetika,
Thanks for the cert info.  There are indeed encoding differences between your root CA, sub CA, and the user cert.  Of course there is nothing wrong with that.  
Enclosed is a patch that contains the "sure" fix that will ensure that the encoding will always match that of the CA, if the string value matches.

Could you please apply this to the latest DOGTAG_10_5_BRANCH and try it out in your environment so we can be sure that it fixes the issue?

thanks,
Christina

Comment 7 Geetika Kapoor 2018-08-03 08:43:58 UTC
Hi Christina, 

Yes the patch works. 

Debug logs:

[03/Aug/2018:04:39:50][http-bio-28443-exec-1]: CMCOutputTemplate: processRevokeRequestControl: shared secret revocation: checking issuer DN
[03/Aug/2018:04:39:50][http-bio-28443-exec-1]: Geetika:CN=Company Root CA2,O=Company,C=US
[03/Aug/2018:04:39:50][http-bio-28443-exec-1]: Geetika:CN=Company Root CA2,O=Company,C=US
[03/Aug/2018:04:39:50][http-bio-28443-exec-1]: CMCOutputTemplate: processRevokeRequestControl: certificate issuer DN and revocation request issuer DN match

CMCResponse:

Number of controls is 1
Control #0: CMCStatusInfoV2
   OID: {1 3 6 1 5 5 7 7 25}
   BodyList: 1 
   Status: SUCCESS
CMC Full Response.


Agent page:
==========

    Certificate: 
        Data: 
            Version:  v3
            Serial Number: 0x4E
            Signature Algorithm: SHA384withEC - 1.2.840.10045.4.3.3
            Issuer: CN=Company Root CA2,O=Company,C=US
            Validity: 
                Not Before: Tuesday, July 24, 2018 1:29:47 PM EDT America/New_York
                Not  After: Sunday, January 20, 2019 1:29:47 PM EST America/New_York
            Subject: UID=test10,CN=test10,O=example.org
            Subject Public Key Info: 
                Algorithm: RSA - 1.2.840.113549.1.1.1

Comment 8 Geetika Kapoor 2018-08-03 09:23:58 UTC
Hi Christina,

if the issuerdn is CN=Company Root CA2,O=Company,C=US but in CMCRequest revocation file we mention CN=Company Root CA2,O=company,C=us it will ignore case and treat them as same?

Thanks
Geetika

Comment 9 Christina Fu 2018-08-03 16:24:24 UTC
(In reply to Geetika Kapoor from comment #8)
> Hi Christina,
> 
> if the issuerdn is CN=Company Root CA2,O=Company,C=US but in CMCRequest
> revocation file we mention CN=Company Root CA2,O=company,C=us it will ignore
> case and treat them as same?
> 
> Thanks
> Geetika

Yes, in a certificate, case is insignificant in the subjectDN as well as SAN.
Thank you for testing this out!!!

Comment 10 Christina Fu 2018-08-03 18:59:56 UTC
commit 94f28d4d97b83a8f425ebf0d4522aa48bf3d579d (HEAD -> master, origin/master, origin/HEAD, bug1608375-CMC-Revoke-Issuers-master)
Author: Christina Fu <cfu>
Date:   Thu Aug 2 09:31:50 2018 -0700

    Bug1608375 - CMC Revocations throws exception with same reqIssuer & certissuer
    
    This patch resolves the possible encoding mismatch between the actual CA cert
    and the X500Name gleaned from the CMC revocation request.
    
    Change-Id: I220f5d656a69c90fa02ba38fa21b069ed7d15a9d

Comment 13 Geetika Kapoor 2018-09-04 09:42:55 UTC
Test Env:
========

pki-ca-10.5.9-6.el7.noarch

Test Case:
==========

Follow the same steps as in https://bugzilla.redhat.com/show_bug.cgi?id=1608375#c7.

fix works as expected with no errors.

Comment 15 errata-xmlrpc 2018-10-30 11:07:14 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-2018:3195


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