diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/api/config/ConfigurationAdapter.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/api/config/ConfigurationAdapter.java index 6f4bb47..dfb6b98 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/api/config/ConfigurationAdapter.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/api/config/ConfigurationAdapter.java @@ -25,14 +25,6 @@ public interface ConfigurationAdapter { Collection getPermissions(final String p0); Collection getBlacklistURLs(); - - boolean getBlacklistOfflineDownload(); - - boolean getBlacklistReplits(); - - boolean getBlacklistOriginless(); - - boolean getSimpleWhitelistEnabled(); Collection getBlacklistSimpleWhitelist(); diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java index b279f69..b3d78d6 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/Configuration.java @@ -27,6 +27,11 @@ public class Configuration { private int playerLimit; private String name; private boolean showBanType; + private boolean blacklistOfflineDownload; + private boolean blacklistReplits; + private boolean blacklistOriginless; + private boolean simpleWhitelistEnabled; + private boolean acceptBukkitConsoleCommandPacket; public Configuration() { this.timeout = 30000; @@ -53,6 +58,11 @@ public class Configuration { this.playerLimit = adapter.getInt("player_limit", this.playerLimit); this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server"); this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false); + this.blacklistOfflineDownload = adapter.getBoolean("origin_blacklist_block_offline_download", false); + this.blacklistReplits = adapter.getBoolean("origin_blacklist_block_replit_clients", false); + this.blacklistOriginless = adapter.getBoolean("origin_blacklist_block_missing_origin_header", false); + this.simpleWhitelistEnabled = adapter.getBoolean("origin_blacklist_use_simple_whitelist", false); + this.acceptBukkitConsoleCommandPacket = adapter.getBoolean("accept_bukkit_console_command_packets", false); Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined."); final Map newServers = adapter.getServers(); Preconditions.checkArgument(newServers != null && !newServers.isEmpty(), (Object) "No servers defined"); @@ -108,5 +118,25 @@ public class Configuration { public boolean shouldShowBanType() { return this.showBanType; } + + public boolean shouldBlacklistOfflineDownload() { + return blacklistOfflineDownload; + } + + public boolean shouldBlacklistReplits() { + return blacklistReplits; + } + + public boolean shouldBlacklistOriginless() { + return blacklistOriginless; + } + + public boolean isSimpleWhitelistEnabled() { + return simpleWhitelistEnabled; + } + + public boolean shouldAcceptBukkitConsoleCommandPacket() { + return acceptBukkitConsoleCommandPacket; + } } diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java index 5148678..5d3481a 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/config/YamlConfig.java @@ -17,7 +17,6 @@ import net.md_5.bungee.api.config.MOTDCacheConfiguration; import java.util.Collection; import java.net.InetSocketAddress; -import java.util.Iterator; import net.md_5.bungee.Util; import net.md_5.bungee.api.config.ServerInfo; import java.util.logging.Level; @@ -305,26 +304,6 @@ public class YamlConfig implements ConfigurationAdapter { return c; } - @Override - public boolean getBlacklistOfflineDownload() { - return this.getBoolean("origin_blacklist_block_offline_download", false); - } - - @Override - public boolean getBlacklistReplits() { - return this.getBoolean("origin_blacklist_block_replit_clients", false); - } - - @Override - public boolean getBlacklistOriginless() { - return this.getBoolean("origin_blacklist_block_missing_origin_header", false); - } - - @Override - public boolean getSimpleWhitelistEnabled() { - return this.getBoolean("origin_blacklist_use_simple_whitelist", false); - } - @Override public Collection getBlacklistSimpleWhitelist() { Collection c = this.get("origin_blacklist_simple_whitelist", null); diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index 39012fb..23db430 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -5,6 +5,8 @@ package net.md_5.bungee.connection; import java.beans.ConstructorProperties; +import java.net.InetAddress; + import net.md_5.bungee.api.event.ServerKickEvent; import java.util.Objects; import net.md_5.bungee.protocol.packet.PacketFFKick; @@ -27,6 +29,7 @@ import net.md_5.bungee.api.score.Objective; import net.md_5.bungee.protocol.packet.PacketCEScoreboardObjective; import net.md_5.bungee.protocol.packet.PacketC9PlayerListItem; import net.md_5.bungee.protocol.packet.Packet0KeepAlive; +import net.md_5.bungee.BungeeCord; import net.md_5.bungee.EntityMap; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.netty.ChannelWrapper; @@ -201,8 +204,14 @@ public class DownstreamBridge extends PacketHandler { } if (subChannel.equals("IP")) { out.writeUTF("IP"); - out.writeUTF(this.con.getAddress().getHostString()); - out.writeInt(this.con.getAddress().getPort()); + Object ob = this.con.getAttachment().get("remoteAddr"); + if(ob != null && (ob instanceof InetAddress)) { + out.writeUTF(((InetAddress)ob).getHostAddress()); + out.writeInt(this.con.getAddress().getPort()); + }else { + out.writeUTF(this.con.getAddress().getHostString()); + out.writeInt(this.con.getAddress().getPort()); + } } if (subChannel.equals("PlayerCount")) { final String target = in.readUTF(); @@ -246,6 +255,26 @@ public class DownstreamBridge extends PacketHandler { out.writeUTF("GetServer"); out.writeUTF(this.server.getInfo().getName()); } + if (subChannel.equals("EAG|GetDomain")) { + out.writeUTF("EAG|GetDomain"); + Object ob = this.con.getAttachment().get("origin"); + if(ob != null && (ob instanceof String)) { + out.writeBoolean(true); + out.writeUTF((String)ob); + }else { + out.writeBoolean(false); + out.writeUTF(""); + } + } + if (subChannel.equals("EAG|ConsoleCommand")) { + if(BungeeCord.getInstance().config.shouldAcceptBukkitConsoleCommandPacket()) { + String cmd = in.readUTF(); + bungee.getLogger().info("Connection [" + this.con.getName() + "] <-> [" + this.server.getInfo().getName() + "] executed bungee console command: " + cmd); + bungee.getPluginManager().dispatchCommand(bungee.getConsole(), cmd); + }else { + bungee.getLogger().info("Connection [" + this.con.getName() + "] <-> [" + this.server.getInfo().getName() + "] tried executing a bungee console command but \"accept_bukkit_console_command_packets\" is set to false in config.yml"); + } + } if (out != null) { final byte[] b = out.toByteArray(); if (b.length != 0) { diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/DomainBlacklist.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/DomainBlacklist.java index fc84156..fab97f1 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/DomainBlacklist.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/DomainBlacklist.java @@ -20,6 +20,7 @@ import java.util.regex.PatternSyntaxException; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.config.ConfigurationAdapter; +import net.md_5.bungee.config.Configuration; public class DomainBlacklist { @@ -108,12 +109,13 @@ public class DomainBlacklist { regexLocalBlacklist.clear(); regexBlacklistReplit.clear(); simpleWhitelist.clear(); - ConfigurationAdapter cfg = bg.getConfigurationAdapter(); - blacklistSubscriptions = cfg.getBlacklistURLs(); - blockOfflineDownload = cfg.getBlacklistOfflineDownload(); - blockAllReplits = cfg.getBlacklistReplits(); - simpleWhitelistMode = cfg.getSimpleWhitelistEnabled(); - simpleWhitelist.addAll(cfg.getBlacklistSimpleWhitelist()); + ConfigurationAdapter cfg2 = bg.getConfigurationAdapter(); + Configuration cfg = bg.config; + blacklistSubscriptions = cfg2.getBlacklistURLs(); + blockOfflineDownload = cfg.shouldBlacklistOfflineDownload(); + blockAllReplits = cfg.shouldBlacklistReplits(); + simpleWhitelistMode = cfg.isSimpleWhitelistEnabled(); + simpleWhitelist.addAll(cfg2.getBlacklistSimpleWhitelist()); lastLocalUpdate = 0l; lastUpdate = System.currentTimeMillis() - updateRate - 1000l; update(); diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/WebSocketListener.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/WebSocketListener.java index 6812d85..090ba6f 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/WebSocketListener.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/WebSocketListener.java @@ -58,7 +58,7 @@ public class WebSocketListener extends WebSocketServer { this.info = info; this.bungeeProxy = sock; this.bungeeCord = bungeeCord; - this.blockOriginless = bungeeCord.getConfigurationAdapter().getBlacklistOriginless(); + this.blockOriginless = ((BungeeCord)bungeeCord).config.shouldBlacklistOriginless(); this.ratelimitIP = info.getRateLimitIP(); this.ratelimitLogin = info.getRateLimitLogin(); this.ratelimitMOTD = info.getRateLimitMOTD(); diff --git a/stable-download/java/bungee_command/bungee-dist.jar b/stable-download/java/bungee_command/bungee-dist.jar index c7dc67b..cadb927 100644 Binary files a/stable-download/java/bungee_command/bungee-dist.jar and b/stable-download/java/bungee_command/bungee-dist.jar differ diff --git a/stable-download/stable-download-new.zip b/stable-download/stable-download-new.zip index 7a2c89d..352ba56 100644 Binary files a/stable-download/stable-download-new.zip and b/stable-download/stable-download-new.zip differ diff --git a/stable-download/stable-download_repl.zip b/stable-download/stable-download_repl.zip index 6e35be0..5db028c 100644 Binary files a/stable-download/stable-download_repl.zip and b/stable-download/stable-download_repl.zip differ