Comments (2)
So, problem is reusing resp_data reference means that when there is an error parsing the string, it is still a string and not a dict. So running with this patch (purposefully ot fixing whatever the apache config error is until the acme-tiny error handling is fixed):
@@ -36,10 +36,11 @@
except IOError as e:
resp_data = e.read().decode("utf8") if hasattr(e, "read") else str(e)
code, headers = getattr(e, "code", None), {}
+ resp_raw = resp_data
try:
- resp_data = json.loads(resp_data) # try to parse json results
+ resp_data = json.loads(resp_raw) # try to parse json results
except ValueError:
- pass # ignore json parsing errors
+ raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: {4}".format(err_msg, url, data, code, '"%s"'%resp_raw))
if depth < 100 and code == 400 and resp_data['type'] == "urn:ietf:params:acme:error:badNonce":
raise IndexError(resp_data) # allow 100 retrys for bad nonces
if code not in [200, 201, 204]:
I discover that code is 204 and resp_raw is empty from LE:
acme-tiny[1101418]: File "/usr/sbin/acme_tiny", line 43, in _do_request
acme-tiny[1101418]: raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: {4}".format(err_msg, url, data, code, '"%s"'%resp_raw))
acme-tiny[1101418]: ValueError: Error:
acme-tiny[1101418]: Url: https://acme-v02.api.letsencrypt.org/acme/new-nonce
acme-tiny[1101418]: Data: None
acme-tiny[1101418]: Response Code: 204
acme-tiny[1101418]: Response: ""
from acme-tiny.
Ok, this patch is minimal code change and makes the error much clearer:
@@ -39,7 +39,7 @@
try:
resp_data = json.loads(resp_data) # try to parse json results
except ValueError:
- pass # ignore json parsing errors
+ resp_data = {'type':None, 'raw': resp_data}
if depth < 100 and code == 400 and resp_data['type'] == "urn:ietf:params:acme:error:badNonce":
raise IndexError(resp_data) # allow 100 retrys for bad nonces
if code not in [200, 201, 204]:
And the resulting error is:
acme-tiny[1111183]: ValueError: Wrote file to /var/www/challenges/0eG_qrrSE_OpkH5114hcl8auxZPFqtRxX72HvXKyjaQ, but couldn't download http://melissa.gathman.org/.well-known/acme-challenge/0eG_qrrSE_OpkH5114hcl8auxZPFqtRxX72HvXKyjaQ: Error:
acme-tiny[1111183]: Url: http://melissa.gathman.org/.well-known/acme-challenge/0eG_qrrSE_OpkH5114hcl8auxZPFqtRxX72HvXKyjaQ
acme-tiny[1111183]: Data: None
acme-tiny[1111183]: Response Code: 400
acme-tiny[1111183]: Response: {'type': None, 'raw': '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>400 Bad Request</title>\n</head><body>\n<h1>Bad Request</h1>\n<p>Your browser sent a request that this server could not understand.<br />\nReason: You\'re speaking plain HTTP to an SSL-enabled server port.<br />\n Instead use the HTTPS scheme to access this URL, please.<br />\n</p>\n</body></html>\n'}
from acme-tiny.
Related Issues (20)
- Consider switching from subprocess+openssl to Cryptography HOT 6
- List out of index error HOT 3
- Allow retry of network requests HOT 3
- Unable to update account :: contact method "" is not supported HOT 3
- Add support for alternate chains HOT 14
- Add option to change acme contact email HOT 2
- The future of acme-tiny? HOT 1
- Potential path traversal issue HOT 7
- 58752c527c9345d23a771d2a93f729aaa8fe7712 causes failure on ubuntu bionic HOT 2
- Regex for subject_alt_names fails on Windows due to \r\n as line break HOT 1
- certificate_pem, _, _ = _do_request() missing items HOT 1
- python(2) vs. python3 HOT 2
- [patch] minor, documentation. Do explicitly state not supporting challenge for wildcard (DNS-01) in README.md
- If you need to manually obtain the certificate, here is the easy-to-use web page ACME client on the browser, welcome to use🎉
- CERTIFICATE_VERIFY_FAILED on domain letsencrypt HOT 6
- Standalone Mode
- Asynchronous Order Finalization: will this require a change? HOT 2
- need automatic retry for LE server busy response. HOT 5
- acme-tiny has begun to issue return code 1 (indicating error) even on apparent success 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-tiny.