|
|
|
@ -1747,22 +1747,11 @@ json_get() { # get values from json |
|
|
|
|
|
|
|
obtain_ca_resource_locations() |
|
|
|
{ |
|
|
|
# Obtain CA resource locations |
|
|
|
ca_all_loc=$(curl --user-agent "$CURL_USERAGENT" "${CA}" 2>/dev/null) |
|
|
|
debug "ca_all_loc from ${CA} gives $ca_all_loc" |
|
|
|
# APIv1 |
|
|
|
URL_new_reg=$(echo "$ca_all_loc" | grep "new-reg" | awk -F'"' '{print $4}') |
|
|
|
URL_new_authz=$(echo "$ca_all_loc" | grep "new-authz" | awk -F'"' '{print $4}') |
|
|
|
URL_new_cert=$(echo "$ca_all_loc" | grep "new-cert" | awk -F'"' '{print $4}') |
|
|
|
#API v2 |
|
|
|
URL_newAccount=$(echo "$ca_all_loc" | grep "newAccount" | awk -F'"' '{print $4}') |
|
|
|
URL_newNonce=$(echo "$ca_all_loc" | grep "newNonce" | awk -F'"' '{print $4}') |
|
|
|
URL_newOrder=$(echo "$ca_all_loc" | grep "newOrder" | awk -F'"' '{print $4}') |
|
|
|
URL_revoke=$(echo "$ca_all_loc" | grep "revokeCert" | awk -F'"' '{print $4}') |
|
|
|
|
|
|
|
if [[ -z "$URL_new_reg" ]] && [[ -z "$URL_newAccount" ]]; then |
|
|
|
ca_all_loc=$(curl --user-agent "$CURL_USERAGENT" "${CA}/directory" 2>/dev/null) |
|
|
|
debug "ca_all_loc from ${CA}/directory gives $ca_all_loc" |
|
|
|
for suffix in "" "/directory" "/dir"; |
|
|
|
do |
|
|
|
# Obtain CA resource locations |
|
|
|
ca_all_loc=$(curl --user-agent "$CURL_USERAGENT" "${CA}${suffix}" 2>/dev/null) |
|
|
|
debug "ca_all_loc from ${CA}${suffix} gives $ca_all_loc" |
|
|
|
# APIv1 |
|
|
|
URL_new_reg=$(echo "$ca_all_loc" | grep "new-reg" | awk -F'"' '{print $4}') |
|
|
|
URL_new_authz=$(echo "$ca_all_loc" | grep "new-authz" | awk -F'"' '{print $4}') |
|
|
|
@ -1771,15 +1760,19 @@ obtain_ca_resource_locations() |
|
|
|
URL_newAccount=$(echo "$ca_all_loc" | grep "newAccount" | awk -F'"' '{print $4}') |
|
|
|
URL_newNonce=$(echo "$ca_all_loc" | grep "newNonce" | awk -F'"' '{print $4}') |
|
|
|
URL_newOrder=$(echo "$ca_all_loc" | grep "newOrder" | awk -F'"' '{print $4}') |
|
|
|
fi |
|
|
|
URL_revoke=$(echo "$ca_all_loc" | grep "revokeCert" | awk -F'"' '{print $4}') |
|
|
|
|
|
|
|
if [[ -n "$URL_new_reg" ]] || [[ -n "$URL_newAccount" ]]; then |
|
|
|
break |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
if [[ -n "$URL_new_reg" ]]; then |
|
|
|
API=1 |
|
|
|
elif [[ -n "$URL_newAccount" ]]; then |
|
|
|
API=2 |
|
|
|
else |
|
|
|
info "unknown API version" |
|
|
|
graceful_exit |
|
|
|
error_exit "unknown API version" |
|
|
|
fi |
|
|
|
debug "Using API v$API" |
|
|
|
} |
|
|
|
|