Hass.io Custom Domain with free CloudFlare DNS hosting, DDNS and Let’s Encrypt.
- Automatic A record creation with current IP.
- Domain or Subdomain supported.
- Dynamic DNS using the CloudFlare API, monitors changes and updates IP every 5 mins.
- Let’s Encrypt certificate generation via DNS Challenge.
- Automatic DNS Challenge TXT record generation & cleanup.
This addon came about due to my inability to use the 2 current external access add-ons for my use case.
Firstly I wanted to use my own domain rather than Duckdns. Secondly I didn’t want to open port 80 to the world and the Let’s Encrypt add-on has a HTTP challenge which requires it.
Using the CloudFlare API the add-on will automatically update your IP address which negates the need for a third party DDNS service.
The Let’s Encrypt certificate generation code is from the Duckdns add-on, if I have incorrectly assigned license or credit please let me know.
I’ll do my best to support any issues. Please provide feedback!
Quick & Dirty get started guide:
- Sign up for free account.
- Add your base domain (no need to create any DNS records).
- Make a note of the CloudFlare name servers.
- Turn off the free SSL option under the Crypto menu (SSL to Off & Disable Universal SSL).
2. Domain Registrar
- Change nameservers for your domain to point to Cloudflare.
3. Home Router
- Forward desired public facing port (TCP & UDP) to your Hassio local IP & port (default local port is 8123).
4. Hassio config
Edit config file with your CloudFlare Global API Key, your CloudFlare email address and domain.
Hit start and wait for it to create the certificates.
Add the following to your configuration.yaml:
http: base_url: https://your.domain.com:portnumber ssl_certificate: /ssl/fullchain.pem ssl_key: /ssl/privkey.pem ip_ban_enabled: true login_attempts_threshold: 5
5. Restart homeassistant