Repository navigation
Closed
Labels
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When Kestrel is running on a FIPS-enabled Ubuntu 22.04, TLS 1.3 negotiation fails for Chromium browsers and ERR_SSL_PROTOCOL_ERROR is displayed.
Scenarios tested:
- Different clients against Kestrel server: Firefox, curl and OpenSSL s_client all work. Chrome and Chromium Edge fail.
- Different servers against Chrome: OpenSSL s_server, nginx and Python https.server+ssl work. Kestrel fails.
Expected Behavior
Chromium based browsers should be able to establish a TLS 1.3 session with Kestrel servers running on FIPS-enabled Ubuntu 22.04.
Steps To Reproduce
- Provision VM running Ubuntu 22.04
- Obtain a free Ubuntu Pro token by registering a private account at https://ubuntu.com/pro
- Enable FIPS on the VM:
sudo pro attach --no-auto-enable <token>sudo pro enable fips-preview --assume-yessudo rebootcat /proc/sys/crypto/fips_enabled<-- Ensure the output is1
- Install ssl-cert package:
sudo apt install ssl-cert
- Install Chrome on the VM:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debsudo dpkg -i google-chrome-stable_current_amd64.deb
- Install .NET 8 SDK on the VM:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.debsudo dpkg -i packages-microsoft-prod.debsudo apt updatesudo apt install dotnet-sdk-8.0
- Configure a hostname and create a snakeoil certificate:
sudo bash -c 'echo some.host.internal > /etc/hostnamesudo bash -c 'echo "127.0.0.1 some.host.internal" >> /etc/hostssudo make-ssl-cert generate-default-snakeoil --force-overwrite
- Create a ASP.NET Core webapi boilerplate application
mkdir appcd appdotnet new webapi -au None
- Add the following configurations to
appsetting.Development.jsonUrls = https://127.0.0.1:4445Kestrel:Certificates:Default:Path = /etc/ssl/certs/ssl-cert-snakeoil.pemKestrel:Certificates:Default:KeyPath = /etc/ssl/private/ssl-cert-snakeoil.keyLogging:LogLevel:Microsoft.AspeNetCore.HttpLogging.HttpLoggingMiddleware = TraceLogging:LogLevel:Microsoft.AspeNetCore.Server.Kestrel = Trace
- Start the application (with sudo for access to the certificates)
dotnet buildsudo dotnet run --no-build
- Start the Chrome browser and navigate to
https://some.host.internal:4445/weatherforecast. It should display the following:

- By forcing TLS 1.2 Chrome is able to connect:
- Observe that
openssl s_serveris able to successfully negotiate TLS 1.3 with Chrome:sudo openssl s_server -key /etc/ssl/private/ssl-cert-snakeoil.key -cert /etc/ssl/certs/ssl-cert-snakeoil.pem -accept 4446 -www- Open https://some.host.internal:4446 in Chrome. It should display a successful TLS 1.3 connection (after accepting the self-signed certificate):

Exceptions (if any)
dbug: Microsoft.Extensions.Hosting.Internal.Host[1]
Hosting starting
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher[4]
Created directory watcher for '/etc/ssl/certs'.
dbug: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher[5]
Created file watcher for '/etc/ssl/certs/ssl-cert-snakeoil.pem'.
trce: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher[11]
Added observer to file watcher for '/etc/ssl/certs/ssl-cert-snakeoil.pem'.
trce: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher[13]
File '/etc/ssl/certs/ssl-cert-snakeoil.pem' now has 1 observers.
trce: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.CertificatePathWatcher[14]
Directory '/etc/ssl/certs' now has watchers on 1 files.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://127.0.0.1:4445
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /home/vendor/dotnettest
dbug: Microsoft.Extensions.Hosting.Internal.Host[2]
Hosting started
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[39]
Connection id "0HN1JEM94TIM8" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[1]
Connection id "0HN1JEM94TIM8" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[6]
Connection id "0HN1JEM94TIM8" received FIN.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[39]
Connection id "0HN1JEM94TIM9" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[1]
Connection id "0HN1JEM94TIM9" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[6]
Connection id "0HN1JEM94TIM9" received FIN.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[39]
Connection id "0HN1JEM94TIMA" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[1]
Connection id "0HN1JEM94TIMA" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:0A0000EB:SSL routines::no application protocol
--- End of inner exception stack trace ---
at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, ReadOnlySpan`1 input, Byte[]& sendBuf, Int32& sendCount)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.OnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:0A0000EB:SSL routines::no application protocol
--- End of inner exception stack trace ---
at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, ReadOnlySpan`1 input, Byte[]& sendBuf, Int32& sendCount)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.OnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:0A0000EB:SSL routines::no application protocol
--- End of inner exception stack trace ---
at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, ReadOnlySpan`1 input, Byte[]& sendBuf, Int32& sendCount)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.OnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[2]
Connection id "0HN1JEM94TIM8" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[2]
Connection id "0HN1JEM94TIMA" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[2]
Connection id "0HN1JEM94TIM9" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HN1JEM94TIMA" sending FIN because: "The Socket transport's send loop completed gracefully."
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HN1JEM94TIM9" sending FIN because: "The Socket transport's send loop completed gracefully."
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[39]
Connection id "0HN1JEM94TIMB" accepted.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[1]
Connection id "0HN1JEM94TIMB" started.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HN1JEM94TIM8" sending FIN because: "The Socket transport's send loop completed gracefully."
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[6]
Connection id "0HN1JEM94TIMB" received FIN.
dbug: Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware[1]
Failed to authenticate HTTPS connection.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:0A0000EB:SSL routines::no application protocol
--- End of inner exception stack trace ---
at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, ReadOnlySpan`1 input, Byte[]& sendBuf, Int32& sendCount)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.OnConnectionAsync(ConnectionContext context)
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[2]
Connection id "0HN1JEM94TIMB" stopped.
dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[7]
Connection id "0HN1JEM94TIMB" sending FIN because: "The Socket transport's send loop completed gracefully."
.NET Version
8.0.200
Anything else?
Output of dotnet --info:
.NET SDK:
Version: 8.0.200
Commit: 438cab6a9d
Workload version: 8.0.200-manifests.cdf2cc8e
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.200/
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.2
Architecture: x64
Commit: 1381d5ebd2
.NET SDKs installed:
8.0.200 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
On request I can provide Wireshark captures via email.

Activity
michaelwildvarian commentedon Mar 4, 2024
As an addendum: NIST SP 800-52 R2 clearly states that systems shall support TLS 1.3 by January 1 2024.
amcasey commentedon Mar 4, 2024
This seems like it might be a question for https://github.com/dotnet/runtime. Thoughts, @CarnaViire @wfurt?
amcasey commentedon Mar 4, 2024
@michaelwildvarian Does chromium work on a non-FIPS-enabled Ubuntu 22.04 server?
Naively, this would be my first guess about what's going wrong: https://learn.microsoft.com/en-us/dotnet/core/extensions/sslstream-troubleshooting#client-and-server-do-not-possess-a-common-algorithm. I'd expect this to be visible in the wireshark trace.
michaelwildvarian commentedon Mar 5, 2024
@amcasey It also fails if Chromium is running on a non-FIPS client. But I'll check the article you linked and will get back to you.
michaelwildvarian commentedon Mar 5, 2024
@amcasey, doesn't look like this is the exact issue. What I see in Wireshark:
Client Hello

Hello Retry Request

Strangely, the retry request sent by the server contains the second cipher offered by the client (0x1302, TLS_AES_256_GCM_SHA384).
Change Cipher Spec

Fatal Alert (No application protocol)

If I do the same with
openssl s_serveras server, the Hello Retry Request specifies TLS_AES_128_GCM_SHA256 (0x1301) instead, to which the client answers with the same Change Cipher Spec message and thes_serverthen happily proceeds with the Server Hello and TLS_AES_128_GCM_SHA256 is used.So, the problem appears to be something with to do with TLS_AES_256_GCM_SHA384. But both client and server claim support, so why does the server reject?
rzikm commentedon Mar 5, 2024
@michaelwildvarian Can you send the captures to
redacted (at) microsoft.com?Edit: removed the address now that I got the mail
wfurt commentedon Mar 5, 2024
I'm wondering if the issue is that we fall-back to the .NET set @rzikm #98797 (comment)
michaelwildvarian commentedon Mar 5, 2024
@rzikm Just sent the mail.
13 remaining items
rzikm commentedon Mar 13, 2024
@michaelwildvarian does this issue prevent you from migrating to .NET8? It makes it easier for us to get the servicing approved if we have business justification.
michaelwildvarian commentedon Mar 13, 2024
@rzikm , we are already on .NET8 but have design freeze somewhere in April, early May. So far we have TLS 1.3 disabled (by configuration), but it would be great to release the product with TLS 1.3 support, so we don't have to do a patch release before it even hits the market.
rzikm commentedon Mar 13, 2024
I see, and FIPS is somehow required for your scenario?
In case you don't want to disclose something publicly here at GitHub, you can contact me privately at radekzikmund [at] microsoft.com.
KenMcC98 commentedon Mar 18, 2024
@rzikm the issue also affects us (we had duplicate issue dotnet/aspnetcore/54366 raised) and is preventing us fully rolling out a firm-wide .NET 8 base image.
Our enterprise runs OpenShift clusters that have FIPS mandated for all accounts, so anyone running the image would have to follow the workaround.
michaelwildvarian commentedon Mar 18, 2024
@KenMcC98 just to point out (and be a stickler...): The workaround breaks FIPS compliance, so it really isn't one.
michaelwildvarian commentedon Apr 2, 2024
@rzikm many thanks for getting the fix into the 8.0.5 milestone! 🙏
karelz commentedon Jun 24, 2024
Fixed in main (9.0) in PR #99357 and in 8.0.5 in PR #99670.