mirror of
				https://github.com/hiskang/acme.sh
				synced 2025-10-31 02:17:18 +00:00 
			
		
		
		
	Merge pull request #1448 from martgras/patch-3
dns_azure add support for validation record at domain apex
This commit is contained in:
		
						commit
						6d5874fc45
					
				| @ -76,10 +76,10 @@ dns_azure_add() { | |||||||
|   values="{\"value\":[\"$txtvalue\"]}" |   values="{\"value\":[\"$txtvalue\"]}" | ||||||
|   timestamp="$(_time)" |   timestamp="$(_time)" | ||||||
|   if [ "$_code" = "200" ]; then |   if [ "$_code" = "200" ]; then | ||||||
|     vlist="$(echo "$response" | _egrep_o "\"value\"\s*:\s*\[\s*\"[^\"]*\"\s*]" | cut -d : -f 2 | tr -d "[]\"")" |     vlist="$(echo "$response" | _egrep_o "\"value\"\\s*:\\s*\\[\\s*\"[^\"]*\"\\s*]" | cut -d : -f 2 | tr -d "[]\"")" | ||||||
|     _debug "existing TXT found" |     _debug "existing TXT found" | ||||||
|     _debug "$vlist" |     _debug "$vlist" | ||||||
|     existingts="$(echo "$response" | _egrep_o "\"acmetscheck\"\s*:\s*\"[^\"]*\"" | _head_n 1 | cut -d : -f 2 | tr -d "\"")" |     existingts="$(echo "$response" | _egrep_o "\"acmetscheck\"\\s*:\\s*\"[^\"]*\"" | _head_n 1 | cut -d : -f 2 | tr -d "\"")" | ||||||
|     if [ -z "$existingts" ]; then |     if [ -z "$existingts" ]; then | ||||||
|       # the record was not created by acme.sh. Copy the exisiting entires |       # the record was not created by acme.sh. Copy the exisiting entires | ||||||
|       existingts=$timestamp |       existingts=$timestamp | ||||||
| @ -172,7 +172,7 @@ dns_azure_rm() { | |||||||
|   _azure_rest GET "$acmeRecordURI" "" "$accesstoken" |   _azure_rest GET "$acmeRecordURI" "" "$accesstoken" | ||||||
|   timestamp="$(_time)" |   timestamp="$(_time)" | ||||||
|   if [ "$_code" = "200" ]; then |   if [ "$_code" = "200" ]; then | ||||||
|     vlist="$(echo "$response" | _egrep_o "\"value\"\s*:\s*\[\s*\"[^\"]*\"\s*]" | cut -d : -f 2 | tr -d "[]\"" | grep -v "$txtvalue")" |     vlist="$(echo "$response" | _egrep_o "\"value\"\\s*:\\s*\\[\\s*\"[^\"]*\"\\s*]" | cut -d : -f 2 | tr -d "[]\"" | grep -v "$txtvalue")" | ||||||
|     values="" |     values="" | ||||||
|     comma="" |     comma="" | ||||||
|     for v in $vlist; do |     for v in $vlist; do | ||||||
| @ -230,7 +230,7 @@ _azure_rest() { | |||||||
|     fi |     fi | ||||||
|     _ret="$?" |     _ret="$?" | ||||||
|     _secure_debug2 "response $response" |     _secure_debug2 "response $response" | ||||||
|     _code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\r\n")" |     _code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\\r\\n")" | ||||||
|     _debug "http response code $_code" |     _debug "http response code $_code" | ||||||
|     if [ "$_code" = "401" ]; then |     if [ "$_code" = "401" ]; then | ||||||
|       # we have an invalid access token set to expired |       # we have an invalid access token set to expired | ||||||
| @ -308,7 +308,7 @@ _get_root() { | |||||||
|   domain=$1 |   domain=$1 | ||||||
|   subscriptionId=$2 |   subscriptionId=$2 | ||||||
|   accesstoken=$3 |   accesstoken=$3 | ||||||
|   i=2 |   i=1 | ||||||
|   p=1 |   p=1 | ||||||
| 
 | 
 | ||||||
|   ## Ref: https://docs.microsoft.com/en-us/rest/api/dns/zones/list |   ## Ref: https://docs.microsoft.com/en-us/rest/api/dns/zones/list | ||||||
| @ -328,9 +328,14 @@ _get_root() { | |||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|     if _contains "$response" "\"name\":\"$h\"" >/dev/null; then |     if _contains "$response" "\"name\":\"$h\"" >/dev/null; then | ||||||
|       _domain_id=$(echo "$response" | _egrep_o "\{\"id\":\"[^\"]*$h\"" | head -n 1 | cut -d : -f 2 | tr -d \") |       _domain_id=$(echo "$response" | _egrep_o "\\{\"id\":\"[^\"]*$h\"" | head -n 1 | cut -d : -f 2 | tr -d \") | ||||||
|       if [ "$_domain_id" ]; then |       if [ "$_domain_id" ]; then | ||||||
|         _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p) |         if [ "$i" = 1 ]; then | ||||||
|  |           #create the record at the domain apex (@) if only the domain name was provided as --domain-alias | ||||||
|  |           _sub_domain="@" | ||||||
|  |         else | ||||||
|  |           _sub_domain=$(echo "$domain" | cut -d . -f 1-$p) | ||||||
|  |         fi | ||||||
|         _domain=$h |         _domain=$h | ||||||
|         return 0 |         return 0 | ||||||
|       fi |       fi | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user