mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Adds section "H" to serial audit log
This commit is contained in:
parent
2d29740ca4
commit
317808fe54
@ -52,7 +52,8 @@ class RuleMessage {
|
||||
|
||||
std::string errorLog(Transaction *trans);
|
||||
std::string disruptiveErrorLog(Transaction *trans, std::string log2);
|
||||
|
||||
std::string noClientErrorLog(Transaction *trans);
|
||||
std::string errorLogTail(Transaction *trans);
|
||||
|
||||
std::string m_match;
|
||||
std::string m_ruleFile;
|
||||
|
@ -53,11 +53,11 @@ std::string RuleMessage::disruptiveErrorLog(Transaction *trans,
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
std::string RuleMessage::errorLog(Transaction *trans) {
|
||||
|
||||
std::string RuleMessage::noClientErrorLog(Transaction *trans) {
|
||||
std::string msg;
|
||||
|
||||
msg.append("[client " + std::string(trans->m_clientIpAddress) + "]");
|
||||
msg.append(" ModSecurity: Warning. ");
|
||||
msg.append("ModSecurity: Warning. ");
|
||||
msg.append(m_match);
|
||||
msg.append(" [file \"" + std::string(m_ruleFile) + "\"]");
|
||||
msg.append(" [line \"" + std::to_string(m_ruleLine) + "\"]");
|
||||
@ -73,7 +73,14 @@ std::string RuleMessage::errorLog(Transaction *trans) {
|
||||
for (auto &a : m_tags) {
|
||||
msg.append(" [tag \"" + a + "\"]");
|
||||
}
|
||||
msg.append(" [hostname \"" + std::string(trans->m_serverIpAddress) \
|
||||
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
std::string RuleMessage::errorLogTail(Transaction *trans) {
|
||||
std::string msg;
|
||||
|
||||
msg.append("[hostname \"" + std::string(trans->m_serverIpAddress) \
|
||||
+ "\"]");
|
||||
msg.append(" [uri \"" + trans->m_uri_no_query_string_decoded + "\"]");
|
||||
msg.append(" [unique_id \"" + trans->m_id + "\"]");
|
||||
@ -81,4 +88,14 @@ std::string RuleMessage::errorLog(Transaction *trans) {
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
std::string RuleMessage::errorLog(Transaction *trans) {
|
||||
std::string msg;
|
||||
|
||||
msg.append("[client " + std::string(trans->m_clientIpAddress) + "] ");
|
||||
msg.append(noClientErrorLog(trans));
|
||||
msg.append(" " + errorLogTail(trans));
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
} // namespace modsecurity
|
||||
|
@ -1436,6 +1436,9 @@ std::string Transaction::toOldAuditLogFormat(int parts,
|
||||
}
|
||||
if (parts & audit_log::AuditLog::HAuditLogPart) {
|
||||
audit_log << "--" << trailer << "-" << "H--" << std::endl;
|
||||
for (auto a : m_rulesMessages) {
|
||||
audit_log << a.noClientErrorLog(this) << std::endl;
|
||||
}
|
||||
audit_log << std::endl;
|
||||
/** TODO: write audit_log H part. */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user