mampfes / script.module.openhab

openHAB for Kodi
Other
11 stars 4 forks source link

Openhab with SSL not working #8

Open Urmel opened 4 years ago

Urmel commented 4 years ago

I only have OH available via SSL, self-signed certificate. Plugin initially will fail as it tries to connect using http. Error in kodi.log:

build_menu failed, host=, port=8443, auth=0, e=ConnectionError(ProtocolError('Connection aborted.', BadStatusLine('\x15\x03\x03\x00\x02\x02P',)),)

Fiddeling a bit with it shows that an initial connection and selection of sitemap is possible by changing openhab2.py, method Server.fetch_abs_json_url, line 208 to

resp = requests.get(url, headers=headers, proxies=self.http_proxies, verify=False)

There still seem to be some furhter issues and - not just because the log is cluddered with warnings for ignoring the cert verification - it should rather be handled by correclty verifiying the certificate. This likely would need accessing a user-provided crt file - either with Env Var "REQUESTS_CA_BUNDLE" or by adding the file in the request, as stated here: http://steven.casagrande.io/articles/python-requests-and-ssl/.

I'm not sure how this file can be passed to the plugin the correct way in the kodi environment...