From 627cc64eeaa37fe93a3b3f4d6cec3a7374e957bb Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 27 Sep 2024 18:19:29 +0200 Subject: [PATCH] Adjust HAProxy's existance to log for console masters (#11433) --- .../0701-Add-support-for-Proxy-Protocol.patch | 17 +++++++++++++++-- ...ded-API-to-get-player-ha-proxy-address.patch | 4 ++-- ...rk-Manager-and-add-advanced-packet-sup.patch | 4 ++-- ...elocity-compression-and-cipher-natives.patch | 6 +++--- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/patches/server/0701-Add-support-for-Proxy-Protocol.patch b/patches/server/0701-Add-support-for-Proxy-Protocol.patch index aca878218f..51906f887a 100644 --- a/patches/server/0701-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0701-Add-support-for-Proxy-Protocol.patch @@ -17,10 +17,23 @@ index 688e901b75e95941e0101cc7d0c4effa7993cf3f..9de7a09c5f1b23754a2823978fa3ff21 implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion implementation("org.ow2.asm:asm-commons:9.7") diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index c63c194c44646e6bc1a59426552787011fc2ced5..96355e1da8feb6687ea0069dda4a82fcd7e25e8a 100644 +index c63c194c44646e6bc1a59426552787011fc2ced5..c62df32af11636ad408b584fcc590590ce4fb0d0 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -123,6 +123,29 @@ public class ServerConnectionListener { +@@ -104,6 +104,12 @@ public class ServerConnectionListener { + ServerConnectionListener.LOGGER.info("Using default channel type"); + } + ++ // Paper start - Warn people with console access that HAProxy is in use. ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.proxyProtocol) { ++ ServerConnectionListener.LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled."); ++ } ++ // Paper end - Warn people with console access that HAProxy is in use. ++ + this.channels.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer() { + protected void initChannel(Channel channel) { + try { +@@ -123,6 +129,29 @@ public class ServerConnectionListener { Connection object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); // CraftBukkit - decompile error //ServerConnectionListener.this.connections.add(object); // Paper diff --git a/patches/server/0962-Added-API-to-get-player-ha-proxy-address.patch b/patches/server/0962-Added-API-to-get-player-ha-proxy-address.patch index 3f8c3f63b4..a21e9c27e9 100644 --- a/patches/server/0962-Added-API-to-get-player-ha-proxy-address.patch +++ b/patches/server/0962-Added-API-to-get-player-ha-proxy-address.patch @@ -17,10 +17,10 @@ index ea16dfa718b526d6520d7fcfc21d28f972f1f2bf..4b9da6e2140b14f1e56056f5e9e94b21 public Connection(PacketFlow side) { this.receiving = side; diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..1f696644b958538e9f5d568a2e4bba69d74a191e 100644 +index c62df32af11636ad408b584fcc590590ce4fb0d0..baed0bb80d44973f9323bbe536551182979caff2 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -138,6 +138,13 @@ public class ServerConnectionListener { +@@ -144,6 +144,13 @@ public class ServerConnectionListener { Connection connection = (Connection) channel.pipeline().get("packet_handler"); connection.address = socketaddr; diff --git a/patches/server/0987-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0987-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index f51a3d8642..e601a7c5a2 100644 --- a/patches/server/0987-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0987-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -369,7 +369,7 @@ index 82fc12ffbd1585b4a8d09a025914830af77b0f8d..c9d283b7fc9ede79dc6cbc39dfc9e7ae + // Paper end } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 1f696644b958538e9f5d568a2e4bba69d74a191e..2929d9a2efa9669781b6773161db7c5f968c2544 100644 +index baed0bb80d44973f9323bbe536551182979caff2..4abe4f75956e4c16f8b4e0b2f77ad64d7914aa65 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -63,10 +63,12 @@ public class ServerConnectionListener { @@ -385,7 +385,7 @@ index 1f696644b958538e9f5d568a2e4bba69d74a191e..2929d9a2efa9669781b6773161db7c5f } } // Paper end - prevent blocking on adding a new connection while the server is ticking -@@ -112,6 +114,7 @@ public class ServerConnectionListener { +@@ -118,6 +120,7 @@ public class ServerConnectionListener { ; } diff --git a/patches/server/0996-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0996-Use-Velocity-compression-and-cipher-natives.patch index bfac334a58..5b7853e7ff 100644 --- a/patches/server/0996-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0996-Use-Velocity-compression-and-cipher-natives.patch @@ -336,12 +336,12 @@ index 7dc7aeb1d94d26cf54bd4e4ab13972a3a60c1f98..90a2c61c42cba7e38f167eccdd7a951a this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper - Add Channel initialization listeners } else { diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 2929d9a2efa9669781b6773161db7c5f968c2544..8aff5129f85ab5729b3da2e465871be62d15bdf2 100644 +index 4abe4f75956e4c16f8b4e0b2f77ad64d7914aa65..3a9e25b436f366fffe08c3b0c1fce11ed42ee646 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -106,6 +106,11 @@ public class ServerConnectionListener { - ServerConnectionListener.LOGGER.info("Using default channel type"); +@@ -112,6 +112,11 @@ public class ServerConnectionListener { } + // Paper end - Warn people with console access that HAProxy is in use. + // Paper start - Use Velocity cipher + ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");