mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-30 06:23:49 +01:00
Add option to allow Forge clients through host keys.
Setting "security.host-keys-allow-forge-clients" will accept the "\0FML\0" identifier that Forge clients add to their host name when connecting to a server. Fixes WORLDGUARD-3537, WORLDGUARD-3596.
This commit is contained in:
parent
46cca2b950
commit
67ece5c5d7
@ -91,6 +91,7 @@ public class ConfigurationManager {
|
|||||||
public boolean keepUnresolvedNames;
|
public boolean keepUnresolvedNames;
|
||||||
|
|
||||||
@Unreported public Map<String, String> hostKeys = new HashMap<String, String>();
|
@Unreported public Map<String, String> hostKeys = new HashMap<String, String>();
|
||||||
|
public boolean hostKeysAllowFMLClients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region Storage Configuration method, and config values
|
* Region Storage Configuration method, and config values
|
||||||
@ -169,6 +170,7 @@ public void load() {
|
|||||||
hostKeys.put(key.toLowerCase(), value);
|
hostKeys.put(key.toLowerCase(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hostKeysAllowFMLClients = config.getBoolean("security.host-keys-allow-forge-clients", false);
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
// Region store drivers
|
// Region store drivers
|
||||||
|
@ -183,7 +183,8 @@ public void onPlayerLogin(PlayerLoginEvent event) {
|
|||||||
hostname = hostname.substring(0, colonIndex);
|
hostname = hostname.substring(0, colonIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hostname.equals(hostKey)) {
|
if (!hostname.equals(hostKey)
|
||||||
|
&& !(cfg.hostKeysAllowFMLClients && hostname.equals(hostKey + "\u0000FML\u0000"))) {
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||||
"You did not join with the valid host key!");
|
"You did not join with the valid host key!");
|
||||||
log.warning("WorldGuard host key check: " +
|
log.warning("WorldGuard host key check: " +
|
||||||
|
Loading…
Reference in New Issue
Block a user