-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
'nsupdate' without further options can run only on the DNS directly. Update accesses from external networks are refused generally.
The following adaptions in the function 'domain_dns_challenge()' allow the 'DNS challenge' on an external DNS server:
# SDuesterhaupt: 2019-12-19 - 'nsupdate' without further options can run only on the DNS directly
# External accesses are refused generally.
#
# Additional options: File with TSIG key (DNS_TSIG)
# DNS server (DNS_SERVER)
# Zone which shall be updated (DNS_ZONE)
#printf 'update %s _acme-challenge.%s. 300 IN TXT "%s"\n\n' "$1" "$DOMAIN" "$DNS_CHALLENGE" |
#nsupdate || die "Could not $1 $CHALLENGE_TYPE type challenge token with value $DNS_CHALLENGE for domain $DOMAIN via nsupdate"
MyDNSChallengeContent="server $DNS_SERVER"
#MyDNSChallengeContent="$MyDNSChallengeContent\ndebug yes"
MyDNSChallengeContent="$MyDNSChallengeContent\nzone $DNS_ZONE."
MyDNSChallengeContent="$MyDNSChallengeContent\nupdate $1 _acme-challenge.$DOMAIN. 300 IN TXT $DNS_CHALLENGE"
#MyDNSChallengeContent="$MyDNSChallengeContent\nshow"
MyDNSChallengeContent="$MyDNSChallengeContent\nsend\n\n"
#echo -e "$MyDNSChallengeContent" > nsupdate.txt
#nsupdate -k "$DNS_TSIG" -v nsupdate.txt || die "Could not $1 $CHALLENGE_TYPE type challenge token with value $DNS_CHALLENGE for domain $DOMAIN via nsupdate"
echo -e "$MyDNSChallengeContent" | nsupdate -k "$DNS_TSIG" || die "Could not $1 $CHALLENGE_TYPE type challenge token with value $DNS_CHALLENGE for domain $DOMAIN via nsupdate"
Additionally the following options have to be considered:
dns-server|d)
DNS_SERVER="$OPTARG"
;;
dns-tsig|t)
DNS_TSIG="$OPTARG"
;;
dns-zone|z)
DNS_ZONE="$OPTARG"
;;
Call sequence:
# Wildcard certificate, call with options
./letsencrypt_v2.sh sign -l dns-01 -d root-dns.example365.com -t tsig.key -z exampleABC.com -a letsencrypt_account.key -k abc.exampleABC.com.key.pem -w /var/www/default/.well-known/acme-challenge -c ./tmp/abc.exampleABC.com.cert.pem abc.exampleABC.com *.abc.exampleABC.com