Core/Network: Add option to allow/disallow saving IP addresses to database (#26723)
Add config option AllowLoggingIPAddressesInDatabase to authserver and worldserver to specify if IP addresses can be logged or not to the database (cherry picked from commit 68bf7e6d12e1689d688db32c05066b8832922c67)
This commit is contained in:
@@ -207,6 +207,15 @@ MySQLExecutable = ""
|
||||
|
||||
IPLocationFile = ""
|
||||
|
||||
#
|
||||
# AllowLoggingIPAddressesInDatabase
|
||||
# Description: Specifies if IP addresses can be logged to the database
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
#
|
||||
|
||||
AllowLoggingIPAddressesInDatabase = 1
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
@@ -740,12 +740,17 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
|
||||
// only first 16 bytes of the hmac are used
|
||||
memcpy(_encryptKey.data(), encryptKeyGen.GetDigest().data(), 16);
|
||||
|
||||
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->RealmJoinTicket);
|
||||
LoginDatabase.Execute(stmt);
|
||||
// This also allows to check for possible "hack" attempts on account
|
||||
LoginDatabasePreparedStatement* stmt = nullptr;
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE))
|
||||
{
|
||||
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->RealmJoinTicket);
|
||||
LoginDatabase.Execute(stmt);
|
||||
// This also allows to check for possible "hack" attempts on account
|
||||
}
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_INFO_CONTINUED_SESSION);
|
||||
stmt->setBinary(0, _sessionKey);
|
||||
@@ -844,13 +849,16 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
|
||||
|
||||
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", authSession->RealmJoinTicket.c_str(), address.c_str());
|
||||
|
||||
// Update the last_ip in the database as it was successful for login
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP);
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE))
|
||||
{
|
||||
// Update the last_ip in the database as it was successful for login
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_IP);
|
||||
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->RealmJoinTicket);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->RealmJoinTicket);
|
||||
|
||||
LoginDatabase.Execute(stmt);
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
// At this point, we can safely hook a successful login
|
||||
sScriptMgr->OnAccountLogin(account.Game.Id);
|
||||
|
||||
@@ -1685,6 +1685,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_float_configs[CONFIG_CALL_TO_ARMS_10_PCT] = sConfigMgr->GetFloatDefault("Pvp.FactionBalance.Pct10", 0.7f);
|
||||
m_float_configs[CONFIG_CALL_TO_ARMS_20_PCT] = sConfigMgr->GetFloatDefault("Pvp.FactionBalance.Pct20", 0.8f);
|
||||
|
||||
// Specifies if IP addresses can be logged to the database
|
||||
m_bool_configs[CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE] = sConfigMgr->GetBoolDefault("AllowLoggingIPAddressesInDatabase", true, true);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
if (reload)
|
||||
sScriptMgr->OnConfigLoad(reload);
|
||||
|
||||
@@ -193,6 +193,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_CHECK_GOBJECT_LOS,
|
||||
CONFIG_RESPAWN_DYNAMIC_ESCORTNPC,
|
||||
CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID,
|
||||
CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE,
|
||||
CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
@@ -1356,6 +1356,15 @@ FeatureSystem.CharacterUndelete.Enabled = 0
|
||||
|
||||
FeatureSystem.CharacterUndelete.Cooldown = 2592000
|
||||
|
||||
#
|
||||
# AllowLoggingIPAddressesInDatabase
|
||||
# Description: Specifies if IP addresses can be logged to the database
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
#
|
||||
|
||||
AllowLoggingIPAddressesInDatabase = 1
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user