aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2021-07-28 11:44:24 +0200
committerGitHub <noreply@github.com>2021-07-28 11:44:24 +0200
commit68bf7e6d12e1689d688db32c05066b8832922c67 (patch)
tree6b18313a4f2d81a5822fa75269224eed5099ed64 /src/server/authserver
parent621f3f50c2fa2ce098ff13ad12a0bbc772300e2f (diff)
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
Diffstat (limited to 'src/server/authserver')
-rw-r--r--src/server/authserver/Server/AuthSession.cpp3
-rw-r--r--src/server/authserver/authserver.conf.dist9
2 files changed, 11 insertions, 1 deletions
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
@@ -177,6 +177,15 @@ MySQLExecutable = ""
IPLocationFile = ""
#
+# AllowLoggingIPAddressesInDatabase
+# Description: Specifies if IP addresses can be logged to the database
+# Default: 1 - (Enabled)
+# 0 - (Disabled)
+#
+
+AllowLoggingIPAddressesInDatabase = 1
+
+#
###################################################################################################
###################################################################################################