Skip to content

Commit 8674fad

Browse files
committed
Allow configuring CRS paranoia level
1 parent 950cffb commit 8674fad

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

manifests/mod/security.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@
7575
# @param notice_anomaly_score
7676
# Sets the Anomaly Score for rules assigned with a notice severity.
7777
#
78+
# @param paranoia_level
79+
# Sets the paranoia level in the OWASP ModSecurity Core Rule Set.
80+
#
81+
# @param executing_paranoia_level
82+
# Sets the executing paranoia level in the OWASP ModSecurity Core Rule Set.
83+
# The default is equal to, and cannot be lower than, $paranoia_level.
84+
#
7885
# @param secrequestmaxnumargs
7986
# Sets the maximum number of arguments in the request.
8087
#
@@ -123,6 +130,8 @@
123130
Integer $secrequestbodylimit = 13107200,
124131
Integer $secrequestbodynofileslimit = 131072,
125132
Integer $secrequestbodyinmemorylimit = 131072,
133+
Integer[1,4] $paranoia_level = 1,
134+
Integer[1,4] $executing_paranoia_level = $paranoia_level,
126135
Boolean $manage_security_crs = true,
127136
) inherits apache::params {
128137
include apache
@@ -140,6 +149,10 @@
140149
fail('SLES 10 is not currently supported.')
141150
}
142151

152+
if ($executing_paranoia_level < $paranoia_level) {
153+
fail('Executing paranoia level cannot be lower than paranoia level')
154+
}
155+
143156
case $version {
144157
1: {
145158
$mod_name = 'security'
@@ -248,6 +261,8 @@
248261
# - $notice_anomaly_score
249262
# - $inbound_anomaly_threshold
250263
# - $outbound_anomaly_threshold
264+
# - $paranoia_level
265+
# - $executing_paranoia_level
251266
# - $allowed_methods
252267
# - $content_types
253268
# - $restricted_extensions

templates/mod/security_crs.conf.erb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ SecDefaultAction "phase:2,<%= @_secdefaultaction -%>"
175175
#
176176
# Uncomment this rule to change the default:
177177
#
178-
#SecAction \
179-
# "id:900000,\
180-
# phase:1,\
181-
# nolog,\
182-
# pass,\
183-
# t:none,\
184-
# setvar:tx.paranoia_level=1"
178+
SecAction \
179+
"id:900000,\
180+
phase:1,\
181+
nolog,\
182+
pass,\
183+
t:none,\
184+
setvar:tx.paranoia_level=<%= @paranoia_level -%>"
185185

186186

187187
# It is possible to execute rules from a higher paranoia level but not include
@@ -201,13 +201,13 @@ SecDefaultAction "phase:2,<%= @_secdefaultaction -%>"
201201
# level results in a performance impact that is equally high as setting
202202
# tx.paranoia_level to said level.
203203
#
204-
#SecAction \
205-
# "id:900001,\
206-
# phase:1,\
207-
# nolog,\
208-
# pass,\
209-
# t:none,\
210-
# setvar:tx.executing_paranoia_level=1"
204+
SecAction \
205+
"id:900001,\
206+
phase:1,\
207+
nolog,\
208+
pass,\
209+
t:none,\
210+
setvar:tx.executing_paranoia_level=<%= @executing_paranoia_level -%>"
211211

212212

213213
#

0 commit comments

Comments
 (0)