Skip to content

Kestrel should not hardcode acceptible TLS versions but rather honor OS settings #14997

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

Closed
jhudsoncedaron opened this issue Oct 14, 2019 · 25 comments
Assignees
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions breaking-change This issue / pr will introduce a breaking change, when resolved / merged. feature-kestrel

Comments

@jhudsoncedaron
Copy link

Discovered while switching on TLS 1.3 globally.

Says right in the xmldoc (and verified in the code):

    /// <summary>
    /// Specifies allowable SSL protocols. Defaults to <see cref="SslProtocols.Tls12" /> and <see cref="SslProtocols.Tls11"/>.
    /// </summary>
   public SslProtocols SslProtocols { get; set; }

But the best practices doc says don't do this.

I haven't yet located the API that says what the OS-enabled protocols are (we want to force TLS-1.3 on where possible but not all servers support it yet); however our code should be smarter and not force it on when it's a downgrade, so we would want to call it.

The idea of having switches like this in the OS settings is when protocols get broken, the admin can switch them off immediately without waiting for application upgrades.

@blowdart
Copy link
Contributor

@halter73 I thought we left it as defaulting to the OS?

@halter73
Copy link
Member

The allowed algorithms are controlled by the OS, but SslProtocols default to Tls11 | Tls12 in order to ensure SslProtocols.Tls (which represents TLS 1.0) doesn't get used on any OS.

You asked for and approved the change over 3 years ago @blowdart. Even back then, you didn't really want to support TLS 1.1, but we continued to support it because not doing so would have broken too many clients at the time IIRC.

Should we go back to using OS defaults?

@blowdart
Copy link
Contributor

blowdart commented Oct 15, 2019 via email

@blowdart
Copy link
Contributor

@anurse It's time to change the kestrel defaults. 5.0?

@analogrelay
Copy link
Contributor

Let's get it in to 5.0 for sure. I think this is a viable candidate for asking for a 3.1 backport though, given the new TLS version (1.3) and the LTS status of 3.1.

@analogrelay
Copy link
Contributor

analogrelay commented Oct 15, 2019

The new default would be SslProtocols.None docs.microsoft.com/en-us/dotnet/api/system.security.authentication.sslprotocols?view=netcore-3.0

To confirm, we are OK with using None now even though that could potentially include 1.0? (i.e. we're ready to trust OSes to have already blocked TLS 1.0/1.1 usage)

@Tratcher
Copy link
Member

I don't recommend this for 3.1, you'll end up downgrading people on some platforms. E.g. do we know what the platform defaults are on Win7, 8, MacOs, Linux, etc?

@jhudsoncedaron
Copy link
Author

According to the documentation I can find, Windows 10 has not!. I'm building up several hundred lines of code to look up the supported versions and chop the list.

@analogrelay
Copy link
Contributor

analogrelay commented Oct 15, 2019

What about just adding Tls3 to the flag set?

@jhudsoncedaron Thanks for checking in to that!

@blowdart
Copy link
Contributor

Adding Tls3 paints us into the same hole again when Tls4 comes along. And we keep telling people not to do this, to let the OS decide, but then we do it ourselves.

@analogrelay
Copy link
Contributor

If @blowdart is happy with None, I'm not opposed. As @halter73 said, I believe the choice to avoid None was intentional but if we feel like we can trust the OS here, I'm OK with that. Certainly for 5.0 at least. We can discuss what (if any) we backport to 3.1.

@blowdart
Copy link
Contributor

We could log warnings if the OS is configured to allow what we consider bad, but not stop.

@halter73
Copy link
Member

halter73 commented Oct 15, 2019

Is there an easy way to check how the OS is configured?

@jhudsoncedaron
Copy link
Author

@halter73 : I have it in 178 lines but I'm not absolutely sure it's right.

@blowdart
Copy link
Contributor

@jhudsoncedaron Remember that TLS versions are not cipher suites.

There's only 5 options here. Ssl2, Ssl3, Tls1, Tls11, Tls12

@blowdart
Copy link
Contributor

http://blog.whatsupduck.net/2014/10/checking-ssl-and-tls-versions-with-powershell.html would do it if you have an https port open

@jhudsoncedaron
Copy link
Author

@blowdart : Reading the OS config takes a lot of lines. The number of versions is essentially irrelevant. The only weirdness I had to handle was the enum was named Tls instead of Tls10.

@blowdart
Copy link
Contributor

I feel this is too risky for 3.1

@analogrelay
Copy link
Contributor

Fair enough

@analogrelay analogrelay added this to the 5.0.0-preview1 milestone Oct 15, 2019
@analogrelay analogrelay removed this from the 5.0.0-preview1 milestone Mar 11, 2020
@shirhatti shirhatti added this to the Next sprint planning milestone Mar 27, 2020
@shirhatti
Copy link
Contributor

@blowdart We're considering this for 5.0. Thoughts?

@shirhatti
Copy link
Contributor

On older OSes this change would allow TLS 1.0

@blowdart
Copy link
Contributor

Hurrah :)

And yes, I know, we don't have an exclusionary api in windows unfortunately, but hopefully the older OSes are configured correctly ... we'd provide instructions in release notes etc.

@jhudsoncedaron
Copy link
Author

jhudsoncedaron commented Mar 27, 2020

@shirhatti : Yeah it would. There should have been an OS patch out to change that already but that's water under the bridge at this point.

If you don't want to do it, you could just give an API to tell us what protocols are actually enabled, but I found this has its own ugliness because the code should be able to pick up TLS 1.4 (not a typo I really do mean to reference a version that doesn't exist yet) from the SSL provider with no changes to .NET Core at all. Right now, the only way to get that behavior is to just never assign to the property.

@BrennanConroy
Copy link
Member

Lets get this into preview6

@BrennanConroy BrennanConroy added the breaking-change This issue / pr will introduce a breaking change, when resolved / merged. label Jun 1, 2020
@halter73 halter73 closed this as completed Jun 4, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jul 5, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions breaking-change This issue / pr will introduce a breaking change, when resolved / merged. feature-kestrel
Projects
None yet
Development

No branches or pull requests

8 participants