Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: wdower <57142072+wdower@users.noreply.github.com>
  • Loading branch information
wdower committed Apr 30, 2024
1 parent 7c8584e commit 847d11e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
1 change: 0 additions & 1 deletion controls/SV-258046.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@
expect(non_interactive_shells).to be_empty, "Non-interactive system accounts with interactive shells:\n\t- #{non_interactive_shells.join("\n\t- ")}"
end
end

end
2 changes: 1 addition & 1 deletion controls/SV-258055.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
}

describe command('grep even_deny_root /etc/security/faillock.conf').stdout.strip do
it { should match(%r{^even_deny_root$}) }
it { should match(/^even_deny_root$/) }
end
end
6 changes: 3 additions & 3 deletions controls/SV-258061.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
tag nist: ['IA-2']
tag 'host', 'container'

duplicate_gids = command("cut -d : -f 3 /etc/group | uniq -d").stdout.strip.split
duplicate_gids = command('cut -d : -f 3 /etc/group | uniq -d').stdout.strip.split

describe "All GIDs" do
it "should be unique" do
describe 'All GIDs' do
it 'should be unique' do
expect(duplicate_gids).to be_empty, "GIDs with more than one group name:\n\t- #{duplicate_gids.join("\n\t- ")}"
end
end
Expand Down
8 changes: 3 additions & 5 deletions controls/SV-258072.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@

expected_umask = input('permissions_for_shells')[:bashrc_umask]

umask_check = command("grep umask #{file}").stdout.strip.match(%r{^umask\s+(?<umask>\d+)$})
umask_check = command("grep umask #{file}").stdout.strip.match(/^umask\s+(?<umask>\d+)$/)

if umask_check.nil?
describe "UMASK should be set in #{file}" do
subject { umask_check }
it { should_not be_nil }
end
else
if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
impact 0.7
end
describe "UMASK" do
impact 0.7 if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
describe 'UMASK' do
subject { umask_check[:umask] }
it { should cmp expected_umask }
end
Expand Down
8 changes: 3 additions & 5 deletions controls/SV-258073.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@

expected_umask = input('permissions_for_shells')[:cshrc_umask]

umask_check = command("grep umask #{file}").stdout.strip.match(%r{^umask\s+(?<umask>\d+)$})
umask_check = command("grep umask #{file}").stdout.strip.match(/^umask\s+(?<umask>\d+)$/)

if umask_check.nil?
describe "UMASK should be set in #{file}" do
subject { umask_check }
it { should_not be_nil }
end
else
if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
impact 0.7
end
describe "UMASK" do
impact 0.7 if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
describe 'UMASK' do
subject { umask_check[:umask] }
it { should cmp expected_umask }
end
Expand Down
8 changes: 3 additions & 5 deletions controls/SV-258075.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@

expected_umask = input('permissions_for_shells')[:profile_umask]

umask_check = command("grep umask #{file}").stdout.strip.match(%r{^umask\s+(?<umask>\d+)$})
umask_check = command("grep umask #{file}").stdout.strip.match(/^umask\s+(?<umask>\d+)$/)

if umask_check.nil?
describe "UMASK should be set in #{file}" do
subject { umask_check }
it { should_not be_nil }
end
else
if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
impact 0.7
end
describe "UMASK" do
impact 0.7 if umask_check[:umask] == '0000' || umask_check[:umask] == '000'
describe 'UMASK' do
subject { umask_check[:umask] }
it { should cmp expected_umask }
end
Expand Down
2 changes: 1 addition & 1 deletion controls/SV-258083.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
tag cci: ['CCI-002235']
tag nist: ['AC-6 (10)']
tag 'host'

only_if('This control is Not Applicable to containers', impact: 0.0) {
!(virtualization.system.eql?('docker') && !file('/etc/ssh/sshd_config').exist?)
}
Expand Down

0 comments on commit 847d11e

Please sign in to comment.