SSL Config Error

After following the instructions for setting up SSL using letsencrypt, and ensuring that I have read permissions on all the files in /etc/letsencrypt/..., when I run hass I get the following python error:

Error in HTTPServer.tick
Traceback (most recent call last):
  File "/home/josh/.homeassistant/deps/cherrypy/wsgiserver/__init__.py", line 2019, in start
self.tick()
  File "/home/josh/.homeassistant/deps/cherrypy/wsgiserver/__init__.py", line 2086, in tick
s, ssl_env = self.ssl_adapter.wrap(s)
  File "/home/josh/.homeassistant/deps/cherrypy/wsgiserver/ssl_builtin.py", line 67, in wrap
server_side=True)
  File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket
_context=self)
  File "/usr/lib/python3.5/ssl.py", line 752, in __init__
self.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:645)

My config is:

api_password: **********
server_port: 8123
ssl_certificate: /etc/letsencrypt/live/my.web.site/fullchain.pem
ssl_key: /etc/letsencrypt/live/my.web.site/privkey.pem

The letsencrypt config ran smoothly, used this guide:

Certbot

And ran this command which is on the page:

$ letsencrypt certonly --standalone -d example.com -d www.example.com

What’s going on here?

I have discovered the issue and will post the findings here.

As the stack trace shows, the error is in actually making the handshake. It dawned on me as I looked through the python ssl code that while I had the python openssl library installed, I checked and found that I did not have the python3 openssl installed. On my ubuntu system, the package is python3-openssl … install that, and to be safe, just restart the machine (it was necessary for me).

Note that you will now have to locally access hass via https://hostname:8123 (the https:// is necessary), and you will probably get errors/warnings in the console and browser due to the fact that the host name being entered (“my-local-hostname”) is not the same as your domain name. But, when accessed from outside via https://yourname.com , it should work just fine.

1 Like

I’ve had this issue open for a long time and looks like you’ve finally solved it!

Thank you! I think I might try this out this weekend.

You mean: it wasn’t working, then you installed python3-openssl, and now it works? If so, that’s great (and the best kind of bug fix :slight_smile: ) !

No. I’ve not tried anything yet, but based on your errors (same as mine) I’m assuming it will fix it.

I will keep my fingers crossed for you. I had to restart the machine after installing the package, fyi.

That was it! Great catch and thanks for updating us all on the fix.

1 Like