-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for short-lived TLS certificates
- Loading branch information
Showing
20 changed files
with
386 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
from pyasn1_alt_modules import rfc5280 | ||
|
||
from pkilint import validation, document | ||
from pkilint.pkix import certificate, general_name | ||
|
||
|
||
class EndEntityRevocationInformationPresenceValidator(validation.Validator): | ||
""" | ||
Microsoft Root Program Requirements, 3.A.5: | ||
An end-entity certificate may contain either an AIA extension with a valid OCSP URL and/or a CDP extension pointing | ||
to a valid HTTP endpoint containing the CRL. | ||
""" | ||
|
||
VALIDATION_REVOCATION_INFORMATION_ABSENT = validation.ValidationFinding( | ||
validation.ValidationFindingSeverity.ERROR, | ||
"msft.end_entity.revocation_information_absent", | ||
) | ||
|
||
def __init__(self): | ||
super().__init__( | ||
validations=[self.VALIDATION_REVOCATION_INFORMATION_ABSENT], | ||
pdu_class=rfc5280.Extensions, | ||
) | ||
|
||
@classmethod | ||
def _general_name_is_http_uri(cls, gn): | ||
gn_type, gn_value = gn.child | ||
|
||
return ( | ||
gn_type == general_name.GeneralNameTypeName.UNIFORM_RESOURCE_IDENTIFIER | ||
and str(gn_value.pdu).lower().startswith("http://") | ||
) | ||
|
||
@classmethod | ||
def _has_ocsp_http_uri(cls, cert: certificate.RFC5280Certificate): | ||
aia_ext_and_idx = cert.get_extension_by_oid(rfc5280.id_pe_authorityInfoAccess) | ||
|
||
if aia_ext_and_idx is None: | ||
return False | ||
|
||
aia_ext, _ = aia_ext_and_idx | ||
|
||
# ensure that the decoded value is present | ||
try: | ||
aia_ext_value = aia_ext.navigate("extnValue.authorityInfoAccessSyntax") | ||
except document.PDUNavigationFailedError: | ||
return False | ||
|
||
ocsp_gns = ( | ||
ad.children["accessLocation"] | ||
for ad in aia_ext_value.children.values() | ||
if ad.children["accessMethod"].pdu == rfc5280.id_ad_ocsp | ||
) | ||
|
||
return any(cls._general_name_is_http_uri(gn) for gn in ocsp_gns) | ||
|
||
@classmethod | ||
def _has_crldp_http_uri(cls, cert: certificate.RFC5280Certificate): | ||
crldp_ext_and_idx = cert.get_extension_by_oid( | ||
rfc5280.id_ce_cRLDistributionPoints | ||
) | ||
|
||
if crldp_ext_and_idx is None: | ||
return False | ||
|
||
crldp_ext, _ = crldp_ext_and_idx | ||
|
||
# ensure that the decoded value is present | ||
try: | ||
crldp_ext_value = crldp_ext.navigate("extnValue.cRLDistributionPoints") | ||
except document.PDUNavigationFailedError: | ||
return False | ||
|
||
for dp in crldp_ext_value.children.values(): | ||
dpn = dp.children.get("distributionPoint") | ||
|
||
if dpn is None: | ||
continue | ||
|
||
full_name = dpn.children.get("fullName") | ||
|
||
if full_name is None: | ||
continue | ||
|
||
if any( | ||
cls._general_name_is_http_uri(gn) for gn in full_name.children.values() | ||
): | ||
return True | ||
|
||
return False | ||
|
||
def validate(self, node): | ||
cert_doc = node.document | ||
|
||
has_aia_ocsp_http_uri = self._has_ocsp_http_uri(cert_doc) | ||
has_crldp_http_uri = self._has_crldp_http_uri(cert_doc) | ||
|
||
if not has_aia_ocsp_http_uri and not has_crldp_http_uri: | ||
raise validation.ValidationFindingEncountered( | ||
self.VALIDATION_REVOCATION_INFORMATION_ABSENT | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/integration_certificate/tls_br/dv_final_certificate/long_lived_no_rev_info.crttest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFKTCCBBGgAwIBAgIKd3d3d3d3d3d3dzANBgkqhkiG9w0BAQsFADBFMQswCQYD | ||
VQQGEwJVUzETMBEGA1UEChMKQ2VydHMgUiBVczEhMB8GA1UEAxMYQ2VydHMgUiBV | ||
cyBJc3N1aW5nIENBIEcxMB4XDTIzMDYwMjAwMDAwMFoXDTI0MDYwMTIzNTk1OVow | ||
ADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJjfM1nBO6c4jF2eL+PP | ||
y+pQOjb+d6eYUk3CypR4j+bzV104d/LT12ukkEL3cR5YapINlZFfMnGxkxz12+AK | ||
1tKo2m8agDlXTeWvl1hS0axCGOGZL16wvR078oxejK2nmfWlUdFhSmWpFyOeuxCG | ||
tTaeqjOHjABvKOwqXNlRTlw0CCQ6j2GFqLGPbJ5yfqGLiDGBB+iVdS8oCQ6RtPks | ||
HH/FNBVeWbwhHE6jrH+yTHbkxJzZwc5W86YHH0PwmsXdCT9gdyfYD1UFm4Ly9iBA | ||
CgUEYbnXEeYmiZV40yDFbwkZ2JvhmtjN4zJpEc4/DP40wMolSZ1F0Gd+2XjJDjSV | ||
iDkCAwEAAaOCAl4wggJaMB8GA1UdIwQYMBaAFGpOUL+YaJ1beyB11FkBeUhmkjIG | ||
MB0GA1UdEQEB/wQTMBGCD3d3dy5leGFtcGxlLmNvbTAOBgNVH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5SlobEXx4DGy1dkIev3kdHqL35 | ||
PG7dfEKrx6fD8xlYnWOYSnqNet6EZBCFe+ZNTp8= | ||
-----END CERTIFICATE----- | ||
|
||
node_path,validator,severity,code,message | ||
certificate.tbsCertificate.extensions,EndEntityRevocationInformationPresenceValidator,ERROR,msft.end_entity.revocation_information_absent, | ||
certificate.tbsCertificate.extensions,SubscriberRevocationInformationPresenceValidator,ERROR,cabf.serverauth.subscriber.revocation_information_absent, |
34 changes: 34 additions & 0 deletions
34
...ion_certificate/tls_br/dv_final_certificate/long_lived_no_rev_info_issued_in_2026.crttest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFKTCCBBGgAwIBAgIKd3d3d3d3d3d3dzANBgkqhkiG9w0BAQsFADBFMQswCQYD | ||
VQQGEwJVUzETMBEGA1UEChMKQ2VydHMgUiBVczEhMB8GA1UEAxMYQ2VydHMgUiBV | ||
cyBJc3N1aW5nIENBIEcxMB4XDTI2MDMxNTAwMDAwMFoXDTI2MDMyMjAwMDAwMFow | ||
ADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJjfM1nBO6c4jF2eL+PP | ||
y+pQOjb+d6eYUk3CypR4j+bzV104d/LT12ukkEL3cR5YapINlZFfMnGxkxz12+AK | ||
1tKo2m8agDlXTeWvl1hS0axCGOGZL16wvR078oxejK2nmfWlUdFhSmWpFyOeuxCG | ||
tTaeqjOHjABvKOwqXNlRTlw0CCQ6j2GFqLGPbJ5yfqGLiDGBB+iVdS8oCQ6RtPks | ||
HH/FNBVeWbwhHE6jrH+yTHbkxJzZwc5W86YHH0PwmsXdCT9gdyfYD1UFm4Ly9iBA | ||
CgUEYbnXEeYmiZV40yDFbwkZ2JvhmtjN4zJpEc4/DP40wMolSZ1F0Gd+2X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WTcJm2Q/UuVtL+F4cZzLCd | ||
NmekdtPZg+LGufz6qL7loBnI+uGI0rKcojULqGEJv/xOZe7uHZ/fWXRmENn4AZk3 | ||
z+rJgzxpkbMuneAuyla987b8J57rdt1CZYvoJQ5SlobEXx4DGy1dkIev3kdHqL35 | ||
PG7dfEKrx6fD8xlYnWOYSnqNet6EZBCFe+ZNTp8= | ||
-----END CERTIFICATE----- | ||
|
||
node_path,validator,severity,code,message | ||
certificate.tbsCertificate.extensions,SubscriberRevocationInformationPresenceValidator,ERROR,cabf.serverauth.subscriber.revocation_information_absent | ||
certificate.tbsCertificate.extensions,EndEntityRevocationInformationPresenceValidator,ERROR,msft.end_entity.revocation_information_absent, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ificate/tls_br/dv_final_certificate/short_lived_no_rev_info_before_effective_date.crttest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFKTCCBBGgAwIBAgIKd3d3d3d3d3d3dzANBgkqhkiG9w0BAQsFADBFMQswCQYD | ||
VQQGEwJVUzETMBEGA1UEChMKQ2VydHMgUiBVczEhMB8GA1UEAxMYQ2VydHMgUiBV | ||
cyBJc3N1aW5nIENBIEcxMB4XDTIzMDYwMjAwMDAwMFoXDTIzMDYwMzIzNTk1OVow | ||
ADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJjfM1nBO6c4jF2eL+PP | ||
y+pQOjb+d6eYUk3CypR4j+bzV104d/LT12ukkEL3cR5YapINlZFfMnGxkxz12+AK | ||
1tKo2m8agDlXTeWvl1hS0axCGOGZL16wvR078oxejK2nmfWlUdFhSmWpFyOeuxCG | ||
t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mwpnxs29XLOhSDBycwDQYJKoZI | ||
hvcNAQELBQADggEBAF339kViIn6T3J5aYis8ivEGm7IYd875NtzqMfi2u23ne/5S | ||
ECD/1hK/7OR9c8XuLNwlON+fAywZl/dwfaDKfmn6xzyZf2ZBAL1YRDrTPjnsKDpY | ||
2qIvFJlgutIpnhlU+DSGReyN5ooJnfPvK7mjMA4Gn0WTcJm2Q/UuVtL+F4cZzLCd | ||
NmekdtPZg+LGufz6qL7loBnI+uGI0rKcojULqGEJv/xOZe7uHZ/fWXRmENn4AZk3 | ||
z+rJgzxpkbMuneAuyla987b8J57rdt1CZYvoJQ5SlobEXx4DGy1dkIev3kdHqL35 | ||
PG7dfEKrx6fD8xlYnWOYSnqNet6EZBCFe+ZNTp8= | ||
-----END CERTIFICATE----- | ||
|
||
node_path,validator,severity,code,message | ||
certificate.tbsCertificate.extensions,SubscriberRevocationInformationPresenceValidator,ERROR,cabf.serverauth.subscriber.revocation_information_absent, | ||
certificate.tbsCertificate.extensions,EndEntityRevocationInformationPresenceValidator,ERROR,msft.end_entity.revocation_information_absent, |
Oops, something went wrong.