File tree 3 files changed +9
-4
lines changed
3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,8 @@ def san_a_label_dns_names(self):
385
385
return result
386
386
387
387
def match_hostname (self , hostname ):
388
+ from urllib3 .util import ssl_match_hostname
389
+
388
390
match_cert = {}
389
391
390
392
match_cert ['subject' ] = match_subject = []
@@ -401,8 +403,7 @@ def match_hostname(self, hostname):
401
403
for value in values :
402
404
match_san .append (('DNS' , value ))
403
405
404
- # deprecated in Python3.7 without replacement
405
- ssl .match_hostname ( # pylint: disable=deprecated-method
406
+ ssl_match_hostname .match_hostname (
406
407
match_cert , DNSName (hostname ).ToASCII ()
407
408
)
408
409
Original file line number Diff line number Diff line change @@ -2373,12 +2373,14 @@ def check_ipa_ca_san(cert):
2373
2373
2374
2374
On success returns None, on failure raises ValidationError
2375
2375
"""
2376
+ from urllib3 .util import ssl_match_hostname
2377
+
2376
2378
expect = f'{ ipalib .constants .IPA_CA_RECORD } .' \
2377
2379
f'{ ipautil .format_netloc (api .env .domain )} '
2378
2380
2379
2381
try :
2380
2382
cert .match_hostname (expect )
2381
- except ssl .CertificateError :
2383
+ except ssl_match_hostname .CertificateError :
2382
2384
raise errors .ValidationError (
2383
2385
name = 'certificate' ,
2384
2386
error = 'Does not have a \' {}\' SAN' .format (expect )
Original file line number Diff line number Diff line change @@ -710,14 +710,16 @@ def http_certificate_ensure_ipa_ca_dnsname(http):
710
710
steps.
711
711
712
712
"""
713
+ from urllib3 .util import ssl_match_hostname
714
+
713
715
logger .info ('[Adding ipa-ca alias to HTTP certificate]' )
714
716
715
717
expect = f'{ IPA_CA_RECORD } .{ ipautil .format_netloc (api .env .domain )} '
716
718
cert = x509 .load_certificate_from_file (paths .HTTPD_CERT_FILE )
717
719
718
720
try :
719
721
cert .match_hostname (expect )
720
- except ssl .CertificateError :
722
+ except ssl_match_hostname .CertificateError :
721
723
if certs .is_ipa_issued_cert (api , cert ):
722
724
request_id = certmonger .get_request_id (
723
725
{'cert-file' : paths .HTTPD_CERT_FILE })
You can’t perform that action at this time.
0 commit comments