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 1325756 - CA won't start if external CA certificate does not have the "C,," trust flag
Summary: CA won't start if external CA certificate does not have the "C,," trust flag
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nss
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 7.4
Assignee: nss-nspr-maint
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 1318616
TreeView+ depends on / blocked
 
Reported: 2016-04-11 06:24 UTC by Jan Cholasta
Modified: 2017-02-24 13:26 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-24 13:26:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Cholasta 2016-04-11 06:24:07 UTC
Description of problem:

When the CA is signed by an external CA, the external CA certificate is required to have at least "C,," (SSL server CA) trust flags for the CA certificate self-test to pass. However, this is not necessary, as the external CA certificate needs to be trusted only to issue CA certificates, i.e. ",," trust flags are sufficient.

This causes issues for IPA, as we have to remember to work around this, and when we don't, we get bugs like bug 1318616.

Version-Release number of selected component (if applicable):
pki-core-10.2.5-9.el7_2

How reproducible:
Always.

Steps to Reproduce:
1. Install a CA signed by an external CA
2. Change trust flags of the external CA certificate to ",," in /var/lib/pki-tomcat/alias
3. Restart pki-tomcatd

Actual results:
CA doesn't start.

Expected results:
CA starts.

Additional info:

Comment 3 Endi Sukma Dewata 2016-04-14 19:10:10 UTC
Per discussion with cfu, it's unclear the impact of removing the trust flags of the external CA certificate to PKI in general. It may work under certain scenarios for IPA, but it may break other things in PKI. This will have to be deferred pending full investigation and testing.

In any case, IPA may disable the self-tests to bypass the current requirement, but the PKI behavior cannot be guaranteed.

Comment 4 Ade Lee 2016-04-21 13:56:49 UTC
If there is an issue with verification here, its likely not in the PKI layer, but rather within NSS.

Specifically, when we perform the self test on the local subsystem certificates, we call the JSS function - 

CryptoManager cm;
cm.isCertValid(nickname, true, cu)

which basically calls the NSS function:

rv = verifyCertificateNow(env, self, nickString, checkSig, required_certificateUsage, &currUsage);

This function verifies the specified usage for the subsystem certificate as well as the trust relationship for the chain.  If there is a bug here, then the bug is in NSS, rather than in PKI.

The bug description indicates that ",," should be sufficient.  Just offhand, I would think that "c,," would be required, where "c" is "valid CA".  Did you try this?

Comment 5 Kai Engert (:kaie) (inactive account) 2016-04-21 15:55:16 UTC
I don't understand the bug report.

What is it that doesn't "start"?

Could you please provide more details, ideally with example certificates?

Comment 6 Jan Cholasta 2016-04-26 06:06:52 UTC
Ade, I assume you are veryfying the certificate for the "SSL CA" usage, right? NSS does (surprisingly to me) indeed require the "C,," flag on *any* of the certificates higher in the CA chain:

# certutil -d /var/lib/pki/pki-tomcat/alias -L

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

ocspSigningCert cert-pki-ca                                  u,u,u
subsystemCert cert-pki-ca                                    u,u,u
CA - Example Organization                                    ,,   
CA - Example Organization #2                                 ,,  
caSigningCert cert-pki-ca                                    CTu,Cu,Cu
Server-Cert cert-pki-ca                                      u,u,u
auditSigningCert cert-pki-ca                                 u,u,Pu
# certutil -d /var/lib/pki/pki-tomcat/alias -O -n 'caSigningCert cert-pki-ca'
"CA - Example Organization #2" [CN=CA,O=Example Organization]

  "CA - Example Organization" [CN=CA,O=Subsidiary Example Organization]

    "caSigningCert cert-pki-ca" [CN=Certificate Authority,O=ABC.IDM.LAB.ENG.BRQ.REDHAT.COM]

# certutil -d /var/lib/pki/pki-tomcat/alias -V -n 'caSigningCert cert-pki-ca' -u L
certutil: certificate is invalid: Peer's certificate issuer has been marked as not trusted by the user.
# certutil -d /var/lib/pki/pki-tomcat/alias -M -n 'CA - Example Organization' -t C,,
# certutil -d /var/lib/pki/pki-tomcat/alias -V -n 'caSigningCert cert-pki-ca' -u L
certutil: certificate is valid
# certutil -d /var/lib/pki/pki-tomcat/alias -M -n 'CA - Example Organization' -t ,,
# certutil -d /var/lib/pki/pki-tomcat/alias -M -n 'CA - Example Organization #2' -t C,,
# certutil -d /var/lib/pki/pki-tomcat/alias -V -n 'caSigningCert cert-pki-ca' -u L
certutil: certificate is valid


Further observations:
* no extra flags are needed for "Any CA" and "Verify CA" usages,
* there is no visible difference between ",," and "c,,",
* unsetting the flag does not have any effect on validity of the server certificate.


Kai, the pki-tomcatd service does not start because of a self-test done on its CA signing certificate, see above.

Why is the extra flag necessary?

Comment 8 Ade Lee 2016-05-02 22:03:07 UTC
Yes we are verifying for "SSL CA" of the signing cert.

You can see which parameters we are checking for in CS.cfg.  For example,

ca.cert.signing.certusage=SSLCA

Comment 9 Kai Engert (:kaie) (inactive account) 2016-05-03 16:56:37 UTC
I cannot help you without the certificates.

Please provide the full set of certificates for me to look at.

Comment 10 Kai Engert (:kaie) (inactive account) 2016-05-03 17:01:48 UTC
You may extract the public part of certificates using commands like:
  certutil -d /var/lib/pki/pki-tomcat/alias -L -n 'NICKNAME' -a > output-file

Repeat the above command multiple times, by replacing NICKNAME with the respective names, and using a different output-file each time.

Attach all files to this bug.
Thanks

Comment 11 Kai Engert (:kaie) (inactive account) 2016-05-03 17:03:19 UTC
In addition, please provide the package versions of installed nspr and nss packages, which you can obtain by executing the following command:
  rpm -q nspr nss nss-softokn nss-util

Comment 12 Matthew Harmsen 2016-05-04 16:00:01 UTC
Per Bug Triage of 05/03/2016: RHEL 7.4

Comment 13 Matthew Harmsen 2016-05-04 23:39:24 UTC
NOTE: This bug may need to be moved to the NSS component, time will tell.

Comment 14 Matthew Harmsen 2016-09-27 23:36:33 UTC
Closing with insufficient_data.

If it is desired to re-open this bug, please provide a reproducer without pki (i.e. nss commands only).

Comment 15 Tomas Krizek 2016-10-03 11:36:34 UTC
We have the following situation. An external CA signes our subsidiary CA
certificate. We use this subCA to issue a server certificate. If we mark the
subCA as a trusted CA (CT,,), then the server certificate is valid. This is the
expected behaviour.

The problem is when we test whether the subCA certificate itself is a valid
certificate to use as a CA. This check produces the following error:

certificate is invalid: Peer's certificate issuer has been marked as not
trusted by the user.

This happens because the external CA has no trust flags set. However, since the
subCA has been marked as a trusted CA, it should be irrelevant whether the
external CA is marked as trusted.

I'm attaching the certificates (no password) to reproduce this issue.

# mkdir nssdb
# certutil -d nssdb -N
# pk12util -d nssdb -i subca.p12
# pk12util -d nssdb -i server.p12
# certutil -d nssdb -M -n ca1/subca -t CT,,
# certutil -d nssdb -L
Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

ca1                                                          ,,   
ca1/subca                                                    CTu,u,u
ca1/subca/server                                             u,u,u

# certutil -d nssdb -V -n ca1/subca/server -u V                       
certutil: certificate is valid
# certutil -d nssdb -V -n ca1/subca -u L
certutil: certificate is invalid: Peer's certificate issuer has been marked as
not trusted by the user.
# certutil -d nssdb -M -n ca1 -t C,,
# certutil -d nssdb -V -n ca1/subca -u L
certutil: certificate is valid

Comment 18 Matthew Harmsen 2016-10-03 17:45:00 UTC
As examples were provided, moving this bug to NSS.

Comment 19 Kai Engert (:kaie) (inactive account) 2016-10-10 20:37:22 UTC
So, why don't you simply mark ca1 as trusted?

You're saying, if you do, everything works.

Why do you report it as a problem, that you have to do that?

If your process operates with an intermediate CA issued by ca1, you're obviously  trusting ca1.

The suggested fix is to mark the external CA, that you're obviously trusting, as trusted.

Comment 20 Kai Engert (:kaie) (inactive account) 2016-10-10 20:42:40 UTC
(In reply to Jan Cholasta from comment #0)
> 
> When the CA is signed by an external CA, the external CA certificate is
> required to have at least "C,," (SSL server CA) trust flags for the CA
> certificate self-test to pass. However, this is not necessary, as the
> external CA certificate needs to be trusted only to issue CA certificates,
> i.e. ",," trust flags are sufficient.

So you're saying:

- you have your own software
- your software performs a test
- the result of the test is irrelevant for the operation of your software

If true, then why don't you remove the unnecessary selftest?

Comment 21 Kai Engert (:kaie) (inactive account) 2016-10-10 20:51:02 UTC
I wonder if there's a misunderstanding.

Why do you believe that ",," is sufficient to issue a certificate?

Of course, for the action of signing a certificate, nobody cares about trust flags. The key is used for signing, and you're done.

The point of trust flags is, whether certificates can be accepted as trusted or not.

If your software wants to check, if your own (intermediate) CA certificate is valid, then no, it isn't sufficient for the external issueing CA to have trust flags ",,".

Because ",," means "we don't trust it".

If you want your software to be able to verify, that the intermediate CA certificate you've been by external ca1 is valid for issueing SSL CA certs, then you must declare that external ca1 as trusted for that, which is, mark it as C,,

Comment 23 Kai Engert (:kaie) (inactive account) 2017-02-24 13:26:23 UTC
No activity in 4 months, closing as NOTABUG as I had suggested.


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