mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-05 11:32:45 +00:00
Fix issue with similar domain names causing an error in selecting the proper root domain to add challenge records in
This commit is contained in:
parent
0da839cce3
commit
5cbd01b04b
@ -157,7 +157,7 @@ _get_root() {
|
|||||||
|
|
||||||
# iterate over names (a.b.c.d -> b.c.d -> c.d -> d)
|
# iterate over names (a.b.c.d -> b.c.d -> c.d -> d)
|
||||||
while true; do
|
while true; do
|
||||||
h=$(printf "%s" "$domain" | cut -d . -f $i-100)
|
h=$(printf "%s." "$domain" | cut -d . -f $i-100 | sed 's/\./\\./g')
|
||||||
_debug "Checking domain: $h"
|
_debug "Checking domain: $h"
|
||||||
if [ -z "$h" ]; then
|
if [ -z "$h" ]; then
|
||||||
_error "invalid domain"
|
_error "invalid domain"
|
||||||
@ -168,7 +168,7 @@ _get_root() {
|
|||||||
aws_rest GET "2013-04-01/hostedzone"
|
aws_rest GET "2013-04-01/hostedzone"
|
||||||
while true; do
|
while true; do
|
||||||
if _contains "$response" "<Name>$h.</Name>"; then
|
if _contains "$response" "<Name>$h.</Name>"; then
|
||||||
hostedzone="$(echo "$response" | tr -d '\n' | sed 's/<HostedZone>/#&/g' | tr '#' '\n' | _egrep_o "<HostedZone><Id>[^<]*<.Id><Name>$h.<.Name>.*<PrivateZone>false<.PrivateZone>.*<.HostedZone>")"
|
hostedzone="$(echo "$response" | tr -d '\n' | sed 's/<HostedZone>/#&/g' | tr '#' '\n' | _egrep_o "<HostedZone><Id>[^<]*<.Id><Name>$h<.Name>.*<PrivateZone>false<.PrivateZone>.*<.HostedZone>")"
|
||||||
_debug hostedzone "$hostedzone"
|
_debug hostedzone "$hostedzone"
|
||||||
if [ "$hostedzone" ]; then
|
if [ "$hostedzone" ]; then
|
||||||
_domain_id=$(printf "%s\n" "$hostedzone" | _egrep_o "<Id>.*<.Id>" | head -n 1 | _egrep_o ">.*<" | tr -d "<>")
|
_domain_id=$(printf "%s\n" "$hostedzone" | _egrep_o "<Id>.*<.Id>" | head -n 1 | _egrep_o ">.*<" | tr -d "<>")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user