KitsuneLab-Development / K4-System

K4-Systems is a plugin that enhances the server with features such as a playtime tracker, statistical records, and player ranks. Additionally, it includes VIP functions and admin commands for added functionality.
GNU General Public License v3.0
104 stars 35 forks source link

[BUG] Mysql connection with port gives an error #209

Closed alessskeno closed 4 weeks ago

alessskeno commented 4 weeks ago

Describe the bug EROR] (cssharp:PluginManager) Failed to load plugin from /home/container/game/csgo/addons/counterstrikesharp/plugins/K4-System/K4-System.dll System.AggregateException: One or more errors occurred. (Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True.) ---> MySqlConnector.MySqlException (0x80004005): Authentication method 'caching_sha2password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True. at MySqlConnector.Core.ServerSession.GetRsaPublicKeyAsync(String switchRequestName, ConnectionSettings cs, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ServerSession.cs:line 814 at MySqlConnector.Core.ServerSession.SwitchAuthenticationAsync(ConnectionSettings cs, String password, PayloadData payload, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ServerSession.cs:line 699 at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, MySqlConnection connection, Int64 startingTimestamp, ILoadBalancer loadBalancer, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ServerSession.cs:line 532 at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action4 logMessage, Int64 startingTimestamp, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 427 at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action4 logMessage, Int64 startingTimestamp, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ConnectionPool.cs:line 432 at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ConnectionPool.cs:line 109 at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/Core/ConnectionPool.cs:line 142 at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int64 startingTimestamp, Activity activity, Nullable`1 ioBehavior, CancellationToken cancellationToken) in //src/MySqlConnector/MySqlConnection.cs:line 1056 at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 556 at K4System.Plugin.CreateMultipleTablesAsync() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at K4System.Plugin.Load(Boolean hotReload) at CounterStrikeSharp.API.Core.Plugin.PluginContext.Load(Boolean hotReload) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/PluginContext.cs:line 218 at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.LoadPlugin(String path) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 125 at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.Load() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 93

To Reproduce "database-settings": { "host": "IP", "username": "u1_username", "database": "s1_k4-system", "password": "secure-password", "port": 30189, "sslmode": "none", "table-prefix": "", "lvlranks-table-name": "lvl_base" },

Expected behavior I expect to plugin successfully connect to database with port

Logs/Screenshots image

Environment (please complete the following information):

mrc4tt commented 4 weeks ago

Could you try playing with the sslmode? You can try setting it from none to VerifyFull

K4ryuu commented 4 weeks ago

I am closing this issue because @mrc4tt has already provided a solution. The problem can be resolved by adjusting the sslmode setting, which is a configuration on your end, not an issue with the plugin. (The error literally says "Either use a secure connection...")

Here are the available MySQL SSL modes you can use:

I recommend trying the preferred and VerifyFull modes first, as these are the most relevant for making secure connections.

Both modes should work, but based on report, one of these is likely to resolve the issue.