Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should auto-recover from bad nonces #2244

Closed
jsha opened this issue Jan 20, 2016 · 11 comments · Fixed by #4113
Closed

Should auto-recover from bad nonces #2244

jsha opened this issue Jan 20, 2016 · 11 comments · Fixed by #4113

Comments

@jsha
Copy link
Contributor

jsha commented Jan 20, 2016

I recently got this error trying to issue a cert:

The client sent an unacceptable anti-replay nonce :: JWS has invalid anti-replay nonce

This happens from time to time - the server loses track of outstanding nonces. Since the reply always includes a fresh nonce, the client should auto-retry the request.

@joohoi
Copy link
Member

joohoi commented Jan 22, 2016

I got this error several times today as well, all the errors were from the production server, staging was working fine. Might be something to do with loads, however as noted, it's trivial to implement retry on client side.

@rezaalavi
Copy link

I am getting the same error and retry doesn't solve the problem.
Unfortunately few retries also makes it that the domain hits the certificate limit and now we have to wait 7 days.

We offer this to all our client and now we are worried we are going to have serious issues comes the renewal date.

@rezaalavi
Copy link

Ok here is out this finally worked for me, We have to repeat the new certificate step and use the nonce that is sent back with "jws invalid nonce" to get the certificate issued.
Otherwise if we go through the whole process again it always fails.

There must be a new bug on the server side making resulting in this but overall because of the workaround it is not a show stopper.

@kuba
Copy link
Contributor

kuba commented Jan 24, 2016

BTW, @rezaalavi your comment suggests your developing alternative client. This repo (and this bug) is for the official client implementation.

@chriscroome
Copy link

FWIW I just got this error, updated the letsencrypt code and then stopped getting it.

@wichtounet
Copy link

I was also encountering this error and after update of the Gentoo package and it worked!

@elblaf
Copy link

elblaf commented Dec 18, 2016

I've been hit by that invalid anti-replay nonce problem for my use case (DNS challenge, where I had to wait up to half an hour before the challenge value is published by my DNS provider).

The first time, it was with the staging environment, but it did not reproduced afterwards. I was then hit numerous time with the production environment, so I followed Jacob's suggestion and make the client retries POSTs on badNonce errors.

Attached is the patch (against certbot-0.9.3, the version I use) I've extracted from my deployment of certbot:

cerbot-acme-clientpy.patch.txt

I'm not a pythonist, so it may not be nice python code: maybe one can clean this attempt and make a pull request from it?

edit: typo in jsha's first name, sorry.

@bmw
Copy link
Member

bmw commented Jan 23, 2017

Just out of my curiosity, what stops boulder from keeping track of nonces making this a problem that has to be solved by the different ACME clients?

@jsha
Copy link
Contributor Author

jsha commented Jan 23, 2017

Many nonces go unused, which means we have to expire them after a while. More importantly, we currently keep track of nonces per-frontend and therefore per-DC. When we switch traffic between DCs, any inflight sessions will get badNonce errors.

@bmw bmw added this to the 0.11.0 milestone Jan 24, 2017
@bmw
Copy link
Member

bmw commented Jan 24, 2017

Because there is no limit how long it can take to perform a challenge when using the manual plugin, I'm bumping the priority of this issue. Due to how long it can take for DNS changes to propagate, this problem makes using Certbot with the DNS challenge impossible in some cases (see #4099).

@elblaf
Copy link

elblaf commented Jan 24, 2017

Attached is an updated version of my previous patch (against 49d46ef, and with a more idiomatic way to propagate the raised exception when max number of attempts is reached):

cerbot-acme-clientpy-v2.patch.txt
cerbot-acme-clientpy-v2-proper-urn.patch.txt

As a workaround, should be appliable against published v0.10.0 and v0.10.1.

Edit: the URN prefix for acme errors has changed ("urn:ietf:params:acme:error:" instead of "urn:acme:error:"); updated patch.

@bmw bmw modified the milestones: 0.10.2, 0.11.0 Jan 25, 2017
@bmw bmw self-assigned this Jan 25, 2017
@SwartzCr SwartzCr changed the title Shuold auto-recover from bad nonces Should auto-recover from bad nonces Jan 25, 2017
bmw pushed a commit that referenced this issue Jan 25, 2017
@bmw bmw added the has pr label Jan 25, 2017
@bmw bmw closed this as completed in #4113 Jan 26, 2017
bmw pushed a commit that referenced this issue Jan 26, 2017
(cherry picked from commit b6fecca)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants