Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update os_spec.rb #185

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions controls/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,14 @@
title 'Check mountpoints for noexec mount options'
desc 'Use the noexec mount options to limit attack vectors via mount points'

mount_exec_blocklist.each do |mnt_point|
next unless mount(mnt_point).mounted?
def mounted_mount_points
mount_exec_blocklist.select do |mount_point|
mount(mount_point)&.mounted?? true : nil
end
end

describe mount(mnt_point) do
mounted_mount_points.each do |mount_point|
describe mount(mount_point) do
its('options') { should include('noexec') }
end
end
Expand All @@ -326,10 +330,14 @@
title 'Check mountpoints for nosuid mount options'
desc 'Use the nosuid mount options to limit attack vectors via mount points'

mount_suid_blocklist.each do |mnt_point|
next unless mount(mnt_point).mounted?
def mounted_mount_points(blocklist)
blocklist.select do |mount_point|
mount(mount_point)&.mounted?? true : nil
end
end

describe mount(mnt_point) do
mounted_mount_points(mount_suid_blocklist).each do |mount_point|
describe mount(mount_point) do
its('options') { should include('nosuid') }
end
end
Expand All @@ -340,10 +348,14 @@
title 'Check mountpoints for nodev mount options'
desc 'Use the nodev mount options to limit attack vectors via mount points'

mount_dev_blocklist.each do |mnt_point|
next unless mount(mnt_point).mounted?
def mounted_mount_points(blocklist)
blocklist.select do |mount_point|
mount(mount_point)&.mounted?? true : nil
end
end

describe mount(mnt_point) do
mounted_mount_points(mount_dev_blocklist).each do |mount_point|
describe mount(mount_point) do
its('options') { should include('nodev') }
end
end
Expand Down
Loading