-
Notifications
You must be signed in to change notification settings - Fork 419
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
Call SSL_CTX_load_verify_locations by default when initializing an SSL_CTX #632
Comments
Please don't auto-find the system roots. That behaviour would make it impossible to have a Context that does not trust the system cert store, a very valid use-case for scoping trust. I'm fine with that being done, but why not do it in |
@Lukasa we definitely don't want to prevent that. I'm unsure how to use set_default_verify_paths though. Does it take arguments outside of reading env vars? |
To be clear, all I'm suggesting is that you don't do this when |
@Lukasa ah, I understand. Now I am wondering if we can replicate the behavior of the set_default_paths so that everything behaves the same though. Maybe I should ask the remedial question first though: on linux with pyOpenSSL right now are any trust roots available by default on the SSL_CTX? I've been assuming that the answer is "the system roots are available". Anyway...
int X509_STORE_set_default_paths(X509_STORE *ctx)
{
X509_LOOKUP *lookup;
lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_file());
if (lookup == NULL)
return (0);
X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_hash_dir());
if (lookup == NULL)
return (0);
X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
/* clear any errors */
ERR_clear_error();
return (1);
} Frankly I'm either too tired or too stupid to entirely puzzle out what's happening there. It gets an We can get the |
I think your post tailed off there @reaperhulk. ;) But yeah, that basically seems to just be loading the compiled defaults. |
Yeah okay, with sleep and actually paying attention I have sorted out all my confusion. PR inbound. |
cryptography
is planning to ship amanylinux1
wheel soon(ish). Unfortunately, the default verify location for SSL_CTX is defined during compile and different linux distributions choose different locations. This means that pyOpenSSL will experience issues with finding certificate trust stores on many distributions unless we make a change. To (generally) preserve the existing behavior it has been proposed that we write some code that iterates over a set of possible paths and finds the cert store. This would mimic the existing behavior of Go (root_linux.go).To a first approximation this PR would add a method call in
SSL.Context.__init__
that finds the root store and then callsSSL_CTX_load_verify_locations
on the context.Update: The original proposal here is nowhere near what has actually been implemented. See #633 for details.
cc @alex @hynek @Lukasa @njsmith @tiran to see if anybody has objections to this approach.
The text was updated successfully, but these errors were encountered: