Skip to content

Commit 9f6fd95

Browse files
authored
Merge pull request #2373 from bastelfreak/2371
security{,_crs}.conf: switch to structured facts
2 parents 4d4c551 + 36ae12d commit 9f6fd95

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

spec/classes/mod/security_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
end
1111

1212
case facts[:os]['family']
13+
when 'Suse'
14+
context 'on Suse based systems' do
15+
it {
16+
is_expected.to contain_file('security.conf')
17+
.with_content(%r{^\s+SecTmpDir /var/lib/mod_security$})
18+
}
19+
end
1320
when 'RedHat'
1421
context 'on RedHat based systems' do
1522
it {
@@ -42,6 +49,7 @@
4249
.with_content(%r{^\s+SecAuditLogType Serial$})
4350
.with_content(%r{^\s+SecDebugLog /var/log/httpd/modsec_debug.log$})
4451
.with_content(%r{^\s+SecAuditLog /var/log/httpd/modsec_audit.log$})
52+
.with_content(%r{^\s+SecTmpDir /var/lib/mod_security$})
4553
}
4654
it {
4755
is_expected.to contain_file('/etc/httpd/modsecurity.d').with(
@@ -211,6 +219,7 @@
211219
.with_content(%r{^\s+SecAuditLogType Serial$})
212220
.with_content(%r{^\s+SecDebugLog /var/log/apache2/modsec_debug.log$})
213221
.with_content(%r{^\s+SecAuditLog /var/log/apache2/modsec_audit.log$})
222+
.with_content(%r{^\s+SecTmpDir /var/cache/modsecurity$})
214223
}
215224
it {
216225
is_expected.to contain_file('/etc/modsecurity').with(

templates/mod/security.conf.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
<%- end -%>
5555
SecArgumentSeparator &
5656
SecCookieFormat 0
57-
<%- if scope['os::family'] == 'Debian' -%>
57+
<%- if scope['facts']['os']['family'] == 'Debian' -%>
5858
SecDebugLog <%= @logroot %>/modsec_debug.log
5959
SecAuditLog <%= @logroot %>/modsec_audit.log
6060
SecTmpDir /var/cache/modsecurity
6161
SecDataDir /var/cache/modsecurity
6262
SecUploadDir /var/cache/modsecurity
63-
<%- elsif scope['os::family'] == 'Suse' -%>
63+
<%- elsif scope['facts']['os']['family'] == 'Suse' -%>
6464
SecDebugLog /var/log/apache2/modsec_debug.log
6565
SecAuditLog /var/log/apache2/modsec_audit.log
6666
SecTmpDir /var/lib/mod_security

templates/mod/security_crs.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<% if scope['os::family'] == 'Redhat' and scope['os::release::major'].to_i <= 7 -%>
1+
<% if scope['facts']['os']['family'] == 'Redhat' and scope['facts']['os']['release']['major'].to_i <= 7 -%>
22
# ---------------------------------------------------------------
33
# Core ModSecurity Rule Set ver.2.2.9
44
# Copyright (C) 2006-2012 Trustwave All rights reserved.

0 commit comments

Comments
 (0)