Post by Hrvoje NiksicI just grep'd again through the openssl distribution, and there is
no mention of the environment variables in any of the documentation,
just in the code itself.
If they are completely undocumented, is it wise to even consider them
part of the public API? curl's documentation apparently doesn't
mention them either.
Maybe someone should ask on the OpenSSL mailing lists about this.
I am on the openssl developers list and will ask about
documentation for this. It should be in the man page for
"SSL_CTX_set_default_paths", but no one has written the man page for
that function yet. Documentation has been low priority for the openssl
project. I have never written documentation in .pod format myself.
All this made me look once again at the code for default certificate
locations in the openssl code and in the wget code. I think I need
to withdraw my suggestion for documentation of SSL_CERT_FILE and
SSL_CERT_DIR in the wget documentation, since a careful look at
gen_sslfunc.c shows that we aren't using them. The openssl function
"SSL_CTX_set_default_paths" sets the paths for the trusted X509
certificates to the file "cert.pem" in the OPENSSL directory (as
defined when openssl was compiled) and to the directory "certs" under
the OPENSSL directory. It also allows the two environnment variables
above to override those defaults. For wget to use them, it would
have to call the "SSL_CTX_set_default_paths" function. It doesn't do
that. As I understand from looking at the code in gen_sslfunc.c, wget
doesn't do any verification at all unless called with the sslcheckcert
option set to a non-null value. If sslcheckcert is called, wget looks
only in a location specified by the sslcafile or sslcadir options,
and is not using any default locations. Please let me know if I am
misinterpreting the current behavior.
I am certainly not an encryption specialist, but I would favor
different defaults for this. I would think that verifying the cert
for a "secure" site should be the default, or wget may be giving a
false sense of security when it retrieves the files. I would also
favor using the openssl defaults, allowing them to be overridden by
wget command-line options. This would probably mean making changes in
gen_sslfunc.c to call "SSL_CTX_set_default_paths" just before calling
"SSL_CTX_load_verify_locations", getting rid of "can_verify", and
setting "verify" to "SSL_VERIFY_PEER" unless "sslcheckcert" is set to
0 (or equivalent renamed option is used).
If we make changes similar to this, it would make installation
easier, since most unix machines would already have the bundle of
trusted certificates installed in the openssl default location
(where it could be used by all the programs linked to the openssl
library). Installation would not have to involve installing another
bundle, and the user wouldn't have to know or remember the location
each time wget is invoked. On platforms where an executable file is
built on one machine and used on another (e.g., DOS, Windows), the
environment variables can be set one time to point to the cert bundle
on the user's machine, taking care of this for all the openssl-linked
programs.
Curl does not use the openssl default values. I think that it was
about 2 years ago, that I posted about this on the curl list. The lynx
browser does use the default values (see the file in the lynx source
distribution "www/Library/Implementation/HTTP.c"). Lynx also documents
the environment variables in "docs/README.sslcerts".
Doug
--
Doug Kaufman
Internet: ***@rahul.net