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

empty variables lead to hard-to-find problems #1191

Closed
auerswald opened this issue Jan 15, 2018 · 1 comment
Closed

empty variables lead to hard-to-find problems #1191

auerswald opened this issue Jan 15, 2018 · 1 comment

Comments

@auerswald
Copy link
Contributor

auerswald commented Jan 15, 2018

https://github.com/Neilpang/acme.sh/blob/e6cda79ee8411255d191f7781df42522bbf3aedc/acme.sh#L3578

the type-object in $response can contain other objects in case of an error. for example:

response='{"identifier":{"type":"dns","value":"example.com"},"status":"invalid","expires":"2018-01-19T01:31:55Z","challenges":[{"type":"dns-01","status":"invalid","error":{"type":"urn:ietf:params:acme:error:connection","detail":"DNS problem: NXDOMAIN looking up TXT for _acme-challenge.example.com","status": 400},"url":"https://acme-staging-v02.api.letsencrypt.org/acme/challenge/8m497...gfDiwc/91764091","token":"kKSZCs...Z9ung","keyAuthorization":"kKSZCs...Z9ung.HOF2...peL8"}],"wildcard": true}'

the regular expression '[^\{]*"type":"'$vtype'"[^\}]*' fails here. the variables token and uri are then empty. if you delete the error object here, the script works and later the (following) correct error appears: "Unable to update challenge :: The challenge is not pending."
this message helps a little bit more than an avoidable curl (3) error

example:

entry="$(printf "%s\n" "$response" | sed 's/,"error":{[^}]*}//g' | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')"

I only took a quick look at the source code. Maybe you (can|must) catch the error before.
btw… thanks for your work!

Neilpang pushed a commit that referenced this issue Feb 6, 2018
@Neilpang
Copy link
Member

Neilpang commented Feb 6, 2018

I just fixed acme.sh to give a more friendly error message.
please update to the latest dev branch and try again.

export BRANCH=dev
acme.sh --upgrade

@Neilpang Neilpang closed this as completed Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants