diff --git a/example-dns-01-nsupdate-script.md b/example-dns-01-nsupdate-script.md index 40cd638..bfe9975 100644 --- a/example-dns-01-nsupdate-script.md +++ b/example-dns-01-nsupdate-script.md @@ -14,30 +14,24 @@ This hook script uses the nsupdate utility from the bind package to solve dns-01 set -e set -u set -o pipefail -umask 077 NSUPDATE="nsupdate -k /path/to/Kdnsupdatekey.private" -done="no" -if [[ "$1" = "deploy_challenge" ]]; then - printf "update add _acme-challenge.%s. 300 in TXT \"%s\"\n\n" "${2}" "${4}" | $NSUPDATE - done="yes" -fi - -if [[ "$1" = "clean_challenge" ]]; then - printf "update delete _acme-challenge.%s. 300 in TXT \"%s\"\n\n" "${2}" "${4}" | $NSUPDATE - done="yes" -fi - -if [[ "${1}" = "deploy_cert" ]]; then - # do nothing for now - done="yes" -fi - -if [[ ! "${done}" = "yes" ]]; then - echo Unkown hook "${1}" - exit 1 -fi +case "$1" in + "deploy_challenge") + printf "update add _acme-challenge.%s. 300 in TXT \"%s\"\n\n" "${2}" "${4}" | $NSUPDATE + ;; + "clean_challenge") + printf "update delete _acme-challenge.%s. 300 in TXT \"%s\"\n\n" "${2}" "${4}" | $NSUPDATE + ;; + "deploy_cert") + # do nothing for now + ;; + *) + echo Unkown hook "${1}" + exit 1 + ;; +esac exit 0 ``` \ No newline at end of file