Andre0512 / speedport

Home Assistant integration for Telekom Speedport
MIT License
22 stars 6 forks source link

SSL: CERTIFICATE_VERIFY_FAILED: certificate verify failed: self-signed certificate #13

Closed eeeeb closed 6 months ago

eeeeb commented 6 months ago

Hello,

after installing version 0.3.4 the the issue mentioned in https://github.com/Andre0512/speedport/issues/10 is fixed, but now I get the following error, when configuring to use SSL. I don't think there is a way to use anything besides a self signed certificate in the Speedport Smart 4, right?

Logger: homeassistant.config_entries
Source: config_entries.py:444
First occurred: 10:56:05 (1 occurrences)
Last logged: 10:56:05

Error setting up entry Speedport for speedport
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1146, in create_connection
    transport, protocol = await self._create_connection_transport(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1179, in _create_connection_transport
    await waiter
  File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 575, in _on_handshake_complete
    raise handshake_exc
  File "/usr/local/lib/python3.12/asyncio/sslproto.py", line 557, in _do_handshake
    self._sslobj.do_handshake()
  File "/usr/local/lib/python3.12/ssl.py", line 917, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/speedport/__init__.py", line 27, in async_setup_entry
    speedport = await Speedport(
                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/speedport/speedport.py", line 60, in create
    await self.update_status()
  File "/usr/local/lib/python3.12/site-packages/speedport/speedport.py", line 118, in update_status
    self._status = await self.api.get_status()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/speedport/api.py", line 116, in get_status
    return await self.api.get("data/Status.json")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/speedport/connection.py", line 94, in get
    async with self._session.get(url, headers={"Referer": referer}) as response:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 994, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host 10.10.1.1:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1000)')]

I am using: Speedport Smart 4 Typ A - Firmware version: 010139.3.4.001.1 Speedport integration: 0.3.4 Home Assistant

Andre0512 commented 6 months ago

Hi, thanks for reporting! Should be fixed in the new version :slightly_smiling_face:

eeeeb commented 6 months ago

Thank you for fixing it so quickly!

BreitiDE commented 6 months ago

thank you for fixing … works perfectly now …