Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1497920

Summary: CMC: Missing CN causing NPE in CMCAuth
Product: Red Hat Enterprise Linux 7 Reporter: Geetika Kapoor <gkapoor>
Component: pki-coreAssignee: Christina Fu <cfu>
Status: CLOSED ERRATA QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 7.4CC: cfu, mharmsen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pki-core-10.5.1-1.el7 Doc Type: No Doc Update
Doc Text:
See BZ#1474658
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 17:01:25 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:
Attachments:
Description Flags
config_files none

Description Geetika Kapoor 2017-10-03 06:47:25 UTC
Description of problem:

Looking for better logging for detecting issue faster.Audit and debug doesn't have much information to troubleshoot the issue. As a user they mind need it.

1. If we are trying to sign a SubCA certificate using a non Agent certificate it fails with 

<debug logs>
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: ProfileSubmitCMCServlet: authenticate: Invalid Credential.
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: SignedAuditEventFactory: create() message created for eventType=AUTH_FAIL
</debug logs>

2. Audit logs doesn't provide exact failure reason:

<audit logs>

0.http-bio-8443-exec-19 - [03/Oct/2017:02:24:22 EDT] [14] [6] [AuditEvent=ACCESS_SESSION_ESTABLISH_SUCCESS][ClientIP=10.12.28.208][ServerIP=10.12.28.208][SubjectID=UID=testing,E=Geetikakk,OU=Test2,C=IN][Outcome=Success] access session establish success
0.http-bio-8443-exec-19 - [03/Oct/2017:02:24:22 EDT] [14] [6] [AuditEvent=CMC_SIGNED_REQUEST_SIG_VERIFY][SubjectID=$NonRoleUser$][Outcome=Failure][ReqType=$Unidentified$][CertSubject=$Unidentified$][SignerInfo=$Unidentified$] agent pre-approved CMC request signature verification
0.http-bio-8443-exec-19 - [03/Oct/2017:02:24:22 EDT] [14] [6] [AuditEvent=CMC_SIGNED_REQUEST_SIG_VERIFY][SubjectID=$NonRoleUser$][Outcome=Failure][ReqType=$Unidentified$][CertSubject=$Unidentified$][SignerInfo=$Unidentified$] agent pre-approved CMC request signature verification
0.http-bio-8443-exec-19 - [03/Oct/2017:02:24:22 EDT] [14] [6] [AuditEvent=AUTH_FAIL][SubjectID=null][Outcome=Failure][AuthMgr=CMCAuth][AttemptedCred=null] authentication failure

</audit logs>


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

rpm -qa pki-ca
pki-ca-10.4.1-15.el7_4.noarch

How reproducible:

always

Steps to Reproduce:
1.Try to sign a SubCA certificate with a user certificate
2.
3.

Actual results:

Reason of failure is never listed in logs.

Expected results:

Reason should be visible in logs .
example: user certificate not have permissions to sign a subCA certificate


Additional info:

Debug logs with user certificate:
=================================

[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: CertUserDBAuthentication: cannot map certificate to any userUser not found
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: CMCAuth: Invalid Credential.
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: SignedAuditEventFactory: create() message created for eventType=CMC_SIGNED_REQUEST_SIG_VERIFY

[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: SignedAuditEventFactory: create() message created for eventType=CMC_SIGNED_REQUEST_SIG_VERIFY

[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: ProfileSubmitCMCServlet: authenticate: Invalid Credential.
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: SignedAuditEventFactory: create() message created for eventType=AUTH_FAIL

[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: CMCOutputTemplate: getContentInfo: begins
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: CMCOutputTemplate: getContentInfo:  - done
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: ProfileSubmitCMCServlet: authentication error Invalid Credential.
[03/Oct/2017:02:29:50][http-bio-8443-exec-23]: CMSServlet: curDate=Tue Oct 03 02:29:50 EDT 2017 id=caProfileSubmitCMCFull time=26

Debug logs with CA certificate:
===============================
[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: SignedAuditEventFactory: create() message created for eventType=CMC_SIGNED_REQUEST_SIG_VERIFY

[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: ProfileSubmitCMCServlet: authenticate: setting auditSubjectID in SessionContext:caadmin
[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: SignedAuditEventFactory: create() message created for eventType=AUTH_SUCCESS

[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: ProfileSubmitCMCServlet authToken not null
[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: CMSServlet: in auditSubjectID
[03/Oct/2017:02:34:54][http-bio-8443-exec-18]: CMSServlet: auditSubjectID auditContext {sslClientCertProvider=com.netscape.cms.servlet.profile.SSLClientCertProvider@328ac2ac, userid=caadmin,

Comment 2 Geetika Kapoor 2017-10-03 07:03:08 UTC
Test Case 2: I tried to add this certificate as part of CA's Agent group using:

pki -d . -c SECret.123 -n "PKI CA Administrator" ca-user-cert-add test108 --serial 0x1f6fd129
pki -d . -c SECret.123 -n "PKI CA Administrator" ca-group-member-add "Certificate Manager Agents" test108
pki -d . -c SECret.123 -n "PKI CA Administrator" ca-group-member-find "Certificate Manager Agents"
-----------------
3 entries matched
-----------------
  User: caadmin

  User: pkidbuser

  User: test108
----------------------------
Number of entries returned 3
----------------------------

Later I execute the same test for SubCA i got a NUllPointerException:

<Debug logs>

[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: authenticated uid=test108,ou=people,o=rhcs-0day-CA
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: CMCAuth: java.lang.NullPointerException
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: SignedAuditEventFactory: create() message created for eventType=CMC_SIGNED_REQUEST_SIG_VERIFY

[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: SignedAuditEventFactory: create() message created for eventType=CMC_SIGNED_REQUEST_SIG_VERIFY

[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: ProfileSubmitCMCServlet: authenticate: Invalid Credential.
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: SignedAuditEventFactory: create() message created for eventType=AUTH_FAIL

[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: CMCOutputTemplate: getContentInfo: begins
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: CMCOutputTemplate: getContentInfo:  - done
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: ProfileSubmitCMCServlet: authentication error Invalid Credential.
[03/Oct/2017:02:56:53][http-bio-8443-exec-10]: CMSServlet: curDate=Tue Oct 03 02:56:53 EDT 2017 id=caProfileSubmitCMCFull time=25

</debug logs>

Comment 3 Geetika Kapoor 2017-10-03 07:07:17 UTC
Created attachment 1333512 [details]
config_files

Comment 4 Christina Fu 2017-10-11 21:20:33 UTC
The following are results of my investigation.

for the initially reported issue, there is adequate info in the debug log:

[11/Oct/2017:14:04:31][http-bio-8443-exec-22]: CertUserDBAuthentication: cannot map certificate to any userUser not found
[11/Oct/2017:14:04:31][http-bio-8443-exec-22]: CMCAuth: Invalid Credential.
[11/Oct/2017:14:04:31][http-bio-8443-exec-22]: SignedAuditLogger: event CMC_SIGNED_REQUEST_SIG_VERIFY
[11/Oct/2017:14:04:31][http-bio-8443-exec-22]: SignedAuditLogger: event CMC_SIGNED_REQUEST_SIG_VERIFY

For the issue reported in comment #2 on NPE for once a user cert is added to agent group, I was able to reproduce the issue, so this needs to be fixed.
I think it has the same issue as the one reported earlier on user signed CMC auth for "missing CN".

Comment 5 Christina Fu 2017-10-20 00:14:45 UTC
pushed to master
https://pagure.io/dogtagpki/issue/2834#comment-473814

Comment 9 Geetika Kapoor 2018-01-31 10:33:40 UTC
This works as expected.Moving this bugzilla to verified.

Comment 11 errata-xmlrpc 2018-04-10 17:01:25 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:0925