Skip to content
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

investigate TLS13 on MacOS #1979

Open
wfurt opened this issue Jan 21, 2020 · 21 comments
Open

investigate TLS13 on MacOS #1979

wfurt opened this issue Jan 21, 2020 · 21 comments

Comments

@wfurt
Copy link
Member

wfurt commented Jan 21, 2020

It seems like on Catalina TLS1.3 works out of the box - at least with Safari.
However, when I try to use in .NET I get the following error:

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> Interop+AppleCrypto+SslException: bad protocol version
   --- End of inner exception stack trace ---

This may be because API we currently use is marked as obsolete or there may be something missing since TLS1.3 support got out before Catalina. And all TLS1.3 tests are disabled on all versions of MacOS.

related to #1720

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jan 21, 2020
@karelz karelz added bug and removed untriaged New issue has not been triaged by the area owner labels Feb 13, 2020
@karelz karelz added this to the 5.0 milestone Feb 13, 2020
@wfurt
Copy link
Member Author

wfurt commented May 26, 2020

It seems like we will need to rewrite PAL to use new Network framework API.
That should fix iOS as well.

https://mailarchive.ietf.org/arch/msg/tls/5QjzTilqjomSyzENtgfaAqQOhbA/

@karelz karelz modified the milestones: 5.0.0, Future Jun 18, 2020
@karelz
Copy link
Member

karelz commented Jun 18, 2020

Triage: Will require PAL rewrite on Mac -- out of scope of 5.0.
The new Catalina API will help also iOS and light up TLS 1.3 there.

@chucker
Copy link

chucker commented Mar 24, 2022

Is this still current? In a .NET 6 console app with macOS 12.3 against a host that only seems to support TLS 1.3, I still get the same stacktrace as above. .NET info:

.NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06

Runtime Environment:
OS Name: Mac OS X
OS Version: 12.3
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.201/

Host (useful for support):
Version: 6.0.3
Commit: c24d9a9

.NET SDKs installed:
6.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

@wfurt
Copy link
Member Author

wfurt commented Mar 24, 2022

yes, it is @chucker. #27727 has more detail but it is essentially same work. It is not clear at this moment if it is even feasible.

@bhoffman-splunk
Copy link

Not to add pressure, but I am more and more encountering TLS 1.3-only systems. This is especially true for internal, greenfield APIs that companies build, since they can "start secure" from the beginning. Any work around (such leveraging OpenSSL as is done in Linux) would be tremendously helpful.

@wfurt
Copy link
Member Author

wfurt commented May 5, 2022

Is there need for client, server or both? I was thinking about some fallback because to allow HTTP2 for macOS developers (#27727) We generally do that for HTTP3/Quic (preview in 6.0) so we have some parts already in a place. if we go down this path, it would probably be opt-in feature with dependency on OpenSSL from Brew/MacPorts. Would that be acceptable?

@chucker
Copy link

chucker commented May 5, 2022

@wfurt client in my case. macOS as a server is uncommon. But server might still be useful (if less important) for developers who run Kestrel on a Mac?

@wfurt
Copy link
Member Author

wfurt commented May 5, 2022

And yes, the server part would be for Mac developers (like me). Production deployment of Kestrel on macOS is unlikely IMHO.

Just to elaborate more since the use case here is different from #27727.

Aside testing and support, the biggest challenge with using OpenSSL on macOS is integration with keychain and certificate management. Using Apple's AP allows to use private keys that are non-exportable and private keys are not in core dumps. And Apple packages LibreSSL instead of OpenSSL and that is not binary compatible. So dependency management is going to be hard.

The new Apple's api makes it very difficult (and maybe impossible) for SslStream to consume. Based on testing @filipnavara did, client may be easier and there may some possibilities. The challenge would be moving forward with client if there is not solution for the server. That would effectively mean we would need to maintain both PAL layers.

@bhoffman-splunk
Copy link

bhoffman-splunk commented May 6, 2022

@wfurt sorry for not being more clear. This is for clients.

As a client, not being able to make encrypted connections to TLS 1.3-only services/servers is by far the bigger issue. I'm finding companies start a new green-field API or service, and configure it to only use TLS 1.3. Writing .NET code that can talk to services configured like this will only grow with time.

At this point I'm literally shelling out from .NET to run "ncat + openssl" via the Process class to make requests for me and get the response, which is super clumsy and slow.

@wfurt
Copy link
Member Author

wfurt commented May 6, 2022

ok. thanks for the feedback @bhoffman-splunk and @chucker. I'm not sure if this fits to 7.0 but I'll try to take another look and I'll sync up with with @filipnavara.

@filipnavara
Copy link
Member

I am gonna be away for the next week but happy to discuss it when I get back.

therealchjones added a commit to therealchjones/dotnet-tlsprinter that referenced this issue May 19, 2022
(Of note, current .NET 6 won't do TLS 1.3 on macOS. Like, at all. See
dotnet/runtime#1979)

Minor other changes
fixed an error in ExtensionType enum
@davidkaya
Copy link
Contributor

Hi, are there any plans on supporting TLS 1.3 on macOS in future .NET releases?

Our usecase is that we have customers with 10s of thousands of users using our software (.NET 6) on their macOS. The server side is deployed on a Windows Server which has only TLS 1.3 enabled. The software deployed on workstations currently cannot communicate with the server side due to the TLS 1.3 requirement.

@wfurt wfurt modified the milestones: Future, 8.0.0 Nov 16, 2022
@wfurt
Copy link
Member Author

wfurt commented Nov 16, 2022

triage: we should investigate for 8.0

@filipnavara
Copy link
Member

Here's a link to the example on how to "misuse" the framer API in Network.framework to perform client-side TLS: https://gist.github.com/filipnavara/d5fb55bdb5edcceb1981f73078b855c4

(I'll be happy to answer any questions about it once I get back from holiday at the beginning of December.)

@wfurt wfurt modified the milestones: 8.0.0, Future Jun 6, 2023
@karelz karelz modified the milestones: Future, 9.0.0 Jul 18, 2023
@lini
Copy link

lini commented Aug 22, 2023

Hi there,
It seems that TLS1.3 support for macOS clients is not coming in the .NET 8.0 release this year. Currently we have to use a third party library (Bouncy Castle) to workaround this on our mac clients, but it is not a perfect solution - e.g. the performance penalty for high network throughput threads is high.
What is the current status of this feature - is the implementation possible at all using the Apple native APIs?

@wfurt
Copy link
Member Author

wfurt commented Aug 24, 2023

It is on 9.0 wish list for me. We simply run out of time in 8.0 and it is not trivial effort. Based on prototypes from @filipnavara it should be doable at least for the client side. While not ideal I would be OK for me doing only half for now - just to make some progress. ALPN was like that for a while until #27727 plugged server side in 8.0. But in the mean time HttpClient (and others) could connect to HTTP/2 servers.

@lewing
Copy link
Member

lewing commented Oct 20, 2023

@wfurt see dotnet/installer#17588

@rzikm rzikm changed the title investigate TLS13 on MacOS Catalina investigate TLS13 on MacOS Oct 24, 2023
@rzikm
Copy link
Member

rzikm commented Oct 24, 2023

Triage: big effort, unclear implementation direction (the new API does not make it easy to get TLS messages in a buffer so that we can push them to the provided inner stream ourselves). But would be great for platform compatibility.

@elias-ik
Copy link

Its 2024, and we still can't call TSL1.3 APIs?
Any plans?

@jozefizso
Copy link

We are writing troubleshooting utility in .NET to verify our app can correctly connected using IPv4 and IPv6 and using different TLS protocols.

On macOS the app reports only TLS v1.2 connection.

Will TLS 1.3 really be ready in .NET 9?

@wfurt
Copy link
Member Author

wfurt commented Feb 24, 2024

It is still high on the priority list. However, it is not clear if it is even doable because of Apple's new AI shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests