mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-10-21 13:31:18 +00:00
dns_pdns: probe zones with the server-side name filter in _get_root
The unfiltered GET /zones lists every zone on the server; with large installations (100k zones) root-zone detection took minutes per domain. Probe each walk-up candidate with ?zone=<name> instead (exact match per the PowerDNS API docs); servers that ignore the parameter return the full list, which the existing check still handles. https://github.com/acmesh-official/acme.sh/issues/6382
This commit is contained in:
1 parent
a49f8c1992
commit
e94631de44
1 file changed
+13
-9
+13
-9
@@ -189,19 +189,23 @@ _get_root() {
|
|||||||
domain=$1
|
domain=$1
|
||||||
i=1
|
i=1
|
||||||
|
|
||||||
if _pdns_rest "GET" "/api/v1/servers/$PDNS_ServerId/zones"; then
|
|
||||||
_zones_response=$(echo "$response" | _normalizeJson)
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
h=$(printf "%s" "$domain" | cut -d . -f "$i"-100)
|
h=$(printf "%s" "$domain" | cut -d . -f "$i"-100)
|
||||||
|
|
||||||
if _contains "$_zones_response" "\"name\":\"$h.\""; then
|
# Probe each candidate zone with the server-side name filter instead of
|
||||||
_domain="$h."
|
# listing every zone: with large installations (100k zones) the
|
||||||
if [ -z "$h" ]; then
|
# unfiltered list takes minutes. Servers that ignore the parameter
|
||||||
_domain="=2E"
|
# return the full list, which the check below still handles.
|
||||||
|
# https://doc.powerdns.com/authoritative/http-api/zone.html
|
||||||
|
if _pdns_rest "GET" "/api/v1/servers/$PDNS_ServerId/zones?zone=$h."; then
|
||||||
|
_zones_response=$(echo "$response" | _normalizeJson)
|
||||||
|
if _contains "$_zones_response" "\"name\":\"$h.\""; then
|
||||||
|
_domain="$h."
|
||||||
|
if [ -z "$h" ]; then
|
||||||
|
_domain="=2E"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$h" ]; then
|
if [ -z "$h" ]; then
|
||||||
|
|||||||