Skip to content

Commit 4d69e2f

Browse files
authored
Merge pull request #479 from srvrco/fix-v1-renew
Fix for ACMEv1 renewals
2 parents 9895a21 + 197c5f8 commit 4d69e2f

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ services:
77
environment:
88
# with Go 1.13.x which defaults TLS 1.3 to on
99
GODEBUG: "tls13=1"
10+
# don't reuse authorizations (breaks testing force renew)
11+
PEBBLE_AUTHZREUSE: 0
1012
ports:
1113
- 14000:14000 # HTTPS ACME API
1214
- 15000:15000 # HTTPS Management API

getssl

+12-5
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@
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

201202
PROGNAME=${0##*/}
202-
VERSION="2.15"
203+
VERSION="2.16"
203204

204205
# defaults
205206
ACCOUNT_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"

test/run-test.sh

-10
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,13 @@ cp /getssl/test/test-config/getssl-http01.cfg /root/.getssl/getssl/getssl.cfg
2525

2626
# Test #2 - http-01 forced renewal
2727
echo Test \#2 - http-01 forced renewal
28-
29-
# There's a race condition if renew too soon (authlink returns "valid" instead of "pending")
30-
echo Sleeping 20s to allow previous validation to expire
31-
sleep 20
3228
/getssl/getssl getssl -f
3329

3430
# Test cleanup
3531
rm -r /root/.getssl
3632

3733
# Test #3 - dns-01 verification
3834
echo Test \#3 - dns-01 verification
39-
4035
cp /getssl/test/test-config/nginx-ubuntu-no-ssl /etc/nginx/sites-enabled/default
4136
service nginx restart
4237
/getssl/getssl -c getssl
@@ -45,9 +40,4 @@ cp /getssl/test/test-config/getssl-dns01.cfg /root/.getssl/getssl/getssl.cfg
4540

4641
# Test #4 - dns-01 forced renewal
4742
echo Test \#4 - dns-01 forced renewal
48-
49-
# There's a race condition if renew too soon (authlink returns "valid" instead of "pending")
50-
echo Sleeping 30s to allow previous validation to expire
51-
sleep 30
52-
5343
/getssl/getssl getssl -f

0 commit comments

Comments
 (0)