I use a 4G connection at home that does not give me a public IP address. In order to allow me to access the Hassio UI/API from outside my home I’m using an SSH reverse tunnel.
NOTE: This is WIP. Sometimes it seems to stop working. I’m putting it here in the hopes that people use/fix it. Maybe we can turn it into an addon. Or maybe all this has already been done and better, and I just missed it.
In order for this to work, you need SSH access to a server that is accessible from the internet. The smallest, cheapest linux server you can find will work.
On the server, we run software called Caddy, that will reverse proxy the connection home, and automatically get an SSL/TLS certificate from LetsEncrypt.
First, find/generate an SSH key for Hassio. This is the key that it will use to log into your server.
Instructions are here: How To Configure SSH Key-Based Authentication on a Linux Server | DigitalOcean
Save the private key into your config directory, as id_rsa
Next, install the SSH - Secure Shell
add-on.
In the SSH server options, add this
"packages": [
"autossh"
],
"init_commands": [
"autossh -N -M 18123 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o \"PubkeyAuthentication=yes\" -o \"PasswordAuthentication=no\" -i ~/config/id_rsa -R 8888:localhost:8123 [email protected] &"
]
This will automatically install autossh, and then connect to your server, exposing the port 8123 as 8888 on the server (only accessible from the server itself).
Now, on the server we need to proxy this, and expose it via HTTPS.
Log into your server, and Install Caddy - https://caddyserver.com/
Save a file called Caddyfile
somewhere, and put this in it
home.myserver.com
proxy / localhost:8888 {
websocket
}
And start caddy.
After a minute, you should be able to get to your dashboard at https://home.myserver.com
Have fun!