#!/usr/bin/env sh # acme.sh DNS-API für Nodebay (DNS-01-Prüfung über den Namen deiner DynDNS-Adresse). # Ablage: cp dns_nodebay.sh ~/.acme.sh/dnsapi/ # Nutzung: export NODEBAY_Host="haus.example.de"; export NODEBAY_Token="SCHLUESSEL" # acme.sh --issue --dns dns_nodebay -d haus.example.de -d '*.haus.example.de' # Zertifikate gibt es für den Namen der Adresse und alles darunter (z. B. www.haus.example.de). dns_nodebay_add() { fulldomain=$1 txtvalue=$2 _nodebay_init || return 1 _nodebay_call add "$fulldomain" "$txtvalue" } dns_nodebay_rm() { fulldomain=$1 txtvalue=$2 _nodebay_init || return 1 _nodebay_call delete "$fulldomain" "$txtvalue" } _nodebay_init() { NODEBAY_Url="${NODEBAY_Url:-$(_readaccountconf_mutable NODEBAY_Url)}" NODEBAY_Host="${NODEBAY_Host:-$(_readaccountconf_mutable NODEBAY_Host)}" NODEBAY_Token="${NODEBAY_Token:-$(_readaccountconf_mutable NODEBAY_Token)}" NODEBAY_Url="${NODEBAY_Url:-https://ddns.nodebay.de}" if [ -z "$NODEBAY_Host" ] || [ -z "$NODEBAY_Token" ]; then _err "NODEBAY_Host (deine DynDNS-Adresse) und NODEBAY_Token (Zugangsschlüssel) fehlen." return 1 fi _saveaccountconf_mutable NODEBAY_Url "$NODEBAY_Url" _saveaccountconf_mutable NODEBAY_Host "$NODEBAY_Host" _saveaccountconf_mutable NODEBAY_Token "$NODEBAY_Token" } _nodebay_call() { action=$1 fulldomain=$2 txtvalue=$3 prefix="${fulldomain%.$NODEBAY_Host}" if [ "$prefix" = "$fulldomain" ]; then _err "$fulldomain liegt nicht unter $NODEBAY_Host." return 1 fi export _H1="Authorization: Basic $(printf '%s:%s' "$NODEBAY_Host" "$NODEBAY_Token" | _base64)" response="$(_get "$NODEBAY_Url/ddns/record?hostname=$NODEBAY_Host&prefix=$prefix&type=TXT&action=$action&value=$txtvalue")" _debug response "$response" case "$response" in good* | nochg*) return 0 ;; esac _err "Nodebay hat die TXT-Aktion '$action' abgelehnt: $response" return 1 }