File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 description : 'blacklist of suid/sgid program on system'
3838)
3939
40+ cpuvulndir = '/sys/devices/system/cpu/vulnerabilities/'
41+
4042control 'os-01' do
4143 impact 1.0
4244 title 'Trusted hosts login'
236238 its ( :group ) { should match ( /^root|syslog$/ ) }
237239 end
238240end
241+
242+ control 'os-12' do
243+ impact 1.0
244+ title 'Detect vulnerabilities in the cpu-vulnerability-directory'
245+ desc 'Check for known cpu vulnerabilities described here: https://www.kernel.org/doc/html/v5.6/admin-guide/hw-vuln/index.html'
246+
247+ if file ( cpuvulndir ) . exist?
248+ describe file ( cpuvulndir ) do
249+ it { should be_directory }
250+ end
251+
252+ loaded_files = command ( 'find ' + cpuvulndir + ' -type f -maxdepth 1' ) . stdout . split ( /\n / ) . map ( &:strip ) . find_all { |vulnfiles | !vulnfiles . empty? }
253+
254+ loaded_files . each do |vulnfile |
255+ describe file ( vulnfile ) do
256+ its ( :content ) { should_not match 'vulnerable' }
257+ its ( :content ) { should_not match 'Vulnerable' }
258+ end
259+ end
260+ end
261+ end
You can’t perform that action at this time.
0 commit comments