Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow to set the verbosity of the debug #2523

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions manifests/mod/security.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# @param modsec_secruleengine
# Configures the rules engine.
#
# @param debug_log_level
# Configures the debug log level.
#
# @param audit_log_relevant_status
# Configures which response status code is to be considered relevant for the purpose of audit logging.
#
Expand Down Expand Up @@ -143,6 +146,7 @@
Optional[Array[String]] $custom_rules_set = $apache::params::modsec_custom_rules_set,
Stdlib::Absolutepath $modsec_dir = $apache::params::modsec_dir,
String $modsec_secruleengine = $apache::params::modsec_secruleengine,
Integer[0, 9] $debug_log_level = 0,
String $audit_log_relevant_status = '^(?:5|4(?!04))',
String $audit_log_parts = $apache::params::modsec_audit_log_parts,
String $audit_log_type = $apache::params::modsec_audit_log_type,
Expand Down Expand Up @@ -262,6 +266,7 @@
'audit_log_type' => $audit_log_type,
'audit_log_format' => $audit_log_format,
'audit_log_storage_dir' => $audit_log_storage_dir,
'debug_log_level' => $debug_log_level,
'logroot' => $logroot,
}

Expand Down
2 changes: 2 additions & 0 deletions spec/classes/mod/security_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
audit_log_type: 'Concurrent',
audit_log_format: 'JSON',
audit_log_storage_dir: '/var/log/httpd/audit',
debug_log_level: 3,
secdefaultaction: 'deny,status:406,nolog,auditlog',
secrequestbodyaccess: 'Off',
secresponsebodyaccess: 'On',
Expand All @@ -118,6 +119,7 @@
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecAuditLogFormat JSON$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecAuditLogStorageDir /var/log/httpd/audit$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyAccess Off$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecDebugLogLevel 3$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyAccess On$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyLimitAction ProcessPartial$} }
it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyLimitAction Reject$} }
Expand Down
2 changes: 1 addition & 1 deletion templates/mod/security.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
SecResponseBodyMimeType text/plain text/html text/xml
SecResponseBodyLimit 524288
SecResponseBodyLimitAction <%= $secresponsebodylimitaction %>
SecDebugLogLevel 0
SecDebugLogLevel <%= $debug_log_level %>
SecAuditEngine RelevantOnly
SecAuditLogRelevantStatus "<%= $audit_log_relevant_status %>"
SecAuditLogParts <%= $audit_log_parts %>
Expand Down
Loading