3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 06:30:16 +02:00

move force key checking into a system property (#736)

Dieser Commit ist enthalten in:
Shane Freeder 2022-06-09 12:07:24 +01:00 committet von GitHub
Ursprung da52d09338
Commit 3501969960
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -315,6 +315,9 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
} }
commandManager.setAnnounceProxyCommands(configuration.isAnnounceProxyCommands()); commandManager.setAnnounceProxyCommands(configuration.isAnnounceProxyCommands());
if (System.getProperty("auth.forceSecureProfiles") == null) {
System.setProperty("auth.forceSecureProfiles", String.valueOf(configuration.isForceKeyAuthentication()));
}
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to read/load/save your velocity.toml. The server will shut down.", e); logger.error("Unable to read/load/save your velocity.toml. The server will shut down.", e);
LogManager.shutdown(); LogManager.shutdown();

Datei anzeigen

@ -68,12 +68,14 @@ public class InitialLoginSessionHandler implements MinecraftSessionHandler {
private @MonotonicNonNull ServerLogin login; private @MonotonicNonNull ServerLogin login;
private byte[] verify = EMPTY_BYTE_ARRAY; private byte[] verify = EMPTY_BYTE_ARRAY;
private LoginState currentState = LoginState.LOGIN_PACKET_EXPECTED; private LoginState currentState = LoginState.LOGIN_PACKET_EXPECTED;
private boolean forceKeyAuthentication;
InitialLoginSessionHandler(VelocityServer server, MinecraftConnection mcConnection, InitialLoginSessionHandler(VelocityServer server, MinecraftConnection mcConnection,
LoginInboundConnection inbound) { LoginInboundConnection inbound) {
this.server = Preconditions.checkNotNull(server, "server"); this.server = Preconditions.checkNotNull(server, "server");
this.mcConnection = Preconditions.checkNotNull(mcConnection, "mcConnection"); this.mcConnection = Preconditions.checkNotNull(mcConnection, "mcConnection");
this.inbound = Preconditions.checkNotNull(inbound, "inbound"); this.inbound = Preconditions.checkNotNull(inbound, "inbound");
this.forceKeyAuthentication = Boolean.getBoolean("auth.forceSecureProfiles");
} }
@Override @Override
@ -92,7 +94,7 @@ public class InitialLoginSessionHandler implements MinecraftSessionHandler {
return true; return true;
} }
} else if (mcConnection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0 } else if (mcConnection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0
&& server.getConfiguration().isForceKeyAuthentication()) { && forceKeyAuthentication) {
inbound.disconnect(Component.translatable("multiplayer.disconnect.missing_public_key")); inbound.disconnect(Component.translatable("multiplayer.disconnect.missing_public_key"));
return true; return true;
} }