I’m new to this and I have managed to set up the HA in RPI 3b in raspbian, but when I’m trying to get the SSL to work I encounter problems:
My current setup: HA running in docker using the following docker compose:
and now when I start the HA I get this (where MYDOMAIN is obviously replaced by my domain):
Invalid config for [http]: not a file for dictionary value @ data[‘http’][‘ssl_key’]. Got ‘/config/homeassistant/letsencrypt/dehydrated/dehydrated/certs/MYDOMAIN/privkey.pem’. (See /config/configuration.yaml, lin$
2019-01-16 20:29:52 ERROR (MainThread) [homeassistant.setup] Setup failed for http: Invalid config.
The reason why the path begins with /config/ instead of /home/usr/ is because of the use of docker, but I have tried the both.
the http part of the configuration.yaml is as follows (mydomain is replaced in the real file and the double dehydrated is intended):
Does anyone have good ideas what I have done wrong?
I have given the sudo chmod 755 to all of those paths.
Should I change the certs to some root folders or somehow give the docker some rights or something?
Thank you in advance!
EDIT:
Solved this moving the certs-folder to the config-folder and updating permissions. Now it works.
A agree we need a more elegant solution.
I tried a symbolic link from the original files to avoid problems at renewal. No way, Home Assistant says it’s not a file…
I finished like the others by a copy of the files, but that suppose I don’t forget to redo the copy after renewal of the certs.
Hi, for me giving absolute path to cert files solved the problem.
So use /home/homeassistant/… instead /config/… at the beginning of paths
To be exact it was /volume1/homeassistant/ in my case since I run HA Core directly on Synology NAS not on RPi, but above should solve your problem
Now I have problem that I cannot access HA through http://IP_ADDRESS:8123 in local network - I need to use https://IP_ADDRESS:8123 which gives me warning about not secured connection in browser… but that’s problem for another thread I suppose
I found better solution, more elegant for those of you who have HA installed in Docker container. I had same problem that HA could have not access my ssl cert and key, even I run docker with volume attached which pointed on folder with ssl files. My setup is that I’ve created ssl cert with Let’s Encrypt certbot on host Raspberry Pi4 and then I run HA in Docker container with following command:
This caused me same error HA complaining that “Invalid config for [http]: not a file for dictionary value”
I figured out that actually cert files in this live/mydomian folder are symbolic links to /etc/letsencrypt/archive, therefore I figured that HA within Docker containers is trying to access files via symlinks which are outside of the attached volume.
Solution:
I run HA docker attaching whole /etc/letsencrypt folder instead just only /etc/letsencrypt/live/mydomain
I had to use “/ssl/…pem” otherwise HA still throws the same error message. But great idea. I use OPNSense to generate Let’s Encrypt SSL-certs. Your idea of mounting an SSL-volume works great! thanks.
There is renewal-hooks/post in letsencrypt (executed one certs has been renewed)
Create bash script with
/etc/letsencrypt/renewal-hooks/post/copyhass.sh
Hey so I thought I would add some clarity to the cause of this problem as I was dealing with it for the last few days and getting no where till I found this post.
First off this problem is very specific to running HA in Docker and using Lets Encrypt for your certs on a Linux system. Now here’s why:
Let’s Encrypt will tell you that your certs are located in the following dir for your use: /etc/letsencrypt/live/<my_url>.duckdns.org/ This is not exactly true. While there are files in that dir that you can “use” they are not the real files. They are symlinks to where the real files are actually located, which is here: /etc/letsencrypt/archive/<my_url>.duckdns.org/ -Note the 3rd dir is different.
Normally this would not be a problem for most applications. However, Docker is one of those exceptions. Docker containers have literally only exactly what a container needs to run, and nothing more. So when you mount the volume /ssl as the dir /etc/letsencrypt/live/<my_url>.duckdns.org/, you are only getting exactly that dir and nothing more. And because the symlinks are more like shortcuts, you have now cut off the link to the real location of the files in the /etc/letsencrypt/archive/<my_url>.duckdns.org/ dir. Thus HA says the file does not exist, because it actually does not as far as the HA docker container is concerned.
And hopefully now you can see why ed.circ’s solution did not work until they mounted the dir before the archive/live dir at /etc/letsencrypt/ As once the real location of /etc/letsencrypt/archive/<my_url>.duckdns.org/ was readable in the HA docker, the symlinks at /etc/letsencrypt/live/<my_url>.duckdns.org/ are working again.
Hopefully this helps someone else not spend days trying to figure out the problem. And maybe we can get an update to the wiki site as well.
I faced the same issue and thought I’d say what I did.
I use acme.sh and it’s not that hard with it. I had to move the cert/key in the /ssl directory but the configuration.yaml doesn’t like the symlink: /root/ssl -> /ssl. So, this is config section:
acme.sh generates the certificates in this directory: /root/.acme.sh/<your_domain> and there should be an auto-generated file, called: <your_domain>.conf, where the renewal-hook can be configured.
I created a directory, called: hooks, under /root/.acme.sh:
cd /root/.acme.sh && mkdir hooks
and created a simple bash script to copy the cert/key from the original location to /ssl directory:
am I the only one that can’t get this to actually work? I have followed ed.cric’s directions to the letter and I still get the error, I have added the / before the ssl in the path - /ssl/fullchain.pem, I have left the / off the ssl in the path – ssl/fullchainpem, I have even declared the entire exact path /home/[username]/HASS/ssl/fullchain.pem and NOTHING works
I feel like this is an elaborate ruse to get me to pay for nabu casa and its working!!!
No, you’re not alone. I’ve recently tried to install the DuckDNS addon. It keeps reminding me that I’m only 5 minutes away from securing access. Lies. I also cannot find my certificate files. I’m also doing this the hard way because I want to touch internet as little as possible.
EDIT: Addding thi upfront here-- DOCKER IS NOT YOUR FRIEND WITH SSL CERTS… No matter what I ever did docker refused to allow me to show, move, transfer, copy, or make references to SSL certs. Install the HassOS and live again
I ended up installing the HassOS on debian and skipping the docker install altogether in favor of a single platform that I was able to also install HACS and have the originally supported Add-ons as well. I think docker is installed here as well just incase you want to run things along side it, but honestly I havent had the need for that either. Things like DuckDNS, and NodeRED, and MQTT are supported in Add-ons now. I’ve been running this for about 8 months now with full SSL certs and ZERO problems (besides the ones I create for myself lol). PM me if you need help getting all that set-up and Ill see what I can do! I know its possible now!
Hi all,
I need your help. I have just started to play with Hassio on my pi 4 bu I found the same problem on secure connection:
The system cannot restart because the configuration is not valid: 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 26).