Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2ee45de

Browse files
Added audit log header
1 parent 0ac551b commit 2ee45de

File tree

12 files changed

+6263
-6118
lines changed

12 files changed

+6263
-6118
lines changed

‎headers/modsecurity/audit_log.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class AuditLog {
157157
bool setFilePath1(const std::basic_string<char>& path);
158158
bool setFilePath2(const std::basic_string<char>& path);
159159
bool setStorageDir(const std::basic_string<char>& path);
160+
bool setHeader(const std::basic_string<char>& header);
160161
bool setFormat(AuditLogFormat fmt);
161162

162163
int getDirectoryPermission() const;
@@ -185,6 +186,7 @@ class AuditLog {
185186
std::string m_path1;
186187
std::string m_path2;
187188
std::string m_storage_dir;
189+
std::string m_header;
188190

189191
AuditLogFormat m_format;
190192

‎headers/modsecurity/transaction.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
411411
int getRuleEngineState() const;
412412

413413
std::string toJSON(int parts);
414-
std::string toOldAuditLogFormat(int parts, const std::string &trailer);
414+
std::string toOldAuditLogFormat(int parts, const std::string &trailer, const std::string &header);
415415
std::string toOldAuditLogFormatIndex(const std::string &filename,
416416
double size, const std::string &md5);
417417

‎src/audit_log/audit_log.cc‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ AuditLog::AuditLog()
5555
: m_path1(""),
5656
m_path2(""),
5757
m_storage_dir(""),
58+
m_header(""),
5859
m_format(NotSetAuditLogFormat),
5960
m_parts(-1),
6061
m_filePermission(-1),
@@ -131,6 +132,13 @@ bool AuditLog::setFilePath2(const std::basic_string<char>& path) {
131132
return true;
132133
}
133134

135+
136+
bool AuditLog::setHeader(const std::basic_string<char>& header) {
137+
this->m_header = header;
138+
return true;
139+
}
140+
141+
134142
bool AuditLog::setFormat(AuditLogFormat fmt) {
135143
this->m_format = fmt;
136144
return true;
@@ -208,7 +216,6 @@ bool AuditLog::setType(AuditLogType audit_type) {
208216
}
209217

210218

211-
212219
bool AuditLog::init(std::string *error) {
213220
audit_log::writer::Writer *tmp_writer;
214221

@@ -337,6 +344,7 @@ bool AuditLog::merge(AuditLog *from, std::string *error) {
337344
AL_MERGE_STRING_CONF(from->m_path2, m_path2);
338345
AL_MERGE_STRING_CONF(from->m_storage_dir, m_storage_dir);
339346
AL_MERGE_STRING_CONF(from->m_relevant, m_relevant);
347+
AL_MERGE_STRING_CONF(from->m_header, m_header);
340348

341349
if (from->m_filePermission != -1) {
342350
m_filePermission = from->m_filePermission;

‎src/audit_log/writer/parallel.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bool Parallel::write(Transaction *transaction, int parts, std::string *error) {
119119
} else {
120120
std::string boundary;
121121
generateBoundary(&boundary);
122-
log = transaction->toOldAuditLogFormat(parts, "-" + boundary + "--");
122+
log = transaction->toOldAuditLogFormat(parts, "-" + boundary + "--", m_audit->m_header);
123123
}
124124

125125
const auto &logPath = m_audit->m_storage_dir;

‎src/audit_log/writer/serial.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool Serial::write(Transaction *transaction, int parts, std::string *error) {
4242
} else {
4343
std::string boundary;
4444
generateBoundary(&boundary);
45-
msg = transaction->toOldAuditLogFormat(parts, "-" + boundary + "--");
45+
msg = transaction->toOldAuditLogFormat(parts, "-" + boundary + "--", m_audit->m_header);
4646
}
4747

4848
return utils::SharedFiles::getInstance().write(m_audit->m_path1, msg,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /