From 68bf7e6d12e1689d688db32c05066b8832922c67 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Wed, 28 Jul 2021 11:44:24 +0200 Subject: 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 --- src/server/authserver/Server/AuthSession.cpp | 3 ++- src/server/authserver/authserver.conf.dist | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/server/authserver') diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 0acfa47db1e..dc0bcdd9465 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -507,9 +507,10 @@ bool AuthSession::HandleLogonProof() // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket + std::string address = sConfigMgr->GetBoolDefault("AllowLoggingIPAddressesInDatabase", true, true) ? GetRemoteIpAddress().to_string() : "127.0.0.1"; LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LOGONPROOF); stmt->setBinary(0, _sessionKey); - stmt->setString(1, GetRemoteIpAddress().to_string()); + stmt->setString(1, address); stmt->setUInt32(2, GetLocaleByName(_localizationName)); stmt->setString(3, _os); stmt->setString(4, _accountInfo.Login); diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d7fea17f397..e9dbf52cd41 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -176,6 +176,15 @@ MySQLExecutable = "" IPLocationFile = "" +# +# AllowLoggingIPAddressesInDatabase +# Description: Specifies if IP addresses can be logged to the database +# Default: 1 - (Enabled) +# 0 - (Disabled) +# + +AllowLoggingIPAddressesInDatabase = 1 + # ################################################################################################### -- cgit v1.2.3