Skip to content

Commit 2008837

Browse files
committed
bugfix: fix the vhost security configuration
The modified variable was never passed to the template, resulting in a bad configuration of the vhost security if secrule were removed. Signed-off-by: Julien Godin <[email protected]>
1 parent bde17ea commit 2008837

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

manifests/vhost.pp

+16-22
Original file line numberDiff line numberDiff line change
@@ -2170,28 +2170,22 @@
21702170
}
21712171

21722172
## Create a global LocationMatch if locations aren't defined
2173-
if $modsec_disable_ids {
2174-
if $modsec_disable_ids =~ Array {
2175-
$_modsec_disable_ids = { '.*' => $modsec_disable_ids }
2176-
} else {
2177-
$_modsec_disable_ids = $modsec_disable_ids
2178-
}
2173+
if $modsec_disable_ids =~ Array {
2174+
$_modsec_disable_ids = { '.*' => $modsec_disable_ids }
2175+
} else {
2176+
$_modsec_disable_ids = $modsec_disable_ids
21792177
}
21802178

2181-
if $modsec_disable_msgs {
2182-
if $modsec_disable_msgs =~ Array {
2183-
$_modsec_disable_msgs = { '.*' => $modsec_disable_msgs }
2184-
} else {
2185-
$_modsec_disable_msgs = $modsec_disable_msgs
2186-
}
2179+
if $modsec_disable_msgs =~ Array {
2180+
$_modsec_disable_msgs = { '.*' => $modsec_disable_msgs }
2181+
} else {
2182+
$_modsec_disable_msgs = $modsec_disable_msgs
21872183
}
21882184

2189-
if $modsec_disable_tags {
2190-
if $modsec_disable_tags =~ Array {
2191-
$_modsec_disable_tags = { '.*' => $modsec_disable_tags }
2192-
} else {
2193-
$_modsec_disable_tags = $modsec_disable_tags
2194-
}
2185+
if $modsec_disable_tags =~ Array {
2186+
$_modsec_disable_tags = { '.*' => $modsec_disable_tags }
2187+
} else {
2188+
$_modsec_disable_tags = $modsec_disable_tags
21952189
}
21962190

21972191
concat { "${priority_real}${filename}.conf":
@@ -2828,14 +2822,14 @@
28282822
}
28292823
}
28302824

2831-
if $modsec_disable_vhost or $modsec_disable_ids or !empty($modsec_disable_ips) or $modsec_disable_msgs or $modsec_disable_tags or $modsec_audit_log_destination or ($modsec_inbound_anomaly_threshold and $modsec_outbound_anomaly_threshold) or $modsec_allowed_methods {
2825+
if $modsec_disable_vhost or $_modsec_disable_ids or !empty($modsec_disable_ips) or $_modsec_disable_msgs or $_modsec_disable_tags or $modsec_audit_log_destination or ($modsec_inbound_anomaly_threshold and $modsec_outbound_anomaly_threshold) or $modsec_allowed_methods {
28322826
$security_params = {
28332827
'modsec_disable_vhost' => $modsec_disable_vhost,
28342828
'modsec_audit_log_destination' => $modsec_audit_log_destination,
2835-
'_modsec_disable_ids' => $modsec_disable_ids,
2829+
'_modsec_disable_ids' => $_modsec_disable_ids,
28362830
'modsec_disable_ips' => $modsec_disable_ips,
2837-
'_modsec_disable_msgs' => $modsec_disable_msgs,
2838-
'_modsec_disable_tags' => $modsec_disable_tags,
2831+
'_modsec_disable_msgs' => $_modsec_disable_msgs,
2832+
'_modsec_disable_tags' => $_modsec_disable_tags,
28392833
'modsec_body_limit' => $modsec_body_limit,
28402834
'modsec_inbound_anomaly_threshold' => $modsec_inbound_anomaly_threshold,
28412835
'modsec_outbound_anomaly_threshold' => $modsec_outbound_anomaly_threshold,

templates/vhost/_security.epp

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<IfModule mod_security2.c>
2-
<% if $modsec_disable_vhost {-%>
3-
SecRuleEngine Off
4-
<% } -%>
2+
SecRuleEngine <%= apache::bool2httpd(!$modsec_disable_vhost) %>
53
<% if $modsec_audit_log_destination {-%>
64
SecAuditLog "<%= $modsec_audit_log_destination %>"
75
<% } -%>

0 commit comments

Comments
 (0)