certdb: ensure non-empty Subject Key Identifier

Installation or IPA CA renewal with externally-signed CA accepts an
IPA CA certificate with empty Subject Key Identifier. This is
technically legal in X.509, but is an operational issue.
Furthermore, due to an extant bug in Dogtag
(https://pagure.io/dogtagpki/issue/3079) it will cause Dogtag
startup failure.

Reject CA certificates with empty Subject Key Identifier.

Fixes: https://pagure.io/freeipa/issue/7762
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Fraser Tweedale authored and Christian Heimes committed 2018-11-12 11:23:16 +01:00
1 parent 044ffe0dd0
commit d731f6fd74
1 file changed
+4 -1
+4 -1
View File
@@ -924,10 +924,13 @@ class NSSDatabase:
raise ValueError("not a CA certificate")
try:
cert.extensions.get_extension_for_class(
ski = cert.extensions.get_extension_for_class(
cryptography.x509.SubjectKeyIdentifier)
except cryptography.x509.ExtensionNotFound:
raise ValueError("missing subject key identifier extension")
else:
if len(ski.value.digest) == 0:
raise ValueError("subject key identifier must not be empty")
try:
self.run_certutil(['-V', '-n', nickname, '-u', 'L'],