Core/Network: Add option to allow/disallow saving IP addresses to database
Port From (https://github.com/TrinityCore/TrinityCore/commit/5afa32e9a7e944d5fbee620c31bf6e2939ec7c5d)
This commit is contained in:
@@ -67,6 +67,30 @@ WrongPass.BanTime = 600
|
||||
|
||||
WrongPass.BanType = 0
|
||||
|
||||
#
|
||||
# WrongPass.Logging
|
||||
# Description: Additionally log attempted wrong password logging
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
WrongPass.Logging = 0
|
||||
|
||||
#
|
||||
# BanExpiryCheckInterval
|
||||
# Description: Time (in seconds) between checks for expired bans
|
||||
# Default: 60
|
||||
|
||||
BanExpiryCheckInterval = 60
|
||||
|
||||
#
|
||||
# AllowLoggingIPAddressesInDatabase
|
||||
# Description: Specifies if IP addresses can be logged to the database
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
#
|
||||
|
||||
AllowLoggingIPAddressesInDatabase = 1
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
@@ -1366,6 +1366,7 @@ namespace Framework.Constants
|
||||
AhbotUpdateInterval,
|
||||
AllTaxiPaths,
|
||||
AllowGmGroup,
|
||||
AllowLogginIpAddressesInDatabase,
|
||||
AllowTwoSideInteractionAuction,
|
||||
AllowTwoSideInteractionCalendar,
|
||||
AllowTwoSideInteractionChannel,
|
||||
|
||||
@@ -543,13 +543,17 @@ namespace Game.Networking
|
||||
// only first 16 bytes of the hmac are used
|
||||
Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 16);
|
||||
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.AllowLogginIpAddressesInDatabase))
|
||||
{
|
||||
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_ATTEMPT_IP);
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_ATTEMPT_IP);
|
||||
stmt.AddValue(0, address.Address.ToString());
|
||||
stmt.AddValue(1, authSession.RealmJoinTicket);
|
||||
|
||||
DB.Login.Execute(stmt);
|
||||
// This also allows to check for possible "hack" attempts on account
|
||||
}
|
||||
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_INFO_CONTINUED_SESSION);
|
||||
stmt.AddValue(0, _sessionKey);
|
||||
@@ -638,11 +642,14 @@ namespace Game.Networking
|
||||
|
||||
Log.outDebug(LogFilter.Network, "WorldSocket:HandleAuthSession: Client '{0}' authenticated successfully from {1}.", authSession.RealmJoinTicket, address);
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.AllowLogginIpAddressesInDatabase))
|
||||
{
|
||||
// Update the last_ip in the database
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_IP);
|
||||
stmt.AddValue(0, address.Address.ToString());
|
||||
stmt.AddValue(1, authSession.RealmJoinTicket);
|
||||
DB.Login.Execute(stmt);
|
||||
}
|
||||
|
||||
_worldSession = new WorldSession(account.game.Id, authSession.RealmJoinTicket, account.battleNet.Id, this, account.game.Security, (Expansion)account.game.Expansion,
|
||||
mutetime, account.game.OS, account.battleNet.Locale, account.game.Recruiter, account.game.IsRectuiter);
|
||||
|
||||
@@ -1008,6 +1008,9 @@ namespace Game
|
||||
Values[WorldCfg.CallToArms10Pct] = GetDefaultValue("Pvp.FactionBalance.Pct10", 0.7f);
|
||||
Values[WorldCfg.CallToArms20Pct] = GetDefaultValue("Pvp.FactionBalance.Pct20", 0.8f);
|
||||
|
||||
// Specifies if IP addresses can be logged to the database
|
||||
Values[WorldCfg.AllowLogginIpAddressesInDatabase] = GetDefaultValue("AllowLoggingIPAddressesInDatabase", true);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
if (reload)
|
||||
Global.ScriptMgr.OnConfigLoad(reload);
|
||||
|
||||
@@ -1311,6 +1311,15 @@ FeatureSystem.CharacterUndelete.Cooldown = 2592000
|
||||
|
||||
FeatureSystem.WarMode.Enabled = 0
|
||||
|
||||
#
|
||||
# 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