From d3c9d0b331b2c49327e5a4c6d3d54839e69aecd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 26 Jul 2018 19:59:15 +0200 Subject: [PATCH 1/4] Fix inwx account without Mobile TAN --- dnsapi/dns_inwx.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dnsapi/dns_inwx.sh b/dnsapi/dns_inwx.sh index cd5af91b..f4590cf8 100755 --- a/dnsapi/dns_inwx.sh +++ b/dnsapi/dns_inwx.sh @@ -158,7 +158,8 @@ _inwx_login() { export _H1 #https://github.com/inwx/php-client/blob/master/INWX/Domrobot.php#L71 - if _contains "$response" "tfa"; then + if _contains "$response" "code1000" \ + && _contains "$response" "tfaGOOGLE-AUTH"; then if [ -z "$INWX_Shared_Secret" ]; then _err "Mobile TAN detected." _err "Please define a shared secret." From e697c663dfc5fd03dfbe4e00eeefd34f5f62c36e Mon Sep 17 00:00:00 2001 From: Marco Spinosa Date: Tue, 21 Aug 2018 13:29:12 +0200 Subject: [PATCH 2/4] Dockerfile updated to install bind-tools (nsupdate). Added the possibility to specify a zone through NSUPDATE_ZONE variables when using dns_nsupdate.sh --- Dockerfile | 1 + dnsapi/dns_nsupdate.sh | 46 +++++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a64c720..84fc658f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN apk update -f \ coreutils \ curl \ socat \ + bind-tools \ && rm -rf /var/cache/apk/* ENV LE_CONFIG_HOME /acme.sh diff --git a/dnsapi/dns_nsupdate.sh b/dnsapi/dns_nsupdate.sh index 555f4d29..d8086b37 100755 --- a/dnsapi/dns_nsupdate.sh +++ b/dnsapi/dns_nsupdate.sh @@ -1,6 +1,9 @@ #!/usr/bin/env sh ######## Public functions ##################### +ECHO=$(command -v echo) +NSUPDATE=$(command -v nsupdate) +NSUPDATE_COMMANDS_FILE="/tmp/nsupdate" #Usage: dns_nsupdate_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" dns_nsupdate_add() { @@ -13,17 +16,26 @@ dns_nsupdate_add() { _saveaccountconf NSUPDATE_SERVER "${NSUPDATE_SERVER}" _saveaccountconf NSUPDATE_SERVER_PORT "${NSUPDATE_SERVER_PORT}" _saveaccountconf NSUPDATE_KEY "${NSUPDATE_KEY}" + if ! [ -z "$NSUPDATE_ZONE" ]; then + _saveaccountconf NSUPDATE_ZONE "${NSUPDATE_ZONE}" + fi _info "adding ${fulldomain}. 60 in txt \"${txtvalue}\"" - nsupdate -k "${NSUPDATE_KEY}" < ${NSUPDATE_COMMANDS_FILE} + if ! [ -z "$NSUPDATE_ZONE" ]; then + $ECHO "zone ${NSUPDATE_ZONE}" >> ${NSUPDATE_COMMANDS_FILE} + fi + $ECHO "update add ${fulldomain}. 60 in txt \"${txtvalue}\"" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "send" >> ${NSUPDATE_COMMANDS_FILE} + + _debug "$(cat ${NSUPDATE_COMMANDS_FILE})" + + if ! $NSUPDATE -k "${NSUPDATE_KEY}" -v ${NSUPDATE_COMMANDS_FILE}; then _err "error updating domain" + rm ${NSUPDATE_COMMANDS_FILE} return 1 fi - + rm ${NSUPDATE_COMMANDS_FILE} return 0 } @@ -34,16 +46,22 @@ dns_nsupdate_rm() { [ -n "${NSUPDATE_SERVER}" ] || NSUPDATE_SERVER="localhost" [ -n "${NSUPDATE_SERVER_PORT}" ] || NSUPDATE_SERVER_PORT=53 _info "removing ${fulldomain}. txt" - nsupdate -k "${NSUPDATE_KEY}" < ${NSUPDATE_COMMANDS_FILE} + if ! [ -z "$NSUPDATE_ZONE" ]; then + $ECHO "zone ${NSUPDATE_ZONE}" >> ${NSUPDATE_COMMANDS_FILE} + fi + $ECHO "update delete ${fulldomain}. txt" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "send" >> ${NSUPDATE_COMMANDS_FILE} + + _debug "$(cat ${NSUPDATE_COMMANDS_FILE})" + + if ! $NSUPDATE -k "${NSUPDATE_KEY}" -v ${NSUPDATE_COMMANDS_FILE}; then _err "error updating domain" + rm ${NSUPDATE_COMMANDS_FILE} return 1 fi - + rm ${NSUPDATE_COMMANDS_FILE} return 0 } From 62e6fd258be10aef818ae916a89c7db9db61bde0 Mon Sep 17 00:00:00 2001 From: Marco Spinosa Date: Tue, 21 Aug 2018 15:41:59 +0200 Subject: [PATCH 3/4] Dockerfile updated to install bind-tools (nsupdate). Added the possibility to specify a zone through NSUPDATE_ZONE variables when using dns_nsupdate.sh --- dnsapi/dns_nsupdate.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dnsapi/dns_nsupdate.sh b/dnsapi/dns_nsupdate.sh index d8086b37..acf03711 100755 --- a/dnsapi/dns_nsupdate.sh +++ b/dnsapi/dns_nsupdate.sh @@ -21,12 +21,12 @@ dns_nsupdate_add() { fi _info "adding ${fulldomain}. 60 in txt \"${txtvalue}\"" - $ECHO "server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}" > ${NSUPDATE_COMMANDS_FILE} + $ECHO "server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}" >${NSUPDATE_COMMANDS_FILE} if ! [ -z "$NSUPDATE_ZONE" ]; then - $ECHO "zone ${NSUPDATE_ZONE}" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "zone ${NSUPDATE_ZONE}" >>${NSUPDATE_COMMANDS_FILE} fi - $ECHO "update add ${fulldomain}. 60 in txt \"${txtvalue}\"" >> ${NSUPDATE_COMMANDS_FILE} - $ECHO "send" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "update add ${fulldomain}. 60 in txt \"${txtvalue}\"" >>${NSUPDATE_COMMANDS_FILE} + $ECHO "send" >>${NSUPDATE_COMMANDS_FILE} _debug "$(cat ${NSUPDATE_COMMANDS_FILE})" @@ -47,12 +47,12 @@ dns_nsupdate_rm() { [ -n "${NSUPDATE_SERVER_PORT}" ] || NSUPDATE_SERVER_PORT=53 _info "removing ${fulldomain}. txt" - $ECHO "server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}" > ${NSUPDATE_COMMANDS_FILE} + $ECHO "server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}" >${NSUPDATE_COMMANDS_FILE} if ! [ -z "$NSUPDATE_ZONE" ]; then - $ECHO "zone ${NSUPDATE_ZONE}" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "zone ${NSUPDATE_ZONE}" >>${NSUPDATE_COMMANDS_FILE} fi - $ECHO "update delete ${fulldomain}. txt" >> ${NSUPDATE_COMMANDS_FILE} - $ECHO "send" >> ${NSUPDATE_COMMANDS_FILE} + $ECHO "update delete ${fulldomain}. txt" >>${NSUPDATE_COMMANDS_FILE} + $ECHO "send" >>${NSUPDATE_COMMANDS_FILE} _debug "$(cat ${NSUPDATE_COMMANDS_FILE})" From 36041aac4e896565f0a834904d381ded487b593d Mon Sep 17 00:00:00 2001 From: Marco Spinosa Date: Tue, 21 Aug 2018 15:57:04 +0200 Subject: [PATCH 4/4] Dockerfile updated to install bind-tools (nsupdate). Added the possibility to specify a zone through NSUPDATE_ZONE variables when using dns_nsupdate.sh --- dnsapi/dns_nsupdate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnsapi/dns_nsupdate.sh b/dnsapi/dns_nsupdate.sh index acf03711..4437ab9b 100755 --- a/dnsapi/dns_nsupdate.sh +++ b/dnsapi/dns_nsupdate.sh @@ -27,7 +27,7 @@ dns_nsupdate_add() { fi $ECHO "update add ${fulldomain}. 60 in txt \"${txtvalue}\"" >>${NSUPDATE_COMMANDS_FILE} $ECHO "send" >>${NSUPDATE_COMMANDS_FILE} - + _debug "$(cat ${NSUPDATE_COMMANDS_FILE})" if ! $NSUPDATE -k "${NSUPDATE_KEY}" -v ${NSUPDATE_COMMANDS_FILE}; then @@ -46,7 +46,7 @@ dns_nsupdate_rm() { [ -n "${NSUPDATE_SERVER}" ] || NSUPDATE_SERVER="localhost" [ -n "${NSUPDATE_SERVER_PORT}" ] || NSUPDATE_SERVER_PORT=53 _info "removing ${fulldomain}. txt" - + $ECHO "server ${NSUPDATE_SERVER} ${NSUPDATE_SERVER_PORT}" >${NSUPDATE_COMMANDS_FILE} if ! [ -z "$NSUPDATE_ZONE" ]; then $ECHO "zone ${NSUPDATE_ZONE}" >>${NSUPDATE_COMMANDS_FILE}