Skip to content

Commit 3f8196e

Browse files
test: Remove badNonce retries and increase nonce maxConnectionAge
1 parent 89e2dfe commit 3f8196e

5 files changed

Lines changed: 15 additions & 25 deletions

File tree

test/chisel2.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import sys
1515
import signal
1616
import threading
17-
import time
18-
1917
from cryptography.hazmat.backends import default_backend
2018
from cryptography.hazmat.primitives.asymmetric import rsa
2119
from cryptography import x509
@@ -55,11 +53,11 @@ def make_client(email=None):
5553
"""Build an acme.Client and register a new account with a random key."""
5654
client = uninitialized_client()
5755
tos = client.directory.meta.terms_of_service
58-
if tos == ACCEPTABLE_TOS:
59-
client.net.account = client.new_account(messages.NewRegistration.from_data(email=email,
60-
terms_of_service_agreed=True))
61-
else:
56+
if tos != ACCEPTABLE_TOS:
6257
raise Exception("Unrecognized terms of service URL %s" % tos)
58+
59+
client.net.account = client.new_account(messages.NewRegistration.from_data(email=email,
60+
terms_of_service_agreed=True))
6361
return client
6462

6563
class NoClientError(ValueError):
@@ -140,21 +138,13 @@ def auth_and_issue(domains, chall_type="dns-01", email=None, cert_output=None, c
140138
else:
141139
raise Exception("invalid challenge type %s" % chall_type)
142140

143-
# Make up to three attempts, retrying on badNonce errors
144-
for n in range(3):
145-
time.sleep(0.2 * n) # No sleep before the first attempt, then backoff
146-
try:
147-
order = client.poll_and_finalize(order)
148-
if cert_output is not None:
149-
with open(cert_output, "w") as f:
150-
f.write(order.fullchain_pem)
151-
except messages.Error as e:
152-
if e.typ == "urn:ietf:params:acme:error:badNonce":
153-
continue
154-
else:
155-
break
156-
finally:
157-
cleanup()
141+
try:
142+
order = client.poll_and_finalize(order)
143+
if cert_output is not None:
144+
with open(cert_output, "w") as f:
145+
f.write(order.fullchain_pem)
146+
finally:
147+
cleanup()
158148

159149
return order
160150

test/config-next/nonce-a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"sampleratio": 1
1414
},
1515
"grpc": {
16-
"maxConnectionAge": "30s",
16+
"maxConnectionAge": "30m",
1717
"services": {
1818
"nonce.NonceService": {
1919
"clientNames": [

test/config-next/nonce-b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"sampleratio": 1
1414
},
1515
"grpc": {
16-
"maxConnectionAge": "30s",
16+
"maxConnectionAge": "30m",
1717
"services": {
1818
"nonce.NonceService": {
1919
"clientNames": [

test/config/nonce-a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"debugAddr": ":8111",
1212
"grpc": {
13-
"maxConnectionAge": "30s",
13+
"maxConnectionAge": "30m",
1414
"address": ":9101",
1515
"services": {
1616
"nonce.NonceService": {

test/config/nonce-b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"debugAddr": ":8111",
1212
"grpc": {
13-
"maxConnectionAge": "30s",
13+
"maxConnectionAge": "30m",
1414
"address": ":9101",
1515
"services": {
1616
"nonce.NonceService": {

0 commit comments

Comments
 (0)