From 2a3b0ec0d37e162d0784b0200505db585c31b150 Mon Sep 17 00:00:00 2001 From: Noam Okman Date: Mon, 18 May 2020 13:22:51 +0300 Subject: [PATCH] Duckdns alias support (#1253) * Add alias option to duckdns * add docs * fix DOCS * Update config.json * Update CHANGELOG.md * Update DOCS.md Co-authored-by: Pascal Vizeli --- duckdns/CHANGELOG.md | 43 +++++-------------------------------------- duckdns/DOCS.md | 18 ++++++++++++++++++ duckdns/config.json | 6 +++++- duckdns/data/hooks.sh | 10 ++++++---- 4 files changed, 34 insertions(+), 43 deletions(-) diff --git a/duckdns/CHANGELOG.md b/duckdns/CHANGELOG.md index 042a702..b87b86a 100644 --- a/duckdns/CHANGELOG.md +++ b/duckdns/CHANGELOG.md @@ -1,51 +1,18 @@ # Changelog -## 1.12 +## 1.12.0 - Add option to specify a service or URL as IPv4 and IPv6 address source +- Add DNS alias option to allow pointing a CNAME at a Duck DNS subdomain -## 1.11 +## 1.11.0 - Do not skip TLS security checks on Duck DNS API access -## 1.10 +## 1.10.0 - Fix issue with dehydrated lock file -## 1.9 +## 1.9.0 - Fix issue with empty IPv4 / IPv6 - -## 1.8 - -- Update dehydrated to 0.6.5 -- Migrate scripts to bashio - -## 1.7 - -- Add support for manual set IPv4 and IPv6 address - -## 1.6 - -- Update Alpine images / OpenSSL - -## 1.5 - -- Fix bug with multible domains for Let's encrypt - -## 1.4 - -- Update dehydrated to version 0.6.2 - -## 1.3 - -- Fix dehydrated warning from hook script - -## 1.2 - -- Update dehydrated to version 0.6.1 - -## 1.1 - -- Update dehydrated to version 0.5.0 -- Update base image to alpine 3.7 diff --git a/duckdns/DOCS.md b/duckdns/DOCS.md index 9fe3524..03a83fb 100644 --- a/duckdns/DOCS.md +++ b/duckdns/DOCS.md @@ -81,6 +81,24 @@ The DuckDNS authentication token found at the top of the DuckDNS account landing A list of DuckDNS subdomains registered under your account. An acceptable naming convention is `my-domain.duckdns.org`. +### Option: `aliases` (optional) + +A list aliases of domains configured on the `domains` option. +This is useful in cases where you would like to use your own domain. +Create a CNAME record to point at the DuckDNS subdomain and set this value accordingly. + +For example: +```yaml +domains: + - my-domain.duckdns.org + - ha.my-domain.com +aliases: + - domain: ha.my-domain.com + alias: my-domain.duckdns.org +``` + +Also, add your custom domain name to the `domains` array to create the certificate for both domains + ### Option: `seconds` The number of seconds to wait before updating DuckDNS subdomains and renewing Let's Encrypt certificates. diff --git a/duckdns/config.json b/duckdns/config.json index 4b29a21..3089a58 100644 --- a/duckdns/config.json +++ b/duckdns/config.json @@ -1,6 +1,6 @@ { "name": "Duck DNS", - "version": "1.11", + "version": "1.12.0", "slug": "duckdns", "description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support", "url": "https://github.com/home-assistant/hassio-addons/tree/master/duckdns", @@ -16,6 +16,7 @@ }, "token": null, "domains": [null], + "aliases": [], "seconds": 300 }, "schema": { @@ -28,6 +29,9 @@ "ipv6": "str?", "token": "str", "domains": ["str"], + "aliases": [ + {"domain": "str", "alias": "str"} + ], "seconds": "int" }, "image": "homeassistant/{arch}-addon-duckdns" diff --git a/duckdns/data/hooks.sh b/duckdns/data/hooks.sh index 615860f..b3f9bc9 100755 --- a/duckdns/data/hooks.sh +++ b/duckdns/data/hooks.sh @@ -11,7 +11,8 @@ SYS_KEYFILE=$(jq --raw-output '.lets_encrypt.keyfile' $CONFIG_PATH) # https://github.com/lukas2511/dehydrated/blob/master/docs/examples/hook.sh deploy_challenge() { - local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" + local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" ALIAS + ALIAS="$(jq --raw-output --exit-status "[.aliases[]|{(.domain):.alias}]|add.\"$DOMAIN\"" $CONFIG_PATH)" || ALIAS="$DOMAIN" # This hook is called once for every domain that needs to be # validated, including any alternative names you may have listed. @@ -30,11 +31,12 @@ deploy_challenge() { # TXT record. For HTTP validation it is the value that is expected # be found in the $TOKEN_FILENAME file. - curl -s "https://www.duckdns.org/update?domains=$DOMAIN&token=$SYS_TOKEN&txt=$TOKEN_VALUE" + curl -s "https://www.duckdns.org/update?domains=$ALIAS&token=$SYS_TOKEN&txt=$TOKEN_VALUE" } clean_challenge() { - local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" + local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" ALIAS + ALIAS="$(jq --raw-output --exit-status "[.aliases[]|{(.domain):.alias}]|add.\"$DOMAIN\"" $CONFIG_PATH)" || ALIAS="$DOMAIN" # This hook is called after attempting to validate each domain, # whether or not validation was successful. Here you can delete @@ -42,7 +44,7 @@ clean_challenge() { # # The parameters are the same as for deploy_challenge. - curl -s "https://www.duckdns.org/update?domains=$DOMAIN&token=$SYS_TOKEN&txt=removed&clear=true" + curl -s "https://www.duckdns.org/update?domains=$ALIAS&token=$SYS_TOKEN&txt=removed&clear=true" } deploy_cert() {