Skip to content

Commit

Permalink
Disable ssl VERIFY_X509_STRICT
Browse files Browse the repository at this point in the history
The new flag enforced in Python 3.13 with
python/cpython#107361 doesn't work with the
semi broken Freebox self signed certificates.

It should fix home-assistant/core#132333

Fixes hacf-fr#734
  • Loading branch information
therve committed Dec 7, 2024
1 parent b39c682 commit b8dd930
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/freebox_api/aiofreepybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ async def open(self, host: str, port: str) -> None:
cert_path = os.path.join(os.path.dirname(__file__), "freebox_certificates.pem")
ssl_ctx = ssl.create_default_context()
ssl_ctx.load_verify_locations(cafile=cert_path)
# Disable strict validating introduced in Python 3.13, which doesn't work with default Freebox certificates
ssl_ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT

conn = TCPConnector(ssl_context=ssl_ctx)
self._session = ClientSession(connector=conn)
Expand Down

0 comments on commit b8dd930

Please sign in to comment.