Repository navigation
Conversation
8bc3838 to
564399a
Compare
|
@vdukhovni, here is an even more interesting trace for where the chain build failure is just because of This and many other traces reveal that on chain build failure the trust store is searched twice: before and after untrusted certs. Moreover, also in successful chain building the trust store is searched at each depth (with different subject name). |
|
I meanwhile realized that for successful chain building the trust store is not consulted more than once per depth (and thus, I updated my above statement accordingly), |
levitte
left a comment
There was a problem hiding this comment.
So if someone enables tracing through the OPENSSL_TRACE environment variable (for example with the value ALL), and uses -verbose (i.e. cause X509_STORE_CTX_set0_trace_output() to be called), won't that mean that the output comes in duplicates?
| static void trace_msg(const X509_STORE_CTX *ctx, const char *msg) | ||
| { | ||
| BIO_printf(ctx->out, "%s\n", msg); | ||
| OSSL_TRACE1(X509_VERIFY, "%s\n", msg); |
| const char *elems) | ||
| { | ||
| BIO_printf(ctx->out, "%s %d %s\n", msg, num, elems); | ||
| OSSL_TRACE3(X509_VERIFY, "%s %d %s\n", msg, num, elems); |
| const char *str = X509_verify_cert_error_string(err); | ||
|
|
||
| BIO_printf(ctx->out, fmt, msg, err, str); | ||
| OSSL_TRACE3(X509_VERIFY, fmt, msg, err, str); |
|
Might I suggest making this PR only about adding the tracing stuff? |
Yes, and this might even be intended: suppose the trace API output goes to a log file and the one set via |
I can certainly provide the additional/alternative output via |
|
BTW, this PR is still in draft state solely because it builds upon
|
|
I agree with Richard that this should be split in two PRs. One adding the tracing and one that builds upon the first one to add the diagnostic output (that one should be discussed with OTC IMO). |
All right, I will do the part adding |
377ee41 to
5ff328d
Compare
5ff328d to
bb01955
Compare
|
Unfortunately, I likely won't have the time to continue working on this. |
|
Closing this PR for the time being as nobody seems to be able to spend energy on this in the near future. |
This provides a proper solution for the problem mentioned first in #14094:
When something goes wrong during the chain building phase of certificate verification,
the error code usually is just
unable to get issuer certificateorunable to get local issuer certificate.Often this does not tell much about the real problem leading to the situation that no suitable cert can be found.
Here is a simple example. Even when using
-verbose,just yields
because
check_issued()throws away all intermediate error codes during chain building.This PR adds
X509_STORE_CTX_set0_trace_output()and extends the semantics of theopenssl verifyapp option-verbosesuch that the above call additionally provides the following output:which shows the main steps of cert chain building and points out the reason why no suitable cert could be found:
subject signature algorithm and issuer public key algorithm mismatch.In addition, this PR adds a new trace category:
X509_VERIFY, such that the above output can also be generated when the trace API is statically enabled (which is not the default, see also #18734) andX509_VERIFYis dynamically enabled, for instance because the env. variableOPENSSL_TRACEcontains it.