mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-03-23 17:41:02 +01:00
Merge pull request #11 from germeier/fixpending
fixed logic to check status from our challenge
This commit is contained in:
@@ -144,17 +144,20 @@ sign_domain() {
|
||||
result="$(signed_request "${challenge_uri}" '{"resource": "challenge", "keyAuthorization": "'"${keyauth}"'"}')"
|
||||
|
||||
status="$(printf '%s\n' "${result}" | grep -Eo '"status":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||
if [[ ! "${status}" = "pending" ]] && [[ ! "${status}" = "valid" ]]; then
|
||||
echo " + Challenge is invalid! (${result})"
|
||||
|
||||
# get status until it a result is reached => not pending anymore
|
||||
while [[ "${status}" = "pending" ]]; do
|
||||
sleep 1
|
||||
status="$(_request get "${challenge_uri}" | grep -Eo '"status":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||
done
|
||||
|
||||
if [[ "${status}" = "valid" ]]; then
|
||||
echo " + Challenge is valid!"
|
||||
else
|
||||
echo " + Challenge is invalid! (returned: ${status})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [[ "${status}" = "pending" ]]; do
|
||||
status="$(_request get "${challenge_uri}" | grep -Eo '"status":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo " + Challenge is valid!"
|
||||
done
|
||||
|
||||
# Finally request certificate from the acme-server and store it in cert-${timestamp}.pem and link from cert.pem
|
||||
|
||||
Reference in New Issue
Block a user