Skip to content

Commit 7032230

Browse files
Marc SternFelipe Zimmerle
authored andcommitted
{dis|en}able-server-context-logging: Option to disable logging of server info (log producer, sanitized objects, ...) in audit log.
1 parent da995bb commit 7032230

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
DD MMM YYYY - 2.9.2 - To be released
22
------------------------------------
33

4+
* {dis|en}able-server-context-logging: Option to disable logging of
5+
server info (log producer, sanitized objects, ...) in audit log.
6+
[Issue #1069 - Marc Stern]
47
* Allow drop to work with mod_http2
58
[Issue #1308, #992 - @bazzadp]
69
* Fix SecConn(Read|Write)StateLimit on Apache 2.4

apache2/msc_logging.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,9 @@ void sec_audit_logger_json(modsec_rec *msr) {
11801180
yajl_kv_bool(g, "response_body_dechunked", 1);
11811181
}
11821182

1183+
#ifdef LOG_NO_SERVER_CONTEXT
1184+
if (msr->txcfg->debuglog_level >= 9) {
1185+
#endif
11831186
sec_auditlog_write_producer_header_json(msr, g);
11841187

11851188
/* Server */
@@ -1274,6 +1277,9 @@ void sec_audit_logger_json(modsec_rec *msr) {
12741277
if (been_opened == 1) {
12751278
yajl_gen_map_close(g); // sanitized args map is finished
12761279
}
1280+
#ifdef LOG_NO_SERVER_CONTEXT
1281+
}
1282+
#endif
12771283

12781284
/* Web application info. */
12791285
if ( ((msr->txcfg->webappid != NULL)&&(strcmp(msr->txcfg->webappid, "default") != 0))
@@ -2022,6 +2028,9 @@ void sec_audit_logger_native(modsec_rec *msr) {
20222028
sec_auditlog_write(msr, text, strlen(text));
20232029
}
20242030

2031+
#ifdef LOG_NO_SERVER_CONTEXT
2032+
if (msr->txcfg->debuglog_level >= 9) {
2033+
#endif
20252034
sec_auditlog_write_producer_header(msr);
20262035

20272036
/* Server */
@@ -2090,8 +2099,11 @@ void sec_audit_logger_native(modsec_rec *msr) {
20902099
sec_auditlog_write(msr, text, strlen(text));
20912100
}
20922101
}
2102+
#ifdef LOG_NO_SERVER_CONTEXT
2103+
}
2104+
#endif
20932105

2094-
/* Web application info. */
2106+
/* Web application info. */
20952107
if ( ((msr->txcfg->webappid != NULL)&&(strcmp(msr->txcfg->webappid, "default") != 0))
20962108
|| (msr->sessionid != NULL) || (msr->userid != NULL))
20972109
{

configure.ac

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,21 @@ AC_ARG_ENABLE(stopwatch-logging,
517517
log_stopwatch=''
518518
])
519519

520+
# Disable logging of server context
521+
AC_ARG_ENABLE(server-context-logging,
522+
AS_HELP_STRING([--enable-server-context-logging],
523+
[Enable logging of server info (log producer, sanitized objects, ...) in audit log when log level < 9. This is the default]),
524+
[
525+
if test "$enableval" != "no"; then
526+
log_server_context=
527+
else
528+
log_server_context="-DLOG_NO_SERVER_CONTEXT"
529+
fi
530+
],
531+
[
532+
log_server_context=''
533+
])
534+
520535
# Ignore configure errors
521536
AC_ARG_ENABLE(errors,
522537
AS_HELP_STRING([--disable-errors],
@@ -767,7 +782,7 @@ else
767782
fi
768783
fi
769784

770-
MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type $unique_id $log_filename $log_server $log_collection_delete_problem $log_dechunk $log_stopwatch $log_handler"
785+
MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type $unique_id $log_filename $log_server $log_collection_delete_problem $log_dechunk $log_stopwatch $log_handler $log_server_contex"
771786

772787
APXS_WRAPPER=build/apxs-wrapper
773788
APXS_EXTRA_CFLAGS=""

0 commit comments

Comments
 (0)