mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-17 22:19:40 +02:00
use curl -sSf to display error messages on failure
This commit is contained in:
@@ -14,7 +14,8 @@ hex2bin() {
|
|||||||
signed_request() {
|
signed_request() {
|
||||||
payload64="$(printf '%s' "${2}" | urlbase64)"
|
payload64="$(printf '%s' "${2}" | urlbase64)"
|
||||||
|
|
||||||
nonce="$(curl -s -I "${CA}"/directory | grep Replay-Nonce | awk -F ': ' '{print $2}' | tr -d '\n\r')"
|
# -sSf: stay silent but report errors and exit with != 0 if they occur
|
||||||
|
nonce="$(curl -sSf -I "${CA}"/directory | grep Replay-Nonce: | awk -F ': ' '{print $2}' | tr -d '\n\r')"
|
||||||
|
|
||||||
header='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}}'
|
header='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}}'
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ signed_request() {
|
|||||||
|
|
||||||
data='{"header": '"${header}"', "protected": "'"${protected64}"'", "payload": "'"${payload64}"'", "signature": "'"${signed64}"'"}'
|
data='{"header": '"${header}"', "protected": "'"${protected64}"'", "payload": "'"${payload64}"'", "signature": "'"${signed64}"'"}'
|
||||||
|
|
||||||
curl -s -d "${data}" "${1}"
|
curl -sSf -d "${data}" "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
sign_domain() {
|
sign_domain() {
|
||||||
@@ -74,7 +75,7 @@ sign_domain() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "${status}" = "valid" ]; do
|
while [ ! "${status}" = "valid" ]; do
|
||||||
status="$(curl -s "${challenge_uri}" | grep -Eo '"status":\s*"[^"]*"' | cut -d'"' -f4)"
|
status="$(curl -sSf "${challenge_uri}" | grep -Eo '"status":\s*"[^"]*"' | cut -d'"' -f4)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo " + Challenge is valid!"
|
echo " + Challenge is valid!"
|
||||||
|
|||||||
Reference in New Issue
Block a user