Comments (4)
Could you take a look into the error details and provide them?
Essentially the IsError
should only be true for HttpStatus Codes (returned from Let's Encrypt) > 400. Which normally means something went wrong, and we've no way to recover or do something useful afterwards.
That's why it issues an terminating error.
If you want to just try again, you can catch it with try {} catch {}.
Changing the throw to write-error, would not terminate the currently running function and would end up in more errors being thrown.
from acme-ps.
Error:
Server returned problem (Status: 400).
@{type=urn:ietf:params:acme:error:badNonce; detail=JWS has an invalid anti-replay nonce:
"0102awhAU9D2anavAc277bLVzM5Sfl-OIS0k22BFWkl_Atfk"; status=400}
At C:\Program Files\WindowsPowerShell\Modules\acme-ps\1.1.2\ACME-PS.psm1:1183 char:13
throw "$(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Server returned...k"; status=400}:String) [], RuntimeException
+ FullyQualifiedErrorId : Server returned problem (Status: 400).
@{type=urn:ietf:params:acme:error:badNonce; detail=JWS has an invalid anti-replay nonce: "0102awhAU9D2anavAc277bLVz
M5Sfl-OIS0kk22BFWkl_Atfk"; status=400}
If I try it again a few times with the same state and nonce it eventually goes through fine.
my thoughts on using a throw instead of write-error is that a throw doesn't seem to respect erroractionpreferences set by a script calling the module where a write-error would. i.e. It'd be better to give the user the decision on how to handle errors rather than deciding for them.
Edit: a try/catch should be able to get around it as is, but it seems real unnecessary to do it for every single acme-ps related command in a large script, I guess i'm just being a bit lazy here
from acme-ps.
Ah sorry, I was talking nonsense before.
The Response will report an error for everything HttpStatus >= 400.
Furthermore it'll extract a given nonce, if any and set that to the acme-state, so it's kind of self-healing.
Essentially (if you do not some kind of multi-session or multi-threading) the nonce should be okay with the next call.
The throw is used, because the functions normally won't end with calling Let's Encrypt, but will also use the result - that might be "lazy" on my side, because I did not want to use -errorAction 'Stop' everywhere. Also, your script probably cannot go on if such an error occures as well.
To relieve the problem, it'd be possible to use the problem-type (urn:ietf:params:acme:error:badNonce) to detect a faulty nonce and automatically retry with a new one. The detection could be done in AcmeHttpResponse
and Invoke-SignedWebRequest
could manage (a single) retry.
from acme-ps.
I included an automatic retry on nonce error.
Also you can now get the error details from the thrown exception.
Will be available in 1.1.3 once it's in the gallery. If you like to get a head start, try the beta ;).
from acme-ps.
Related Issues (20)
- [Improvement] Add state reference to order
- [BUG]? Full chain export seems to be exporting in the wrong order HOT 4
- [BUG] Chain not included for specific instance.. HOT 1
- [Improvement] Exporting x509 certs/keys as PEM HOT 4
- Exception calling "GetResult" with "0" argument(s): "An error occurred while sending the request." HOT 6
- Certificate not working on older Android after 29.9.2021 HOT 2
- New-AcmePSKey invalid ValidateSet for RSAKeySize HOT 1
- DNS-01 HOT 10
- New Order / Old Account HOT 5
- Are SHA-1 self signatures being used to issue CSRs? HOT 1
- HTTP-01 Challenge File Not Getting Created HOT 3
- Authorizations does not seem to be parsing correctly HOT 12
- [BUG] The certificate chain seems to be out of order in 1.5.2. Versions 1.5.3-beta, and 1.5.4 Fails to run. HOT 4
- [BUG] Some of the *ToExport keys are missing from the module manifest HOT 2
- [BUG] v1.5.6 Export-Certificate "value cannot be null" HOT 10
- Cannot export non-exportable private key HOT 1
- [BUG] When using New-ACMEAccount with previous AccountKey it errors with Get-Account HOT 1
- [BUG] The exported PFX certificate doesn't have the full Let's Encrypt chain HOT 4
- Issue Export-ACMECertificate HOT 2
- Certificate Generation/Validation is failing From June 2024 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acme-ps.