|
103 | 103 |
|
104 | 104 | it { is_expected.not_to contain_file('/etc/httpd/modsecurity.d/security_crs.conf') } |
105 | 105 | end |
| 106 | + describe 'with custom parameters' do |
| 107 | + let :params do |
| 108 | + { |
| 109 | + custom_rules: false, |
| 110 | + } |
| 111 | + end |
| 112 | + |
| 113 | + it { |
| 114 | + is_expected.not_to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf') |
| 115 | + } |
| 116 | + end |
| 117 | + describe 'with parameters' do |
| 118 | + let :params do |
| 119 | + { |
| 120 | + custom_rules: true, |
| 121 | + custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'], |
| 122 | + } |
| 123 | + end |
| 124 | + |
| 125 | + it { |
| 126 | + is_expected.to contain_file('/etc/httpd/modsecurity.d/custom_rules').with( |
| 127 | + ensure: 'directory', path: '/etc/httpd/modsecurity.d/custom_rules', |
| 128 | + owner: 'apache', group: 'apache' |
| 129 | + ) |
| 130 | + } |
| 131 | + it { is_expected.to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf').with_content %r{^\s*.*"id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"$} } |
| 132 | + end |
106 | 133 | end |
107 | 134 | when 'Debian' |
108 | 135 | context 'on Debian based systems' do |
|
189 | 216 | end |
190 | 217 | end |
191 | 218 |
|
| 219 | + describe 'with custom parameters' do |
| 220 | + let :params do |
| 221 | + { |
| 222 | + custom_rules: false, |
| 223 | + } |
| 224 | + end |
| 225 | + |
| 226 | + it { |
| 227 | + is_expected.not_to contain_file('/etc/modsecurity/custom_rules/custom_01_rules.conf') |
| 228 | + } |
| 229 | + end |
| 230 | + |
| 231 | + describe 'with parameters' do |
| 232 | + let :params do |
| 233 | + { |
| 234 | + custom_rules: true, |
| 235 | + custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'], |
| 236 | + } |
| 237 | + end |
| 238 | + |
| 239 | + it { |
| 240 | + is_expected.to contain_file('/etc/modsecurity/custom_rules').with( |
| 241 | + ensure: 'directory', path: '/etc/modsecurity/custom_rules', |
| 242 | + owner: 'www-data', group: 'www-data' |
| 243 | + ) |
| 244 | + } |
| 245 | + it { is_expected.to contain_file('/etc/modsecurity/custom_rules/custom_01_rules.conf').with_content %r{\s*.*"id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"$} } |
| 246 | + end |
| 247 | + |
192 | 248 | describe 'with mod security version' do |
193 | 249 | let :params do |
194 | 250 | { |
|
0 commit comments