mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 23:11:44 +00:00
Fix most-specific zone match
Most specific zone selected by deepest sub-domain (how many '.' in the domain) rather than seemingly irrelevant count of the number of characters within the zone.
This commit is contained in:
parent
0cfeee4ded
commit
98d27c4a6a
@ -134,12 +134,12 @@ _dns_gcloud_find_zone() {
|
|||||||
filter="$filter)"
|
filter="$filter)"
|
||||||
_debug filter "$filter"
|
_debug filter "$filter"
|
||||||
|
|
||||||
# List domains and find the longest match (in case of some levels of delegation)
|
# List domains and find the zone with the deepest sub-domain (in case of some levels of delegation)
|
||||||
if ! match=$(gcloud dns managed-zones list \
|
if ! match=$(gcloud dns managed-zones list \
|
||||||
--format="value(name, dnsName)" \
|
--format="value(name, dnsName)" \
|
||||||
--filter="$filter" \
|
--filter="$filter" \
|
||||||
| while read -r dnsName name; do
|
| while read -r dnsName name; do
|
||||||
printf "%s\t%s\t%s\n" "${#dnsName}" "$dnsName" "$name"
|
printf "%s\t%s\t%s\n" "$(awk -F"." '{print NF-1}' <<< "$name")" "$dnsName" "$name"
|
||||||
done \
|
done \
|
||||||
| sort -n -r | _head_n 1 | cut -f2,3 | grep '^.*'); then
|
| sort -n -r | _head_n 1 | cut -f2,3 | grep '^.*'); then
|
||||||
_err "_dns_gcloud_find_zone: Can't find a matching managed zone! Perhaps wrong project or gcloud credentials?"
|
_err "_dns_gcloud_find_zone: Can't find a matching managed zone! Perhaps wrong project or gcloud credentials?"
|
||||||
|
Loading…
Reference in New Issue
Block a user