diff --git a/docs/config.md b/docs/config.md index 6d01f5e4..3edfd611 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1,5 +1,5 @@ - + ## AuthMe Configuration The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder, @@ -24,6 +24,9 @@ DataSource: # We would not recommend to set this option to false. # Set this option to false at your own risk if and only if you know what you're doing mySQLCheckServerCertificate: true + # Authorize client to retrieve RSA server public key. + # Advanced option, ignore if you don't know what it means. + mySQLAllowPublicKeyRetrieval: true # Username to connect to the MySQL database mySQLUsername: authme # Password to connect to the MySQL database @@ -590,4 +593,4 @@ To change settings on a running server, save your changes to config.yml and use --- -This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Dec 25 15:40:26 CET 2021 +This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Mon Jul 18 13:02:11 CEST 2022 diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index e55a24fd..465084a1 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -39,6 +39,7 @@ public class MySQL extends AbstractSqlDataSource { private boolean useSsl; private boolean serverCertificateVerification; + private boolean allowPublicKeyRetrieval; private String host; private String port; private String username; @@ -118,6 +119,7 @@ public class MySQL extends AbstractSqlDataSource { this.maxLifetime = settings.getProperty(DatabaseSettings.MYSQL_CONNECTION_MAX_LIFETIME); this.useSsl = settings.getProperty(DatabaseSettings.MYSQL_USE_SSL); this.serverCertificateVerification = settings.getProperty(DatabaseSettings.MYSQL_CHECK_SERVER_CERTIFICATE); + this.allowPublicKeyRetrieval = settings.getProperty(DatabaseSettings.MYSQL_ALLOW_PUBLIC_KEY_RETRIEVAL); } /** @@ -147,6 +149,9 @@ public class MySQL extends AbstractSqlDataSource { // Disabling server certificate verification on need if (!serverCertificateVerification) { ds.addDataSourceProperty("verifyServerCertificate", String.valueOf(false)); + } // Disabling server certificate verification on need + if (allowPublicKeyRetrieval) { + ds.addDataSourceProperty("allowPublicKeyRetrieval", String.valueOf(true)); } // Encoding diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java index c0c570c2..9f299263 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java @@ -37,6 +37,11 @@ public final class DatabaseSettings implements SettingsHolder { public static final Property MYSQL_CHECK_SERVER_CERTIFICATE = newProperty( "DataSource.mySQLCheckServerCertificate", true ); + @Comment({"Authorize client to retrieve RSA server public key.", + "Advanced option, ignore if you don't know what it means."}) + public static final Property MYSQL_ALLOW_PUBLIC_KEY_RETRIEVAL = + newProperty( "DataSource.mySQLAllowPublicKeyRetrieval", true ); + @Comment("Username to connect to the MySQL database") public static final Property MYSQL_USERNAME = newProperty("DataSource.mySQLUsername", "authme");