|
@ -25,7 +25,7 @@ dns_azure_add() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_TENANTID" ] ; then |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_TENANTID" ]; then |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_APPID="" |
|
|
AZUREDNS_APPID="" |
|
@ -34,7 +34,7 @@ dns_azure_add() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_APPID" ] ; then |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_APPID" ]; then |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_APPID="" |
|
|
AZUREDNS_APPID="" |
|
@ -67,7 +67,7 @@ dns_azure_add() { |
|
|
_debug _sub_domain "$_sub_domain" |
|
|
_debug _sub_domain "$_sub_domain" |
|
|
_debug _domain "$_domain" |
|
|
_debug _domain "$_domain" |
|
|
|
|
|
|
|
|
acmeRecordURI="https://management.azure.com$(printf '%s' "$_domain_id" |sed 's/\\//g')/TXT/$_sub_domain?api-version=2017-09-01" |
|
|
|
|
|
|
|
|
acmeRecordURI="https://management.azure.com$(printf '%s' "$_domain_id" | sed 's/\\//g')/TXT/$_sub_domain?api-version=2017-09-01" |
|
|
_debug "$acmeRecordURI" |
|
|
_debug "$acmeRecordURI" |
|
|
body="{\"properties\": {\"TTL\": 3600, \"TXTRecords\": [{\"value\": [\"$txtvalue\"]}]}}" |
|
|
body="{\"properties\": {\"TTL\": 3600, \"TXTRecords\": [{\"value\": [\"$txtvalue\"]}]}}" |
|
|
_azure_rest PUT "$acmeRecordURI" "$body" "$accesstoken" |
|
|
_azure_rest PUT "$acmeRecordURI" "$body" "$accesstoken" |
|
@ -102,7 +102,7 @@ dns_azure_rm() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_TENANTID" ] ; then |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_TENANTID" ]; then |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_APPID="" |
|
|
AZUREDNS_APPID="" |
|
@ -111,7 +111,7 @@ dns_azure_rm() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_APPID" ] ;then |
|
|
|
|
|
|
|
|
if [ -z "$AZUREDNS_APPID" ];then |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_SUBSCRIPTIONID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_TENANTID="" |
|
|
AZUREDNS_APPID="" |
|
|
AZUREDNS_APPID="" |
|
@ -139,7 +139,7 @@ dns_azure_rm() { |
|
|
_debug _sub_domain "$_sub_domain" |
|
|
_debug _sub_domain "$_sub_domain" |
|
|
_debug _domain "$_domain" |
|
|
_debug _domain "$_domain" |
|
|
|
|
|
|
|
|
acmeRecordURI="https://management.azure.com$(printf '%s' "$_domain_id" |sed 's/\\//g')/TXT/$_sub_domain?api-version=2017-09-01" |
|
|
|
|
|
|
|
|
acmeRecordURI="https://management.azure.com$(printf '%s' "$_domain_id" | sed 's/\\//g')/TXT/$_sub_domain?api-version=2017-09-01" |
|
|
_debug "$acmeRecordURI" |
|
|
_debug "$acmeRecordURI" |
|
|
body="{\"properties\": {\"TTL\": 3600, \"TXTRecords\": [{\"value\": [\"$txtvalue\"]}]}}" |
|
|
body="{\"properties\": {\"TTL\": 3600, \"TXTRecords\": [{\"value\": [\"$txtvalue\"]}]}}" |
|
|
_azure_rest DELETE "$acmeRecordURI" "" "$accesstoken" |
|
|
_azure_rest DELETE "$acmeRecordURI" "" "$accesstoken" |
|
@ -191,13 +191,13 @@ _azure_getaccess_token() { |
|
|
export _H1="accept: application/json" |
|
|
export _H1="accept: application/json" |
|
|
export _H2="Content-Type: application/x-www-form-urlencoded" |
|
|
export _H2="Content-Type: application/x-www-form-urlencoded" |
|
|
|
|
|
|
|
|
body="resource=$(printf "%s" 'https://management.core.windows.net/'| _url_encode)&client_id=$(printf "%s" "$clientID" | _url_encode)&client_secret=$(printf "%s" "$clientSecret"| _url_encode)&grant_type=client_credentials" |
|
|
|
|
|
|
|
|
body="resource=$(printf "%s" 'https://management.core.windows.net/' | _url_encode)&client_id=$(printf "%s" "$clientID" | _url_encode)&client_secret=$(printf "%s" "$clientSecret" | _url_encode)&grant_type=client_credentials" |
|
|
_debug data "$body" |
|
|
_debug data "$body" |
|
|
response="$(_post "$body" "https://login.windows.net/$TENANTID/oauth2/token" "" "POST" )" |
|
|
|
|
|
accesstoken=$(echo "$response" | _egrep_o "\"access_token\":\"[^\"]*\"" | head -n 1 | cut -d : -f 2 | tr -d \") |
|
|
|
|
|
|
|
|
response="$(_post "$body" "https://login.windows.net/$TENANTID/oauth2/token" "" "POST")" |
|
|
|
|
|
accesstoken=$(echo "$response" | _egrep_o "\"access_token\":\"[^\"]*\"" | _head_n 1 | cut -d : -f 2 | tr -d \") |
|
|
_debug2 "response $response" |
|
|
_debug2 "response $response" |
|
|
|
|
|
|
|
|
if [ -z "$accesstoken" ] ; then |
|
|
|
|
|
|
|
|
if [ -z "$accesstoken" ]; then |
|
|
_err "no acccess token received" |
|
|
_err "no acccess token received" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|