@@ -216,67 +216,3 @@ def check_dns_caa_record_should_include_validationmethods(responses, **kwargs):
216216 warn_on_fail = True ,
217217 ** kwargs ,
218218 )
219-
220-
221- # Check: SSL certificate must provide OCSP URI
222- def check_ssl_certificate_must_include_ocsp_uri (responses , ** kwargs ):
223- certificate = get_ssl_certificate (kwargs ["domain" ], ipv6 = kwargs ["is_ipv6" ])
224- if not certificate :
225- ocsp = None
226- else :
227- ocsp = certificate .get ("OCSP" , None )
228-
229- return result (
230- ocsp and all ([("https://" in r or "http://" in r ) for r in ocsp ]),
231- f"SSL certificate must provide OCSP URI ({ ocsp } )" ,
232- "ssl_provide_ocsp_uri" ,
233- ** kwargs ,
234- )
235-
236-
237- # Check: SSL certificate should provide OCSP must-staple
238- def check_ssl_certificate_should_provide_ocsp_must_staple (responses , ** kwargs ):
239- try :
240- from cryptography import x509
241- except ImportError :
242- return result (
243- False ,
244- f"SSL certificate should provide OCSP must-staple (cryptography not installed)" ,
245- "ssl_ocsp_must_staple" ,
246- warn_on_fail = True ,
247- ** kwargs ,
248- )
249-
250- certificate = get_ssl_certificate (kwargs ["domain" ], ipv6 = kwargs ["is_ipv6" ], binary = True )
251- if not certificate :
252- return result (
253- False ,
254- f"SSL certificate should provide OCSP must-staple (failed to load certificate)" ,
255- "ssl_ocsp_must_staple" ,
256- ** kwargs ,
257- )
258-
259- loaded = x509 .load_der_x509_certificate (certificate )
260-
261- has_must_staple_extension = False
262- msg = "missing extension"
263-
264- lifetime_days = (loaded .not_valid_after - loaded .not_valid_before ).days
265- if lifetime_days < 10 :
266- has_must_staple_exension = True
267- msg = "certificate is short-lived; missing extension"
268-
269- else :
270- for extension in loaded .extensions :
271- # see https://github.com/sesh/ready/issues/15 for details
272- if extension .oid .dotted_string == "1.3.6.1.5.5.7.1.24" :
273- has_must_staple_extension = True
274- msg = "includes extension"
275-
276- return result (
277- has_must_staple_extension ,
278- f"Long-lived SSL certificate should provide OCSP must-staple ({ msg } )" ,
279- "ssl_ocsp_must_staple" ,
280- warn_on_fail = True ,
281- ** kwargs ,
282- )
0 commit comments