Would appreciate some input on configuring SSL to work with HA within a Docker container.
I have:
Using Letsencrypt created a SSL certificate for ‘my domain.com’ and ‘*.mydomain.com’ (wildcard certificate). The certificate files are stored in the folder ~/docker/letsencrypt/data/live/mydomain.com
Updated my docker-compose file to share the folder on the host containing the certificates with the Docker container.
However HA throws an error on startup to the effect that it cannot find the files:
2018-09-14 12:50:29 ERROR (MainThread) [homeassistant.config] Invalid config for [http]: not a file for dictionary value @ data['http']['ssl_certificate']. Got '/SSL/fullchain.pem'
not a file for dictionary value @ data['http']['ssl_key']. Got '/SSL/privkey.pem'. (See /config/configuration.yaml, line 43). Please check the docs at https://home-assistant.io/components/http/
When I attach to the Docker container I can open the SSL folder and list out the files that it contains. I can also see that the correct permissions appear to be set.
Sorry not in front of my pc now. Will try later
It’s basically 2 python scripts. One checks how many days left on the cert. It runs on a crontab one a day and calls the second one when I have less than 30 days left.the second one renews the certs, copies the files and restarts the docker container
hi @Texangeek - did you get a resolution on this? I have the same problem. Im running raspian debian in my case - pi3. For now, i need to hash-comment-out this part of my config file in order to get the HA webserver to even start up again on port 8123 (in http:// mode only):
Ive used the -v switch when spinning up my container to create the /KSSL/ mound point, and its pointed to my full /etc/letsencrypt/live/XXXXX/ directory.
But im getting the same error as you:
2019-03-10 19:06:15 ERROR (MainThread) [homeassistant.config] Invalid config for [http]: not a file for dictionary value @ data[‘http’][‘ssl_certificate’]. Got ‘/KSSL/fullchain.pem’
not a file for dictionary value @ data[‘http’][‘ssl_key’]. Got ‘/KSSL/privkey.pem’. (See /config/configuration.yaml, line 46). Please check the docs at HTTP - Home Assistant
2019-03-10 19:06:15 ERROR (MainThread) [homeassistant.setup] Setup failed for http: Invalid config.
Shout back if you got a resolution, as im kinda stuck!
Not sure if this is the answer that you’re after but ever since I moved my ssl stuff to the let’s encrypt docker and used the built in nginx with it I no longer have ssl related errors in ha
I won’t pretend to know everything there is to know about certificates, I’m still relatively new to this so bear it in mind when I ask:
If it’s all internal and not exposed to the Internet why do you need https encryption?
Yes it is a bit over the top you’d think. Firstly more and more browsers make non https browsing difficult. Secondly, Troy Hunt thinks it is a good idea and he know more about this than I do .
I have discovered that I can apt-get install python3-certbot-dns-cloudflare which is easy to do. I think will work on individual machines, and using a DNS-01 challenge does not require the FQDN to be previously defined. You can point the certificates to the right folder so Hass.io will just pick them up (needs testing but is a fantastic solution).
went down the rabbit hole on this stuff this weekend!
Wanted to learn kubernetes, so ive spun up a cluster with the end goal being a Home Assistant container (amongst others), orchestrated by kubernetes. After that i want to spin up Envoy as the ‘sidecar proxy’ fronting Home Assistant with Istio orchestrating the proxy (why? see https://kubedex.com/istio-vs-linkerd-vs-linkerd2-vs-consul/ … these are going to be big in my industry, so wanted to learn them at home). Envoy is able to SSL reverse proxy. so will try for that for the HA setup.
Good in theory…!
(im currently stuck how to present the /config HA directory to kube and have asked for help here - Kubernetes Helm Chart )…
For anyone interested i think i hit a roadblock here thats probably a showstopper for me running HA under Kube. The problem is access to /dev/ttyXXX usb zwave stick doesnt seem to be possible without a ‘device package’. And id be surprised if anyone could be botherered writing one for this. I suspect at least for now im part of a very small lit of people wanting to run HA under kube.
The files in “live” directory are symbolic links. You should mount the directory where actual files are in your docker container, otherwise your container can not access those files because they are not mounted.
This got me completely stumped with my “supervised” installation so I thought I’d add a comment to help the next person.
It would seem that the ssl_certificate and ssl_key paths are, despite the use of a leading ‘/,’ are always relative.
I had to put the keys into /usr/share/hassio/ssl on the file system, but they are defined in /usr/share/hassio/homeassistant/configuration.yaml like this: