homeassistant-satellite icon indicating copy to clipboard operation
homeassistant-satellite copied to clipboard

Certificate issues with aiohttp

Open s00500 opened this issue 9 months ago • 6 comments

Hey all, I am using a selfsigned certificate on my homeassistant install.

After installing the satelite on a different Pi I still get ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]

(Something in the likes of what is described here https://raspberrypi.stackexchange.com/questions/76419/entrusted-certificates-installation)

To try to fix then I pretty much took my CA cert and did trust it using the systems ca-certificate config... but that did not change anything for aiohttp unfortunatly...

Any pointers ?

s00500 avatar Oct 13 '23 19:10 s00500

Interestingly after I started to use my actual hostname (the one used in the certificate) I can get it to give a different error:

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host homeserver.bachi:8123 ssl:default [Network is unreachable]

Also strange, as I can ping it fine using that hostname. Also I am using this server and its self signed cert fine on my IOS devices (with the root cert installed there)

s00500 avatar Oct 13 '23 19:10 s00500

It looks like we would need to extend it like this: https://docs.aiohttp.org/en/stable/client_advanced.html#ssl-control-for-tcp-sockets

synesthesiam avatar Oct 13 '23 19:10 synesthesiam

Hm another option for a cert? Or one for skip verify?

s00500 avatar Oct 13 '23 22:10 s00500

Probably skip verification to start.

synesthesiam avatar Oct 14 '23 13:10 synesthesiam

My temporary solution for this issue was by changing line 27 in /homeassistant-satellite/homeassistant_satellite/remote.py

from async with aiohttp.ClientSession() as session:

to

async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:

gigawebs avatar Oct 22 '23 11:10 gigawebs

Nice, I added a PR

s00500 avatar Oct 30 '23 22:10 s00500