1
0

Added an explicit setting for allowing BungeeCord handshake.

This commit is contained in:
madmaxoft 2014-09-17 20:55:46 +02:00
parent ccaec8f424
commit 16e9deba8d
3 changed files with 16 additions and 1 deletions

View File

@ -104,7 +104,7 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd
// If BC is setup with ip_forward == true, it sends additional data in the login packet's ServerAddress field: // If BC is setup with ip_forward == true, it sends additional data in the login packet's ServerAddress field:
// hostname\00ip-address\00uuid\00profile-properties-as-json // hostname\00ip-address\00uuid\00profile-properties-as-json
AStringVector Params; AStringVector Params;
if (SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) if (cRoot::Get()->GetServer()->ShouldAllowBungeeCord() && SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4))
{ {
LOGD("Player at %s connected via BungeeCord", Params[1].c_str()); LOGD("Player at %s connected via BungeeCord", Params[1].c_str());
m_ServerAddress = Params[0]; m_ServerAddress = Params[0];

View File

@ -260,6 +260,13 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
m_ServerID.resize(16, '0'); m_ServerID.resize(16, '0');
} }
// Check if both BungeeCord and online mode are on, if so, warn the admin:
m_ShouldAllowBungeeCord = a_SettingsIni.GetValueSetB("Authentication", "AllowBungeeCord", false);
if (m_ShouldAllowBungeeCord && m_ShouldAuthenticate)
{
LOGWARNING("WARNING: BungeeCord is allowed and server set to online mode. This is unsafe and will not work properly. Disable either authentication or BungeeCord in settings.ini.");
}
m_ShouldLoadOfflinePlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false); m_ShouldLoadOfflinePlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false);
m_ShouldLoadNamedPlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadNamedPlayerData", true); m_ShouldLoadNamedPlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadNamedPlayerData", true);

View File

@ -131,6 +131,11 @@ public: // tolua_export
Loaded from the settings.ini [PlayerData].LoadNamedPlayerData setting. */ Loaded from the settings.ini [PlayerData].LoadNamedPlayerData setting. */
bool ShouldLoadNamedPlayerData(void) const { return m_ShouldLoadNamedPlayerData; } bool ShouldLoadNamedPlayerData(void) const { return m_ShouldLoadNamedPlayerData; }
/** Returns true if BungeeCord logins (that specify the player's UUID) are allowed.
Read from settings, admins should set this to true only when they chain to BungeeCord,
it makes the server vulnerable to identity theft through direct connections. */
bool ShouldAllowBungeeCord(void) const { return m_ShouldAllowBungeeCord; }
private: private:
friend class cRoot; // so cRoot can create and destroy cServer friend class cRoot; // so cRoot can create and destroy cServer
@ -231,6 +236,9 @@ private:
Loaded from the settings.ini [PlayerData].LoadNamedPlayerData setting. */ Loaded from the settings.ini [PlayerData].LoadNamedPlayerData setting. */
bool m_ShouldLoadNamedPlayerData; bool m_ShouldLoadNamedPlayerData;
/** True if BungeeCord handshake packets (with player UUID) should be accepted. */
bool m_ShouldAllowBungeeCord;
cServer(void); cServer(void);