mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-31 22:23:12 +02:00
parse challenges json differently to be compatible with bsd sed
This commit is contained in:
@@ -140,8 +140,10 @@ sign_domain() {
|
||||
echo " + Requesting challenge for ${altname}..."
|
||||
response="$(signed_request "${CA}/acme/new-authz" '{"resource": "new-authz", "identifier": {"type": "dns", "value": "'"${altname}"'"}}')"
|
||||
|
||||
challenge_token="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]' | sed 's/{/\n{/g' | grep 'http-01' | grep -Eo '"token":\s*"[^"]*"' | cut -d'"' -f4 | sed 's/[^A-Za-z0-9_\-]/_/g')"
|
||||
challenge_uri="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]' | sed 's/{/\n{/g' | grep 'http-01' | grep -Eo '"uri":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||
challenges="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]')"
|
||||
challenge="$(printf "%s" "${challenges//\{/$'\n'{}" | grep 'http-01')"
|
||||
challenge_token="$(printf '%s' "${challenge}" | grep -Eo '"token":\s*"[^"]*"' | cut -d'"' -f4 | sed 's/[^A-Za-z0-9_\-]/_/g')"
|
||||
challenge_uri="$(printf '%s' "${challenge}" | grep -Eo '"uri":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||
|
||||
if [[ -z "${challenge_token}" ]] || [[ -z "${challenge_uri}" ]]; then
|
||||
echo " + Error: Can't retrieve challenges (${response})"
|
||||
|
||||
Reference in New Issue
Block a user