|
@ -35,7 +35,7 @@ dns_curanet_add() { |
|
|
gettoken |
|
|
gettoken |
|
|
|
|
|
|
|
|
_get_root "$fulldomain" |
|
|
_get_root "$fulldomain" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export _H1="Content-Type: application/json-patch+json" |
|
|
export _H1="Content-Type: application/json-patch+json" |
|
|
export _H2="Accept: application/json" |
|
|
export _H2="Accept: application/json" |
|
|
export _H3="Authorization: Bearer $CURANET_ACCESS_TOKEN" |
|
|
export _H3="Authorization: Bearer $CURANET_ACCESS_TOKEN" |
|
@ -43,7 +43,7 @@ dns_curanet_add() { |
|
|
response="$(_post "$data" "$CURANET_REST_URL/${_domain}/Records" "" "")" |
|
|
response="$(_post "$data" "$CURANET_REST_URL/${_domain}/Records" "" "")" |
|
|
|
|
|
|
|
|
if _contains "$response" "$txtvalue"; then |
|
|
if _contains "$response" "$txtvalue"; then |
|
|
_debug "TXT record added OK" |
|
|
|
|
|
|
|
|
_debug "TXT record added OK" |
|
|
else |
|
|
else |
|
|
_err "Unable to add TXT record" |
|
|
_err "Unable to add TXT record" |
|
|
return 1 |
|
|
return 1 |
|
@ -60,14 +60,14 @@ dns_curanet_rm() { |
|
|
_info "Using curanet" |
|
|
_info "Using curanet" |
|
|
_debug fulldomain "$fulldomain" |
|
|
_debug fulldomain "$fulldomain" |
|
|
_debug txtvalue "$txtvalue" |
|
|
_debug txtvalue "$txtvalue" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURANET_AUTHCLIENTID="${CURANET_AUTHCLIENTID:-$(_readaccountconf_mutable CURANET_AUTHCLIENTID)}" |
|
|
CURANET_AUTHCLIENTID="${CURANET_AUTHCLIENTID:-$(_readaccountconf_mutable CURANET_AUTHCLIENTID)}" |
|
|
CURANET_AUTHSECRET="${CURANET_AUTHSECRET:-$(_readaccountconf_mutable CURANET_AUTHSECRET)}" |
|
|
CURANET_AUTHSECRET="${CURANET_AUTHSECRET:-$(_readaccountconf_mutable CURANET_AUTHSECRET)}" |
|
|
|
|
|
|
|
|
gettoken |
|
|
gettoken |
|
|
|
|
|
|
|
|
_get_root "$fulldomain" |
|
|
_get_root "$fulldomain" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_debug "Getting current record list to identify TXT to delete" |
|
|
_debug "Getting current record list to identify TXT to delete" |
|
|
|
|
|
|
|
|
export _H1="Content-Type: application/json" |
|
|
export _H1="Content-Type: application/json" |
|
@ -88,25 +88,19 @@ dns_curanet_rm() { |
|
|
response="$(_post "" "$CURANET_REST_URL/${_domain}/Records/$recordid" "" "DELETE")" |
|
|
response="$(_post "" "$CURANET_REST_URL/${_domain}/Records/$recordid" "" "DELETE")" |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#################### Private functions below ################################## |
|
|
#################### Private functions below ################################## |
|
|
|
|
|
|
|
|
gettoken() { |
|
|
gettoken() { |
|
|
|
|
|
|
|
|
response="$(_post "grant_type=client_credentials&client_id=$CURANET_AUTHCLIENTID&client_secret=$CURANET_AUTHSECRET&scope=dns" "$CURANET_AUTH_URL" "" "")" |
|
|
response="$(_post "grant_type=client_credentials&client_id=$CURANET_AUTHCLIENTID&client_secret=$CURANET_AUTHSECRET&scope=dns" "$CURANET_AUTH_URL" "" "")" |
|
|
|
|
|
|
|
|
if ! _contains "$response" "access_token"; then |
|
|
if ! _contains "$response" "access_token"; then |
|
|
_err "Unable get access token" |
|
|
_err "Unable get access token" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
CURANET_ACCESS_TOKEN=$(echo "$response" | _egrep_o "\"access_token\":\"[^\"]+" | cut -c 17-) |
|
|
CURANET_ACCESS_TOKEN=$(echo "$response" | _egrep_o "\"access_token\":\"[^\"]+" | cut -c 17-) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#_acme-challenge.www.domain.com |
|
|
#_acme-challenge.www.domain.com |
|
|
#returns |
|
|
#returns |
|
|
# _domain=domain.com |
|
|
# _domain=domain.com |
|
@ -132,9 +126,8 @@ _get_root() { |
|
|
_domain=$h |
|
|
_domain=$h |
|
|
return 0 |
|
|
return 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i=$(_math "$i" + 1) |
|
|
i=$(_math "$i" + 1) |
|
|
done |
|
|
done |
|
|
return 1 |
|
|
return 1 |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |