summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/configreader.h3
-rw-r--r--include/filelogger.h1
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/configreader.cpp12
-rw-r--r--src/logger.cpp7
-rw-r--r--src/modules/m_spanningtree/compat.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
-rw-r--r--src/usermanager.cpp2
-rw-r--r--src/users.cpp5
9 files changed, 26 insertions, 10 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 02ed3d561..6cd355176 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -430,6 +430,9 @@ class CoreExport ServerConfig
*/
bool OperSpyWhois;
+ /** True if raw I/O is being logged */
+ bool RawLog;
+
/** Set to a non-empty string to obfuscate the server name of users in WHOIS
*/
std::string HideWhoisServer;
diff --git a/include/filelogger.h b/include/filelogger.h
index 1aefc0a35..731a6dcad 100644
--- a/include/filelogger.h
+++ b/include/filelogger.h
@@ -20,6 +20,7 @@
* */
enum DebugLevel
{
+ RAWIO = 5,
DEBUG = 10,
VERBOSE = 20,
DEFAULT = 30,
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 2e20fc27f..d16f38a85 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -354,7 +354,7 @@ bool CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user)
if (!user || buffer.empty())
return true;
- ServerInstance->Logs->Log("USERINPUT", DEBUG, "C[%s] I :%s %s",
+ ServerInstance->Logs->Log("USERINPUT", RAWIO, "C[%s] I :%s %s",
user->uuid.c_str(), user->nick.c_str(), buffer.c_str());
return ProcessCommand(user,buffer);
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index eb6dc5548..c93e37e1f 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -21,7 +21,7 @@
ServerConfig::ServerConfig()
{
WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
- NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false;
+ RawLog = NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false;
WildcardIPv6 = CycleHosts = InvBypassModes = true;
dns_timeout = 5;
MaxTargets = 20;
@@ -859,9 +859,7 @@ void ConfigReaderThread::Finish()
{
ServerConfig* old = ServerInstance->Config;
ServerInstance->Logs->Log("CONFIG",DEBUG,"Switching to new configuration...");
- ServerInstance->Logs->CloseLogs();
ServerInstance->Config = this->Config;
- ServerInstance->Logs->OpenFileLogs();
Config->Apply(old, TheUserUID);
if (Config->valid)
@@ -882,13 +880,17 @@ void ConfigReaderThread::Finish()
FOREACH_MOD(I_OnRehash, OnRehash(user));
ServerInstance->BuildISupport();
+ ServerInstance->Logs->CloseLogs();
+ ServerInstance->Logs->OpenFileLogs();
+
+ if (Config->RawLog)
+ ServerInstance->Users->ServerNoticeAll("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.");
+
Config = old;
}
else
{
// whoops, abort!
- ServerInstance->Logs->CloseLogs();
ServerInstance->Config = old;
- ServerInstance->Logs->OpenFileLogs();
}
}
diff --git a/src/logger.cpp b/src/logger.cpp
index 8c9d9a79b..ac171027c 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -69,7 +69,12 @@ void LogManager::OpenFileLogs()
std::string type = tag->getString("type");
std::string level = tag->getString("level");
int loglevel = DEFAULT;
- if (level == "debug")
+ if (level == "rawio")
+ {
+ loglevel = RAWIO;
+ ServerInstance->Config->RawLog = true;
+ }
+ else if (level == "debug")
{
loglevel = DEBUG;
}
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp
index 4cb86a4de..b5b31cf4d 100644
--- a/src/modules/m_spanningtree/compat.cpp
+++ b/src/modules/m_spanningtree/compat.cpp
@@ -181,7 +181,7 @@ void TreeSocket::WriteLine(std::string line)
}
}
- ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str());
+ ServerInstance->Logs->Log("m_spanningtree", RAWIO, "S[%d] O %s", this->GetFd(), line.c_str());
this->WriteData(line);
if (proto_version < 1202)
this->WriteData(wide_newline);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index b1ecff060..4ea4a929c 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -73,7 +73,7 @@ void TreeSocket::ProcessLine(std::string &line)
std::string command;
parameterlist params;
- ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str());
+ ServerInstance->Logs->Log("m_spanningtree", RAWIO, "S[%d] I %s", this->GetFd(), line.c_str());
Split(line, prefix, command, params);
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 8c87ab5e1..2d696c2a3 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -140,6 +140,8 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
* BOPM and other stuff requires it.
*/
New->WriteServ("NOTICE Auth :*** Looking up your hostname...");
+ if (ServerInstance->Config->RawLog)
+ New->WriteServ("NOTICE Auth :*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.");
FOREACH_MOD(I_OnUserInit,OnUserInit(New));
diff --git a/src/users.cpp b/src/users.cpp
index 3f19aa86c..5f495aafb 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -816,6 +816,9 @@ void LocalUser::FullConnect()
if (!MOD_RESULT)
ServerInstance->CallCommandHandler(command, parameters, this);
+ if (ServerInstance->Config->RawLog)
+ WriteServ("PRIVMSG %s :*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.", nick.c_str());
+
/*
* We don't set REG_ALL until triggering OnUserConnect, so some module events don't spew out stuff
* for a user that doesn't exist yet.
@@ -1020,7 +1023,7 @@ void LocalUser::Write(const std::string& text)
return;
}
- ServerInstance->Logs->Log("USEROUTPUT", DEBUG,"C[%s] O %s", uuid.c_str(), text.c_str());
+ ServerInstance->Logs->Log("USEROUTPUT", RAWIO, "C[%s] O %s", uuid.c_str(), text.c_str());
eh.AddWriteBuf(text);
eh.AddWriteBuf(wide_newline);