diff --git a/duckdns/CHANGELOG.md b/duckdns/CHANGELOG.md index d2fef79..72caef4 100644 --- a/duckdns/CHANGELOG.md +++ b/duckdns/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.8 + +- Update dehydrated to 0.6.5 +- Migrate scripts to bashio + ## 1.7 - Add support for manual set IPv4 and IPv6 address diff --git a/duckdns/Dockerfile b/duckdns/Dockerfile index 4481431..f56c08b 100644 --- a/duckdns/Dockerfile +++ b/duckdns/Dockerfile @@ -1,9 +1,6 @@ ARG BUILD_FROM FROM $BUILD_FROM -# Add env -ENV LANG C.UTF-8 - # Setup base ARG DEHYDRATED_VERSION RUN apk add --no-cache curl openssl \ @@ -11,6 +8,6 @@ RUN apk add --no-cache curl openssl \ && chmod a+x /usr/bin/dehydrated # Copy data -COPY *.sh / +COPY data/*.sh / CMD [ "/run.sh" ] diff --git a/duckdns/README.md b/duckdns/README.md new file mode 100644 index 0000000..cb7f68a --- /dev/null +++ b/duckdns/README.md @@ -0,0 +1,75 @@ +# Hass.io Core Add-on: DuckDNS + +Automatically update your Duck DNS IP address with integrated HTTPS support via Let's Encrypt. + +![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield] + +## About + +[Duck DNS][duckdns] is a free service which will point a DNS (sub domains of duckdns.org) to an IP of your choice. This add-on includes support for Let’s Encrypt and will automatically create and renew your certificates. You will need to sign up for a Duck DNS account before using this add-on. + +## Installation + +The installation of this add-on is straightforward and easy to do. + +1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**. +2. Find the "DuckDNS" add-on and click it. +3. Click on the "INSTALL" button. + +## How to use + + +## Configuration + +Add-on configuration: + +```json +{ + "lets_encrypt": { + "accept_terms": true, + "certfile": "fullchain.pem", + "keyfile": "privkey.pem" + }, + "token": "sdfj-2131023-dslfjsd-12321", + "domains": ["my-domain.duckdns.org"], + "seconds": 300 +} +``` + +### Option: `lets_encrypt` + + +### Option: `token` + + +### Option: `domains` + + +### Option: `seconds` + + +## Known issues and limitations + + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Home Assistant Discord Chat Server][discord]. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +In case you've found an bug, please [open an issue on our GitHub][issue]. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg +[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg +[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg +[discord]: https://discord.gg/c5DvZ4e +[forum]: https://community.home-assistant.io +[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg +[issue]: https://github.com/home-assistant/hassio-addons/issues +[reddit]: https://reddit.com/r/homeassistant +[duckdns]: https://duckdns.org diff --git a/duckdns/build.json b/duckdns/build.json index 8a49773..9bbf6de 100644 --- a/duckdns/build.json +++ b/duckdns/build.json @@ -1,5 +1,12 @@ { + "build_from": { + "amd64": "homeassistant/amd64-base:3.10", + "i386": "homeassistant/i386-base:3.10", + "armhf": "homeassistant/armhf-base:3.10", + "armv7": "homeassistant/armv7-base:3.10", + "aarch64": "homeassistant/aarch64-base:3.10" + }, "args": { - "DEHYDRATED_VERSION": "0.6.2" + "DEHYDRATED_VERSION": "0.6.5" } } diff --git a/duckdns/config.json b/duckdns/config.json index 1d1e918..7d2dd7c 100644 --- a/duckdns/config.json +++ b/duckdns/config.json @@ -1,6 +1,6 @@ { "name": "Duck DNS", - "version": "1.7", + "version": "1.8", "slug": "duckdns", "description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support", "url": "https://www.home-assistant.io/addons/duckdns/", diff --git a/duckdns/hooks.sh b/duckdns/data/hooks.sh similarity index 100% rename from duckdns/hooks.sh rename to duckdns/data/hooks.sh diff --git a/duckdns/run.sh b/duckdns/data/run.sh similarity index 56% rename from duckdns/run.sh rename to duckdns/data/run.sh index 8ede5e4..d7413be 100755 --- a/duckdns/run.sh +++ b/duckdns/data/run.sh @@ -1,28 +1,27 @@ -#!/bin/bash -set -e +#!/usr/bin/env bashio CERT_DIR=/data/letsencrypt WORK_DIR=/data/workdir -CONFIG_PATH=/data/options.json # Let's encrypt -LE_TERMS=$(jq --raw-output '.lets_encrypt.accept_terms' $CONFIG_PATH) -LE_DOMAINS=$(jq --raw-output '.domains[]' $CONFIG_PATH) LE_UPDATE="0" # DuckDNS -IPV4=$(jq --raw-output '.ipv4 // empty' $CONFIG_PATH) -IPV6=$(jq --raw-output '.ipv6 // empty' $CONFIG_PATH) -TOKEN=$(jq --raw-output '.token' $CONFIG_PATH) -DOMAINS=$(jq --raw-output '.domains | join(",")' $CONFIG_PATH) -WAIT_TIME=$(jq --raw-output '.seconds' $CONFIG_PATH) +IPV4=$(bashio::config 'ipv4') +IPV6=$(bashio::config 'ipv6') +TOKEN=$(bashio::config 'token') +DOMAINS=$(bashio::config 'domains|join(",")') +WAIT_TIME=$(bashio::config 'seconds') # Function that performe a renew function le_renew() { local domain_args=() + local domains + domains=$(bashio::config 'domains') + # Prepare domain for Let's Encrypt - for domain in $LE_DOMAINS; do + for domain in $domains; do domain_args+=("--domain" "$domain") done @@ -31,7 +30,7 @@ function le_renew() { } # Register/generate certificate if terms accepted -if [ "$LE_TERMS" == "true" ]; then +if bashio::config.true 'lets_encrypt.accept_terms'; then # Init folder structs mkdir -p "$CERT_DIR" mkdir -p "$WORK_DIR" @@ -47,11 +46,14 @@ fi # Run duckdns while true; do - answer="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=$IPV4&ipv6=$IPV6&verbose=true")" || true - echo "$(date): $answer" + if answer="$(curl -sk "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&ip=$IPV4&ipv6=$IPV6&verbose=true")"; then + bashio::log.info "$answer" + else + bashio::log.warning "$answer" + fi now="$(date +%s)" - if [ "$LE_TERMS" == "true" ] && [ $((now - LE_UPDATE)) -ge 43200 ]; then + if bashio::config.true 'lets_encrypt.accept_terms' && [ $((now - LE_UPDATE)) -ge 43200 ]; then le_renew fi diff --git a/ssh/README.md b/ssh/README.md index a7c13cf..31c35a9 100644 --- a/ssh/README.md +++ b/ssh/README.md @@ -91,4 +91,3 @@ In case you've found an bug, please [open an issue on our GitHub][issue]. [keygen-windows]: https://www.digitalocean.com/community/tutorials/how-to-create-ssh-keys-with-putty-to-connect-to-a-vps [keygen]: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ [reddit]: https://reddit.com/r/homeassistant -[repository]: https://github.com/hassio-addons/repository