Saltstack Official Apache Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

46 líneas
1.4KB

  1. # frozen_string_literal: true
  2. control 'apache mod_security configuration' do
  3. title 'should match desired lines'
  4. only_if('Disabled on Arch Linux') do
  5. !%w[arch].include?(platform[:name])
  6. end
  7. modspec_file =
  8. case system.platform[:family]
  9. when 'redhat', 'fedora'
  10. '/etc/httpd/conf.d/mod_security.conf'
  11. when 'debian'
  12. '/etc/modsecurity/modsecurity.conf-recommended'
  13. when 'suse'
  14. '/etc/apache2/conf.d/mod_security2.conf'
  15. when 'bsd'
  16. '/usr/local/etc/modsecurity/modsecurity.conf'
  17. end
  18. modspec_file_group =
  19. case system.platform[:family]
  20. when 'bsd'
  21. 'wheel'
  22. else
  23. 'root'
  24. end
  25. describe file(modspec_file) do
  26. it { should be_file }
  27. its('mode') { should cmp '0644' }
  28. its('owner') { should eq 'root' }
  29. its('group') { should eq modspec_file_group }
  30. its('content') { should match(/SecRuleEngine On/) }
  31. its('content') { should match(/SecRequestBodyAccess On/) }
  32. its('content') { should match(/SecRequestBodyLimit 14000000/) }
  33. its('content') { should match(/SecRequestBodyNoFilesLimit 114002/) }
  34. its('content') { should match(/SecRequestBodyInMemoryLimit 114002/) }
  35. its('content') { should match(/SecRequestBodyLimitAction Reject/) }
  36. its('content') { should match(/SecPcreMatchLimit 15000/) }
  37. its('content') { should match(/SecPcreMatchLimitRecursion 15000/) }
  38. its('content') { should match(/SecDebugLogLevel 3/) }
  39. end
  40. end