ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
160 stars 76 forks source link

MySQL with SSL? #799

Closed jpenguin closed 2 months ago

jpenguin commented 2 months ago

Trying to us a DB from aiven.io

MySQL line given is mysql://*****@*****.d.aivencloud.com:15555/defaultdb?ssl-mode=REQUIRED

Type: AuthenticationException Source: System Message: Authentication failed, see inner exception. Trace: at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0004b] in <aa8bc4cb919a4978832b583874d62dd6>:0 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient(string,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Security.Authentication.SslProtocols,bool) at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00006] in <aa8bc4cb919a4978832b583874d62dd6>:0 at MySql.Data.MySqlClient.NativeDriver.StartSSL () [0x0002f] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.NativeDriver.Open () [0x002c5] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.Driver.Open () [0x0000b] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x0004d] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0x00000] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0x00083] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x00042] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.MySqlPool.GetConnection () [0x0001c] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0016c] in <2c8fc0407a5848dfa91f594842a803e7>:0 at MCGalaxy.SQL.MySQLConnection.Open () [0x00000] in <68bee6bf385a45f2b0e603e2988342b6>:0 at MCGalaxy.SQL.IDatabaseBackend.Iterate (System.String sql, System.Object[] parameters, MCGalaxy.SQL.ReaderCallback callback) [0x00009] in <68bee6bf385a45f2b0e603e2988342b6>:0 at MCGalaxy.SQL.Database.Do (System.String sql, System.Boolean createDB, MCGalaxy.SQL.ReaderCallback callback, System.Object[] args) [0x0000f] in <68bee6bf385a45f2b0e603e2988342b6>:0 Type: MonoBtlsException Source: System Message: Ssl error:1000042e:SSL routines:OPENSSL_internal:TLSV1_ALERT_PROTOCOL_VERSION at /usr/src/debug/mono/mono/external/boringssl/ssl/tls_record.c:462 Trace: at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00048] in <aa8bc4cb919a4978832b583874d62dd6>:0 at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in <aa8bc4cb919a4978832b583874d62dd6>:0 at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool) at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in <aa8bc4cb919a4978832b583874d62dd6>:0 at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in <aa8bc4cb919a4978832b583874d62dd6>:0

Can I enable SSL?

UnknownShadow200 commented 2 months ago

TLSV1_ALERT_PROTOCOL_VERSION - most likely cause is incompatible TLS version support between the MySQL client and the server

For backwards compatibility, MCGalaxy includes a much older version of MySQL.Data which I think only enables supports for TLS 1.0 image

You could try downloading a more updated version from https://downloads.mysql.com/archives/c-net/ (In the Operating System dropdown, make sure to select '.NET & Mono') and seeing if that works

jpenguin commented 2 months ago

I'm doing some testing now on my local pc

jpenguin commented 2 months ago

Put mysql-connector-net-8.3.0-noinstall/v4.6.2/MySql.Data.dll on my server, seems to work