Apply system_default configuration on SSL_CTX_new()#4848
Apply system_default configuration on SSL_CTX_new()#4848t8m wants to merge 2 commits intoopenssl:masterfrom
Conversation
|
I'm wondering why at SSL_CTX_new, and not when the library is loaded? Do you think there is an advantage to do it at that time? Like that daemons create a new SSL_CTX_new() on SIGHUP? |
|
The file is actually loaded on OPENSSL_init_ssl() so the commit message is not correct, I'll modify it. However it would actually be nice if it was possible to re-load the file on SSL_CTX_new() otherwise it would require restart of all daemons to apply the changed system policy. I wonder if there is a possibility to reload the configuration file without unwanted side-effects. |
|
I've opened issue #5041 documenting what this merge request addresses. |
When SSL_CTX is created preinitialize it with system default configuration from system_default section.
|
Test and documentation added. Can you please still consider this for 1.1.1? |
|
Sigh. Nobody else on the team seems to care much about this, unfortunately. I care a lot but I am only one person. Ping @openssl/committers |
|
I've always said that I was interrested in this. I will try to
find some time to review this if nobody else does.
|
|
One risk is that this can introduce security issues in Postfix by unexpectedly enabling trust in the default CAs (CAfile and CApath) in the SMTP server, which till now would by default trust only specific CAs (perhaps just a local one) and possibly allow relaying of email from all clients that have a client from such a CA. If the trust is expanded behind Postfix's back to include all the WebPKI CAs, the system becomes an open relay. There may other costs and downside to untroducing this as a new behaviour of SSL_CTX_new(). It might make more sense to encourage applications that want this type of system-wide configuration to use a new function that has the desired behaviour. SSL_CTX_new_default() or similar. |
vdukhovni
left a comment
There was a problem hiding this comment.
I'd like to see this discussed more broadly before moving forwarded. So placeholder "-1" from me.
|
What about just filtering out / ignoring the certificate related options from the system-default? I mean by adding a new API and requiring applications to switch to it, we can dump this altogether as this is not going to be "system default" but "some changed applications default". Although I know that even the current patch is not ideal in this regard either because it requires the application to initialize the OpenSSL with OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG) otherwise the configuration file is not loaded. But at least patching OpenSSL initialization in applications should be much more easily achievable than patching all calls to SSL_CTX_new(). |
|
Id support the general idea of providing a system-wide configuration for libssl and libcrypto. For example it should be possible to enable platform specific hardware support via engine on system level rather than requiring applications to be aware of the hw they are running on. The same applies to entropy source configuration, see my comment in #4394 . This is not directly related to this specific PR, but there are multiple PRs/issues regarding configuration file and discussion seems to take place here .. |
|
I am glad to finally see some discussion on this. I think the expectation is that this would be used to increase the default level of security for all applications. But Viktor raises a good point about things like changing the default trust store affecting some applications in the wrong way. I think those applications are in the minority however. Perhaps instead of having an "opt-in" we have an "opt-out" and applications like postfix would use it. |
|
Either opt-out or a new API entry point (opt-in) is I think required. I'm also concerned about the performance impact of whatever processing this might imply. SSL_CTX_new() is called not only when the application first initializes, but IIRC also when creating contexts for SNI, and this should involve excessive processing that can be avoided, or unwanted processing that might bring in unexpected settings. My general view is that OpenSSL provides low-level primitives that can be composed to yield higher-level user-friendly functions. This makes it possible to make various choices, without being forced into a one-size fits all model. The downside is that we've not always (or often not) provided the higher-level user-friendly interfaces. So we should do more of that, but not necessarily by converting the low-level functions to one-size fits all common-case interfaces. Thoughts? |
|
I want to have defaults in Debian that are more strict than the
upstream defaults. I would like to move those defaults to some
config file. I want users to be able to edit that config file, and
I want applications be able to override the defaults.
|
|
Either opt-in or opt-out, this feature better be visible/displayed when calling a kind of |
|
If I may attempt to summarize the discussion above, is it true we have consensus for the following requirements for such a change:
Is that correct? |
|
My understanding is that @paulidale @richsalz and @kroeckx are ok with that summary (please correct me if I'm wrong). @vdukhovni is that summary ok with you? Do you have any suggestion for the opt-out mechanism? Is calling |
|
I can't see why an application should not be able to create a blank context. |
|
The above summary does not explicitly take into account a transition plan from the current state to the "new" state of affairs. |
|
And it does not reflect @vdukhovni's concern about the |
|
This PR changes the behaviour of SSL_CTX_new with no way to access the original behaviour. |
|
Whatever we do, "looking at the application name" is not a robust mechanism we should consider. |
|
This is really just a pull request to start the discussion, please
ignore whatever the patch currently does.
|
|
Please note that no config files will be read on SSL_CTX_new with the patch. Just the configuration from the file read on initialization is applied to the SSL_CTX. I do not really think performance would be an issue for large majority of OpenSSL using apps. OK, so what about this proposal: If the #2397 lands first it should already add the flags parameter so we do not have to create additional API call. |
|
@vdukhovni the distros already handle default CA stores somehow. Here the major driver is a crypto policy support in regards to enabled algorithms and minimum key size limits. |
|
@richsalz, you removed the "Post 1.1.1" milestone... what milestone would you like to see? |
|
I want this in 1.1.1 I want us to make it easy for admins and downstream distro maintainers to change defaults, even if a postfix maintainer doesn't like it. |
|
Ok, so 1.1.1 milestone it is |
|
I'm less concerned about change-on-the-fly approaches - i.e. just having a one-time load of the configuration file at startup and applying that would meet my expectations. Checking the configuration file and reloading it for every call to SSL_CTX_new isn't what I would expect - and if that was done it should be on a timestamp check caching basis at least. And be able to be overridden - which I guess argues for that being a configuration option - loaded at startup - should we be checking for configuration changes for each SSL_CTX_new call - as a suggestion for how to handle it. And I also think this should be going into the 1.1.1 release as well ... |
|
I think the simplest thing to understand is read the file at startup, don't check for run-time changes. |
|
Yes, that's my opinion. There is some discussion going on in openssl-project mailing list. |
richsalz
left a comment
There was a problem hiding this comment.
Anything TBD is a fix. Get this into the beta.
When SSL_CTX is created preinitialize it with system default configuration from system_default section. Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Rich Salz <[email protected]> (Merged from #4848)
|
Merged. Please see #5671 for some remaining issues. |
When libssl is initialised it will attempt to load any config file. This ensures any system_default configuration (as per openssl#4848) is used.
When libssl is initialised it will attempt to load any config file. This ensures any system_default configuration (as per #4848) is used. Reviewed-by: Richard Levitte <[email protected]> (Merged from #5818)
When SSL_CTX is created preinitialize it with system default
configuration from system_default section.
Checklist