Skip to content

Commit

Permalink
Add option to allow Forge clients through host keys.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wizjany committed Dec 23, 2016
1 parent 46cca2b commit 67ece5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -91,6 +91,7 @@ public class ConfigurationManager {
public boolean keepUnresolvedNames;

@Unreported public Map<String, String> hostKeys = new HashMap<String, String>();
public boolean hostKeysAllowFMLClients;

/**
* Region Storage Configuration method, and config values
Expand Down Expand Up @@ -169,6 +170,7 @@ public void load() {
hostKeys.put(key.toLowerCase(), value);
}
}
hostKeysAllowFMLClients = config.getBoolean("security.host-keys-allow-forge-clients", false);

// ====================================================================
// Region store drivers
Expand Down
Expand Up @@ -183,7 +183,8 @@ public void onPlayerLogin(PlayerLoginEvent event) {
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,
"You did not join with the valid host key!");
log.warning("WorldGuard host key check: " +
Expand Down

1 comment on commit 67ece5c

@mishyy
Copy link
Contributor

@mishyy mishyy commented on 67ece5c Jan 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually forked and added something similar to this a few months back on another account but I lost access so I never got around to submitting a PR, glad to see someone did.

Please sign in to comment.