Skip to content

Commit

Permalink
Merge pull request #77 from mcgege/search-opt
Browse files Browse the repository at this point in the history
Optimize file search routines
  • Loading branch information
atomic111 authored Jul 14, 2017
2 parents f8ac0dd + c5dc86b commit 60ae1a5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions controls/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@
control 'os-01' do
impact 1.0
title 'Trusted hosts login'
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."
describe command('find / -name \'.rhosts\'') do
its('stdout') { should be_empty }
end
describe command('find / -name \'hosts.equiv\' ') do
its('stdout') { should be_empty }
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."
describe file('/etc/hosts.equiv') do
it { should_not exist }
end
end

Expand Down Expand Up @@ -217,8 +214,7 @@
impact 1.0
title 'Check for .rhosts and .netrc file'
desc 'Find .rhosts and .netrc files - CIS Benchmark 9.2.9-10'

output = command('find / \( -iname .rhosts -o -iname .netrc \) -print 2>/dev/null | grep -v \'^find:\'')
output = command('find / -maxdepth 3 \( -iname .rhosts -o -iname .netrc \) -print 2>/dev/null | grep -v \'^find:\'')
out = output.stdout.split(/\r?\n/)
describe out do
it { should be_empty }
Expand Down

0 comments on commit 60ae1a5

Please sign in to comment.