mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-08-13 12:33:30 +02:00
Fix dns_namecheap ignoring IsOurDNS when matching the root zone
_get_root_by_getList() matched the candidate suffix as an unanchored substring of the whole domains.getList response and never looked at the IsOurDNS attribute. A domain parked on Namecheap's webhosting DNS is listed with IsOurDNS="false", yet it was still accepted as the root zone, so _get_root() returned success and the domains.dns.getHosts probe that would have found the real zone never ran. Every following getHosts call was then refused with error 2030288 "not using proper DNS servers" and the challenge failed with "invalid tld". Match the exact <Domain Name="..."> entry instead and require IsOurDNS="true", so a subdomain delegated to Namecheap BasicDNS/FreeDNS under a parent that is not on Namecheap DNS now resolves to its own zone. Matching the entry exactly also drops the old substring/regex match, in which the dots of a domain matched any character. Fixes #7178
This commit is contained in:
parent
9aad4dcbd5
commit
f67be78ff4
1 changed files with 27 additions and 1 deletions
|
|
@ -104,6 +104,9 @@ _get_root_by_getList() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
_namecheap_domain_list=$(echo "$response" | _egrep_o '<Domain [^>]*')
|
||||
_debug2 domain_list "$_namecheap_domain_list"
|
||||
|
||||
i=2
|
||||
p=1
|
||||
|
||||
|
|
@ -120,7 +123,7 @@ _get_root_by_getList() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if ! _contains "$response" "$h"; then
|
||||
if ! _namecheap_is_our_dns "$h"; then
|
||||
_debug "$h not found"
|
||||
else
|
||||
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$p")
|
||||
|
|
@ -133,6 +136,29 @@ _get_root_by_getList() {
|
|||
return 1
|
||||
}
|
||||
|
||||
#Usage: _namecheap_is_our_dns <domain>
|
||||
#Succeeds only when domains.getList listed exactly <domain> AND that entry is
|
||||
#served by Namecheap's own DNS. A domain parked on Namecheap's webhosting DNS
|
||||
#is listed with IsOurDNS="false", and every dns.getHosts/setHosts call against
|
||||
#it is refused with error 2030288 "not using proper DNS servers". Accepting
|
||||
#such a domain as the root zone hides a subdomain that IS delegated to
|
||||
#Namecheap DNS and that the getHosts probe below would have found.
|
||||
#https://github.com/acmesh-official/acme.sh/issues/7178
|
||||
_namecheap_is_our_dns() {
|
||||
_namecheap_entry=$(echo "$_namecheap_domain_list" | grep -F " Name=\"$1\"" | _head_n 1)
|
||||
if [ -z "$_namecheap_entry" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
_namecheap_ourdns=$(echo "$_namecheap_entry" | _egrep_o ' IsOurDNS="[^"]*' | cut -d '"' -f 2)
|
||||
_debug2 "$1 IsOurDNS" "$_namecheap_ourdns"
|
||||
|
||||
if [ "$_namecheap_ourdns" = "true" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
_get_root_by_getHosts() {
|
||||
i=100
|
||||
p=99
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue