Runtime: SSL Authentication Error unsupported protocol

Created on 30 Aug 2019  路  7Comments  路  Source: dotnet/runtime

I had checked this issue, change the environment and doesn't work.

Version Used:
mysqlconnector version: 0.56.0
net core sdk version: 3.0.100-preview8-013656
os version: ubuntu 16.04.4 LTS x64

Exception

ERROR 2019-08-30 14:32:36,330 [45   ] ing.Impl.DefaultProcessingCommandHandler -  MySqlException raised when RoasterCommandHandler handling RoasterAcceptSocializerFollow. commandId:5d6933833cf7ac0001cff78e_RoasterAcceptSocializerFollow, aggregateRootId:190759290141679616
MySql.Data.MySqlClient.MySqlException (0x80004005): SSL Authentication Error
 ---> 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:1425F102:SSL routines: ssl_choose_client_version:unsupported protocol
   --- End of inner exception stack trace ---
   at Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, Byte[] recvBuf, Int32 recvOffset, Int32 recvCount, Byte[]& sendBuf, Int32& sendCount)
   at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteContext& context, ArraySegment`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__64_2(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at MySqlConnector.Core.ServerSession.InitSslAsync(ProtocolCapabilities serverCapabilities, ConnectionSettings cs, SslProtocols sslProtocols, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 1170
   at MySqlConnector.Core.ServerSession.InitSslAsync(ProtocolCapabilities server
Capabilities, ConnectionSettings cs, SslProtocols sslProtocols, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 1197
   at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 
335
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 112
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 141
   at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line
 585
   at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 306
area-System.Net.Security os-linux

Most helpful comment

@bartonjs is this a 3.0 issue?

It sounds like the OS is configuring the client defaults to be more secure than the MySQL server endpoint is using. I don't think there's any product bug here. We could take the position of "we'll make the defaults be more permissive", but that goes against our goal of "make the OS be in charge of the defaults".

The MySQL server should upgrade to TLS 1.2, since it's been out for 11 years.

All 7 comments

Set openssl.cnf MinProtocol = TLSv1.0 solved the problem.

How exactly is this variable set? I had a similar problem dotnet/corefx#40725

@bartonjs is this a 3.0 issue?

@bartonjs is this a 3.0 issue?

It sounds like the OS is configuring the client defaults to be more secure than the MySQL server endpoint is using. I don't think there's any product bug here. We could take the position of "we'll make the defaults be more permissive", but that goes against our goal of "make the OS be in charge of the defaults".

The MySQL server should upgrade to TLS 1.2, since it's been out for 11 years.

Changing milestone then

I use this docker conaitner(mcr.microsoft.com/dotnet/core/runtime:3.0-buster-slim), the default TLS version is 1.2, but the maximum TLS version supported for mysql is 1.1, so met this problem. It's not a bug, a security level setting problem.

should this be closed then @Caskia ?

Was this page helpful?
0 / 5 - 0 ratings