From: Lukas Schauer Date: Sat, 5 Dec 2015 02:14:23 +0000 (+0100) Subject: check for errors on token retrieval X-Git-Tag: v0.1.0~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abb956936c29928e867d130289992ea98ce44490;p=thirdparty%2Fdehydrated.git check for errors on token retrieval --- diff --git a/letsencrypt.sh b/letsencrypt.sh index 5137329..bc8e206 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -51,6 +51,11 @@ sign_domain() { challenge_token="$(echo $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="$(echo $response | grep -Eo '"challenges":[^\[]*\[[^]]*]' | sed 's/{/\n{/g' | grep 'http-01' | grep -Eo '"uri":\s*"[^"]*"' | cut -d'"' -f4)" + if [ "${challenge_token}" = "" ] || [ "${challenge_uri}" = "" ]; then + echo " + Error: Can't retrieve challenges (${reqsponse})" + exit 1 + fi + keyauth="${challenge_token}.${thumbprint}" echo -n "${keyauth}" > "${WELLKNOWN}/${challenge_token}"