Type of request: enhancement request
Operating system: tested on Linux, probably affects all
Version of OpenSSL: tested on 0.9.8k, seen in current CVS as well
Problem:
openssl s_client is a useful tool to debug many kinds of certificate
issues. When it comes to chain verification, however, the fact that it
unconditionally sets default verify paths can lead to confusion and
wrong conclusions.
Example:
suppose you want to ensure that the https cert of server can be
validated against /etc/ssl/certs/some.ca.pem. You might try to do this:
openssl s_client -verify 5 -CAfile some.ca.pem -connect server:443
Judging from the line "Verify return code: 0 (ok)" you might assume that
the certificate had been verified against some.ca.pem. That is not
necessarily the case, though: it might well be that there was some
/etc/ssl/certs/other.ca.pem used as the root, and that /etc/ssl/certs/
is configured as the default cert dir, either at compile time or through
the SSL_CERT_DIR environment variable.
Workaround:
one can set the environment variables SSL_CERT_FILE and SSL_CERT_DIR to
e.g. /dev/null to avoid this problem. This will disable default paths,
and not cause any errors.
The man pages do not mention those environment variables in any way, so
one has to look at the source or search the web to learn about them.
Request:
I suggest you introduce a command line switch, e.g. called -CAnodefault,
which disables the loading of these default paths. This would give users
an easy way to disable loading these defaults. And the presence of such
a flag would be a good indication that there are defaults. Unless users
make use of this switch, the behaviour of s_client would stay as it
alwasy was.
I would also consider a more radical idea: when either -CApath or
-CAfile is given, don't load the defaults at all. The rationale here is
that the user specified the CA locations because he expects the certs to
verify against those. So it's that expectation that should be verified,
and no other trust roots should interfere.
This approach would avoid adding an option at the cost of changing
behaviour. If that's acceptable, I'd prefer this approach.
The core of the modification would likely center around these lines in
s_client.c:
if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(ctx)))
Cross reference:
The missing documentation for the SSL_CERT_FILE and SSL_CERT_DIR
environment variables was already mentioned in 2005 by request #1051:
http://rt.openssl.org/Ticket/Display.html?id=1051&user=guest&pass=guest
Especially the s_client man page should mention those variables, I think.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [email protected]