From 39735aa6677d2907c6f724755f92ad5cc7664f2b Mon Sep 17 00:00:00 2001 From: Quentame Date: Thu, 9 Jan 2025 23:02:53 +0100 Subject: [PATCH] fix: SSL verification for any DNS (#760) --- pyproject.toml | 2 +- src/freebox_api/aiofreepybox.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9a987c77..ca36ea37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ readme = "README.rst" homepage = "https://github.com/hacf-fr/freebox-api" repository = "https://github.com/hacf-fr/freebox-api" documentation = "https://freebox-api.readthedocs.io" -keywords=["freebox"] +keywords=["freebox", "iliadbox"] classifiers = [ "Operating System :: OS Independent", "Development Status :: 5 - Production/Stable", diff --git a/src/freebox_api/aiofreepybox.py b/src/freebox_api/aiofreepybox.py index f8b2337e..65596e78 100644 --- a/src/freebox_api/aiofreepybox.py +++ b/src/freebox_api/aiofreepybox.py @@ -122,10 +122,9 @@ async def open(self, host: str, port: str) -> None: cert_path = path.join(path.dirname(__file__), "freebox_certificates.pem") ssl_ctx = ssl.create_default_context() ssl_ctx.load_verify_locations(cafile=cert_path) - if ".fbxos.fr" in host or "mafreebox.freebox.fr" in host: - # Disable strict validating introduced in Python 3.13, which doesn't - # work with default Freebox certificates - ssl_ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT + # Disable strict validation introduced in Python 3.13, which doesn't + # work with Freebox/iliadbox self-signed gateway certificates + ssl_ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT conn = TCPConnector(ssl_context=ssl_ctx) self._session = ClientSession(connector=conn)