Skip to content

Commit 429dd05

Browse files
committed
feature: Allow to set the verbosity of the debug
Signed-off-by: Julien Godin <[email protected]>
1 parent 19eb28a commit 429dd05

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

manifests/mod/security.pp

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
# @param modsec_secruleengine
2424
# Configures the rules engine.
2525
#
26+
# @param debug_log_level
27+
# Configures the debug log level.
28+
#
2629
# @param audit_log_relevant_status
2730
# Configures which response status code is to be considered relevant for the purpose of audit logging.
2831
#
@@ -140,6 +143,7 @@
140143
Optional[Array[String]] $custom_rules_set = $apache::params::modsec_custom_rules_set,
141144
Stdlib::Absolutepath $modsec_dir = $apache::params::modsec_dir,
142145
String $modsec_secruleengine = $apache::params::modsec_secruleengine,
146+
Integer[0, 9] $debug_log_level = 0,
143147
String $audit_log_relevant_status = '^(?:5|4(?!04))',
144148
String $audit_log_parts = $apache::params::modsec_audit_log_parts,
145149
String $audit_log_type = $apache::params::modsec_audit_log_type,
@@ -257,6 +261,7 @@
257261
'audit_log_parts' => $audit_log_parts,
258262
'audit_log_type' => $audit_log_type,
259263
'audit_log_storage_dir' => $audit_log_storage_dir,
264+
'debug_log_level' => $debug_log_level,
260265
'logroot' => $logroot,
261266
}
262267

spec/classes/mod/security_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
audit_log_parts: 'ABCDZ',
104104
audit_log_type: 'Concurrent',
105105
audit_log_storage_dir: '/var/log/httpd/audit',
106+
debug_log_level: 3,
106107
secdefaultaction: 'deny,status:406,nolog,auditlog',
107108
secrequestbodyaccess: 'Off',
108109
secresponsebodyaccess: 'On',
@@ -116,6 +117,7 @@
116117
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecAuditLogType Concurrent$} }
117118
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecAuditLogStorageDir /var/log/httpd/audit$} }
118119
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyAccess Off$} }
120+
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecDebugLogLevel 3$} }
119121
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyAccess On$} }
120122
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyLimitAction ProcessPartial$} }
121123
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyLimitAction Reject$} }

templates/mod/security.conf.epp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
SecResponseBodyMimeType text/plain text/html text/xml
4545
SecResponseBodyLimit 524288
4646
SecResponseBodyLimitAction <%= $secresponsebodylimitaction %>
47-
SecDebugLogLevel 0
47+
SecDebugLogLevel <%= $debug_log_level %>
4848
SecAuditEngine RelevantOnly
4949
SecAuditLogRelevantStatus "<%= $audit_log_relevant_status %>"
5050
SecAuditLogParts <%= $audit_log_parts %>

0 commit comments

Comments
 (0)