Add internal
property to ACME challenge error response logs
#2227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the internal error message to the ACME response log. This provides more information in the event of an ACME challenge failing to be completed, such as network connectivity issues.
Technically this isn't the correct thing to do, as the internal error message isn't part of the response that's sent to the ACME client by the CA. Furthermore, the error message will be logged on
INFO
level, whereas it might be more fitting to log it onERROR
. Despite that, doing it like this keeps the internal error close to the corresponding ACME request, so it seemed like a pragmatic solution to me.The logging logic has only been changed for the
Challenge
type, but can be easily extended to other ACME types if this approach makes sense.A log line will now look something like this (note the
response
object):A slightly different solution could be to handle the internal error message separately from the
response
near https://github.com/smallstep/certificates/blob/master/api/log/log.go#L51-L99.