mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-20 19:16:40 +03:00
General improvements on audit logs information
Making actions: msg, logdata, tag and others to work in the same fashion that they work on ModSecurity v2.x
This commit is contained in:
@@ -22,6 +22,25 @@
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "src/utils.h"
|
||||
#include "src/macro_expansion.h"
|
||||
#include "modsecurity/rule.h"
|
||||
|
||||
/*
|
||||
* Description: Assigns a custom message to the rule or chain in which it
|
||||
* appears. The message will be logged along with every alert.
|
||||
*
|
||||
* Action Group: Meta-data
|
||||
*
|
||||
* Example:
|
||||
* SecRule &REQUEST_HEADERS:Host "@eq 0" "log,id:60008,severity:2,msg:'Request Missing a Host Header'"
|
||||
*
|
||||
* Note : The msg information appears in the error and/or audit log files
|
||||
* and is not sent back to the client in response headers.
|
||||
*
|
||||
* Note 2: The msg action can appear multiple times in the SecRule, however
|
||||
* just the last one will be take into consideration.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace modsecurity {
|
||||
namespace actions {
|
||||
@@ -36,13 +55,16 @@ Msg::Msg(std::string action)
|
||||
|
||||
bool Msg::evaluate(Rule *rule, Transaction *transaction) {
|
||||
std::string msg = MacroExpansion::expand(m_msg, transaction);
|
||||
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(9, "Saving msg: " + msg);
|
||||
#endif
|
||||
transaction->m_rulesMessages.push_back(msg);
|
||||
transaction->serverLog(msg);
|
||||
|
||||
rule->m_log_message = msg;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace actions
|
||||
} // namespace modsecurity
|
||||
|
||||
Reference in New Issue
Block a user