Dns Challenge prefix removed. SELFHOSTDNS_MAP entries must be fullpath incl. prefix

This commit is contained in:
AlvinSchiller 2022-08-21 14:29:16 +02:00
parent 1584971908
commit 734c9a1aa5

View File

@ -4,8 +4,6 @@
# Report Bugs here: https://github.com/Marvo2011/acme.sh/issues/1 # Report Bugs here: https://github.com/Marvo2011/acme.sh/issues/1
# Last Edit: 17.02.2022 # Last Edit: 17.02.2022
DNS_CHALLENGE_PREFIX_ESCAPED="_acme-challenge\."
dns_selfhost_add() { dns_selfhost_add() {
fulldomain=$1 fulldomain=$1
txt=$2 txt=$2
@ -33,16 +31,12 @@ dns_selfhost_add() {
SELFHOSTDNS_LAST_SLOT=1 SELFHOSTDNS_LAST_SLOT=1
fi fi
# cut DNS_CHALLENGE_PREFIX_ESCAPED from fulldomain if present at the beginning of the string # get the RID for fulldomain from SELFHOSTDNS_MAP
lookupdomain=$(echo "$fulldomain" | sed "s/^$DNS_CHALLENGE_PREFIX_ESCAPED//")
_debug lookupdomain "$lookupdomain"
# get the RID for lookupdomain or fulldomain from SELFHOSTDNS_MAP
# only match full domains (at the beginning of the string or with a leading whitespace), # only match full domains (at the beginning of the string or with a leading whitespace),
# e.g. don't match mytest.example.com or sub.test.example.com for test.example.com # e.g. don't match mytest.example.com or sub.test.example.com for test.example.com
# replace the whole string with the RID (matching group 3) for assignment # replace the whole string with the RID (matching group 3) for assignment
# if the domain is defined multiple times only the last occurance will be matched # if the domain is defined multiple times only the last occurance will be matched
rid=$(echo "$SELFHOSTDNS_MAP" | sed -E "s/(^|^.*[[:space:]])($lookupdomain:|$fulldomain:)([0-9][0-9]*)(.*)/\3/") rid=$(echo "$SELFHOSTDNS_MAP" | sed -E "s/(^|^.*[[:space:]])($fulldomain:)([0-9][0-9]*)(.*)/\3/")
if test -z "$rid"; then if test -z "$rid"; then
if [ $SELFHOSTDNS_LAST_SLOT = "2" ]; then if [ $SELFHOSTDNS_LAST_SLOT = "2" ]; then