196196# 2020-01-07 #464 and #486 "json was blank" (change all curl request to use POST-as-GET)
197197# 2020-01-08 Error and exit if rate limited, exit if curl returns nothing
198198# 2020-01-10 Change domain and getssl templates to v2 (2.15)
199+ # 2020-01-17 #473 and #477 Don't use POST-as-GET when sending ready for challenge for ACMEv1 (2.16)
199200# ----------------------------------------------------------------------------------------
200201
201202PROGNAME=${0##*/ }
202- VERSION=" 2.15 "
203+ VERSION=" 2.16 "
203204
204205# defaults
205206ACCOUNT_KEY_LENGTH=4096
@@ -286,14 +287,15 @@ check_challenge_completion() { # checks with the ACME server if our challenge is
286287 keyauthorization=$3
287288
288289 debug " sending request to ACME server saying we're ready for challenge"
289- send_signed_request " $uri " " {}"
290290
291291 # check response from our request to perform challenge
292292 if [[ $API -eq 1 ]]; then
293+ send_signed_request " $uri " " {\" resource\" : \" challenge\" , \" keyAuthorization\" : \" $keyauthorization \" }"
293294 if [[ -n " $code " ]] && [[ ! " $code " == ' 202' ]] ; then
294295 error_exit " $domain :Challenge error: $code "
295296 fi
296297 else # APIv2
298+ send_signed_request " $uri " " {}"
297299 if [[ -n " $code " ]] && [[ ! " $code " == ' 200' ]] ; then
298300 detail=$( echo " $response " | grep " detail" | awk -F\" ' {print $4}' )
299301 error_exit " $domain :Challenge error: $code :Detail: $detail "
@@ -303,7 +305,13 @@ check_challenge_completion() { # checks with the ACME server if our challenge is
303305 # loop "forever" to keep checking for a response from the ACME server.
304306 while true ; do
305307 debug " checking if challenge is complete"
306- send_signed_request " $uri " " "
308+ if [[ $API -eq 1 ]]; then
309+ if ! get_cr " $uri " ; then
310+ error_exit " $domain :Verify error:$code "
311+ fi
312+ else # APIv2
313+ send_signed_request " $uri " " "
314+ fi
307315
308316 status=$( json_get " $response " status)
309317
@@ -1437,8 +1445,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
14371445 responseHeaders=$( cat " $CURL_HEADER " )
14381446 if [[ " $needbase64 " && ${response##* ()} ! = " {" * ]]; then
14391447 # response is in base64 too, decode
1440- #! FIXME need to use openssl base64 decoder if it exists
1441- response= $( echo " $response " | base64 -d)
1448+ response= $( echo " $response " | base64 -d 2>&1 )
14421449 fi
14431450
14441451 debug responseHeaders " $responseHeaders "
0 commit comments