diff --git a/Source/BNetServer/BNetServer.conf.dist b/Source/BNetServer/BNetServer.conf.dist index 8e8c77f42..7aed4b5c9 100644 --- a/Source/BNetServer/BNetServer.conf.dist +++ b/Source/BNetServer/BNetServer.conf.dist @@ -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 + # ################################################################################################### diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 9eb685fda..ae9a50173 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -1366,6 +1366,7 @@ namespace Framework.Constants AhbotUpdateInterval, AllTaxiPaths, AllowGmGroup, + AllowLogginIpAddressesInDatabase, AllowTwoSideInteractionAuction, AllowTwoSideInteractionCalendar, AllowTwoSideInteractionChannel, diff --git a/Source/Game/Networking/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs index a59034abe..9e857c8bf 100644 --- a/Source/Game/Networking/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -543,13 +543,17 @@ namespace Game.Networking // only first 16 bytes of the hmac are used Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 16); - // 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.AddValue(0, address.Address.ToString()); - stmt.AddValue(1, authSession.RealmJoinTicket); + PreparedStatement stmt = null; - DB.Login.Execute(stmt); - // This also allows to check for possible "hack" attempts on account + if (WorldConfig.GetBoolValue(WorldCfg.AllowLogginIpAddressesInDatabase)) + { + // As we don't know if attempted login process by ip works, we update last_attempt_ip right away + 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); - // 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); + 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); diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 317890988..4db25a924 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -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); diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index 86cbab015..1b59ad2eb 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -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 + # ###################################################################################################