Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl.match_hostname() is deprecated #627

Closed
igor-mendix opened this issue Nov 3, 2023 · 6 comments
Closed

ssl.match_hostname() is deprecated #627

igor-mendix opened this issue Nov 3, 2023 · 6 comments

Comments

@igor-mendix
Copy link

ssl.match_hostname() function used here:

match_hostname(certificate_names, server_hostname) # type: ignore

is deprecated since Python 3.7, and is already absent in 3.12.

@mig5
Copy link

mig5 commented Nov 30, 2023

Is there any easy workaround for this? This is a problem running sslyze 5.2.0 on the latest Debian stable (12 aka Bookworm).

@blshkv
Copy link

blshkv commented Nov 30, 2023

    from sslyze.plugins.certificate_info._cert_chain_analyzer import (
  File "/usr/lib/python3.12/site-packages/sslyze/plugins/certificate_info/_cert_chain_analyzer.py", line 3, in <module>
    from ssl import CertificateError, match_hostname
ImportError: cannot import name 'match_hostname' from 'ssl' (/usr/lib/python3.12/ssl.py)

sslyze fails to start with python3_12. Please fix

blshkv pushed a commit to pentoo/pentoo-overlay that referenced this issue Nov 30, 2023
@blshkv
Copy link

blshkv commented Nov 30, 2023

a potential "quick" workaround is to use "https://pypi.org/project/backports.ssl_match_hostname/", but I'm not sure.
And it's like going backwards

@kchodkiewicz
Copy link

there was the same issue in other project and I'd say there is a good solution: aiortc/aioquic#368

tl;dr

  • urllib3 has a port of match_hostname (simple to incorporate)
  • service-identity different implementation but seems to be more proper solution (a bit more complex to incorporate)

@nabla-c0d3
Copy link
Owner

This might get solved by #638

@nabla-c0d3
Copy link
Owner

Fixed in v6.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants