Files
addons/duckdns/hooks.sh
Paulus Schoutsen 54b8289e08 DuckDNS: Also generate a certificate with Let's Encrypt (0 config) (#181)
* Initial Let's Encrypt + DuckDNS

* Remove letsencrypt_duckdns

* Add cert generation with lets encrypt to DuckDNS

* Add that you have to accept terms

* Update Dockerfile

* Delete dehydrated.sh

* Update Dockerfile

* Update config.json

* Update run.sh

* Update hooks.sh

* Update run.sh

* Update hooks.sh

* Update run.sh

* Update config.json

* Update hooks.sh

* Update Dockerfile

* Update run.sh

* fix renew timer

* Update run.sh

* fix logic
2017-09-26 17:02:03 +02:00

33 lines
827 B
Bash

#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
DOMAINS=$(jq --raw-output '.domains | join(",")' $CONFIG_PATH)
TOKEN=$(jq --raw-output '.token' $CONFIG_PATH)
CERTFILE=$(jq --raw-output '.lets_encrypt.certfile' $CONFIG_PATH)
KEYFILE=$(jq --raw-output '.lets_encrypt.keyfile' $CONFIG_PATH)
case "$1" in
"deploy_challenge")
curl -s "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&txt=$4"
;;
"clean_challenge")
curl -s "https://www.duckdns.org/update?domains=$DOMAINS&token=$TOKEN&txt=removed&clear=true"
;;
"deploy_cert")
cp -f "$5" "/ssl/$CERTFILE"
cp -f "$3" "/ssl/$KEYFILE"
;;
"unchanged_cert")
;;
"startup_hook")
;;
"exit_hook")
;;
*)
echo Unknown hook "${1}"
exit 0
;;
esac