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.
Description of problem:
Cannot delete orhpan private keys with certutil.
[root@ammy slapd-ammy]# certutil -L -d .
Certificate Nickname Trust Attributes
SSL,S/MIME,JAR/XPI
[root@ammy slapd-ammy]# certutil -K -d .
certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services"
Enter Password or Pin for "NSS Certificate DB":
< 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan)
< 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan)
[root@ammy slapd-ammy]# certutil -F -d . -n '(orphan)'
Enter Password or Pin for "NSS Certificate DB":
[root@ammy slapd-ammy]# certutil -K -d .
certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services"
Enter Password or Pin for "NSS Certificate DB":
< 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan)
< 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan)
[root@ammy slapd-ammy]# certutil -F -d . -n 7d4b5b10928a99fb660422e1c4adb6490260671c
certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services"
Enter Password or Pin for "NSS Certificate DB":
< 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan)
< 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan)
There is no way to remove orphan certs without deleting and recreating the database. In this example I can do so, but on a production system, it's infeasible.
Comment 7Kai Engert (:kaie) (inactive account)
2018-03-09 17:18:37 UTC
I realize that NSS provides an utility that might be useful for this purpose:
symkeyutil
We ship it as part of the nss-tools package.
It's in the unsupported directory, because we don't have documentation for it etc.
However, you should be able execute it directly using its full path:
/usr/lib64/nss/unsupported-tools/symkeyutil
Use parameter -H for help
It seems that an orphan key (no nickname) can be deleted using
symkeyutil -D -i <id-printed-by-certutil>
Does that work for you?
Comment 8Kai Engert (:kaie) (inactive account)
2018-03-09 17:23:32 UTC
I take that back.
The keys you're talking about aren't symmetric keys.
This persists in 3.38 with a bizarre workaround:
now you can adopt an orphan key using -R and hexadecimal.
## specify the key by nickname but will fallback to checking hexadecimal
certutil -R -k 0x788a94edbeb030b97cdbc7cc401dc31cea20e69b -a -s CN=adoptkey
(The 0x is optional).
For some reason -R tests for hex id in -k, but -F does not test for hex id in -n.
Then you can generate a self-signed cert form the CSR -> inject the cert -> delete both cert/key
This does not work if your orphan key is ec. Then the R -k <hex-id> trick doesn't work.
NSS management utils are still hell.
Just a follow-up note on EC keys: the reason the adopt-a-key drive fails on EC keys is a limitation in nss-softokn nss-softokn-freebl
In order to generate the CSR from the orphan key, certutil attempts to extract the attribute CKA_EC_POINT from the ec orphan key. Not all PKCS11 modules implement this and softokn is sadly one of them (<-- this attribute is not required by the standard).
AWS CloudHSM/SafeNet Luna is an example where this would work as they provide CKA_EC_POINT in the CKO_PRIVATE_KEY of EC type.
This issue was not selected to be included either in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small amount of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.
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/RHSA-2019:2237
Description of problem: Cannot delete orhpan private keys with certutil. [root@ammy slapd-ammy]# certutil -L -d . Certificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI [root@ammy slapd-ammy]# certutil -K -d . certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services" Enter Password or Pin for "NSS Certificate DB": < 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan) < 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan) [root@ammy slapd-ammy]# certutil -F -d . -n '(orphan)' Enter Password or Pin for "NSS Certificate DB": [root@ammy slapd-ammy]# certutil -K -d . certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services" Enter Password or Pin for "NSS Certificate DB": < 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan) < 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan) [root@ammy slapd-ammy]# certutil -F -d . -n 7d4b5b10928a99fb660422e1c4adb6490260671c certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services" Enter Password or Pin for "NSS Certificate DB": < 0> rsa 7d4b5b10928a99fb660422e1c4adb6490260671c (orphan) < 1> rsa 788a94edbeb030b97cdbc7cc401dc31cea20e69b (orphan) There is no way to remove orphan certs without deleting and recreating the database. In this example I can do so, but on a production system, it's infeasible.