Permalink
Browse files

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.
  • Loading branch information...
wizjany committed Dec 23, 2016
1 parent 46cca2b commit 67ece5c5d709baca5c35f40e7c00ba76d9caabef
@@ -91,6 +91,7 @@
public boolean keepUnresolvedNames;
@Unreported public Map<String, String> hostKeys = new HashMap<String, String>();
public boolean hostKeysAllowFMLClients;
/**
* Region Storage Configuration method, and config values
@@ -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
@@ -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: " +

1 comment on commit 67ece5c

@Mishyy

This comment has been minimized.

Show comment
Hide comment
@Mishyy

Mishyy Jan 8, 2017

Contributor

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.

Contributor

Mishyy commented on 67ece5c Jan 8, 2017

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.