Skip to content

Commit 60ae1a5

Browse files
authored
Merge pull request #77 from mcgege/search-opt
Optimize file search routines
2 parents f8ac0dd + c5dc86b commit 60ae1a5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

controls/os_spec.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@
7373
control 'os-01' do
7474
impact 1.0
7575
title 'Trusted hosts login'
76-
desc "Rhosts/hosts.equiv files are a weak implemenation of authentication. Disabling the .rhosts and hosts.equiv support helps to prevent users from subverting the system's normal access control mechanisms of the system."
77-
describe command('find / -name \'.rhosts\'') do
78-
its('stdout') { should be_empty }
79-
end
80-
describe command('find / -name \'hosts.equiv\' ') do
81-
its('stdout') { should be_empty }
76+
desc "hosts.equiv file is a weak implemenation of authentication. Disabling the hosts.equiv support helps to prevent users from subverting the system's normal access control mechanisms of the system."
77+
describe file('/etc/hosts.equiv') do
78+
it { should_not exist }
8279
end
8380
end
8481

@@ -217,8 +214,7 @@
217214
impact 1.0
218215
title 'Check for .rhosts and .netrc file'
219216
desc 'Find .rhosts and .netrc files - CIS Benchmark 9.2.9-10'
220-
221-
output = command('find / \( -iname .rhosts -o -iname .netrc \) -print 2>/dev/null | grep -v \'^find:\'')
217+
output = command('find / -maxdepth 3 \( -iname .rhosts -o -iname .netrc \) -print 2>/dev/null | grep -v \'^find:\'')
222218
out = output.stdout.split(/\r?\n/)
223219
describe out do
224220
it { should be_empty }

0 commit comments

Comments
 (0)