|
41 | 41 |
|
42 | 42 | cpuvulndir = '/sys/devices/system/cpu/vulnerabilities/' |
43 | 43 |
|
| 44 | +# Overview of necessary mount options to be checked: |
| 45 | +# |
| 46 | +#--------------------------------------------------------- |
| 47 | +# Mount point nodev noexec nosuid |
| 48 | +# /boot v v v |
| 49 | +# /dev v v |
| 50 | +# /dev/shm v v v |
| 51 | +# /home v v |
| 52 | +# /run v v |
| 53 | +# /tmp v v v |
| 54 | +# /var v v |
| 55 | +# /var/log v v v |
| 56 | +# /var/log/audit v v v |
| 57 | +# /var/tmp v v v |
| 58 | +#--------------------------------------------------------- |
| 59 | + |
| 60 | +mount_exec_blocklist = attribute( |
| 61 | + 'mount_exec_blocklist', |
| 62 | + value: ['/boot', '/dev', '/dev/shm', '/tmp', '/var/log', '/var/log/audit', '/var/tmp'], |
| 63 | + description: 'List of mountspoints where \'noexec\' mount option shoud be set' |
| 64 | +) |
| 65 | + |
| 66 | +mount_suid_blocklist = attribute( |
| 67 | + 'mount_suid_blocklist', |
| 68 | + value: ['/boot', '/dev', '/dev/shm', '/home', '/run', '/tmp', '/var', '/var/log', '/var/log/audit', '/var/tmp'], |
| 69 | + description: 'List of mountpoints where \'nosuid\' mount option shoud be set' |
| 70 | +) |
| 71 | + |
| 72 | +mount_dev_blocklist = attribute( |
| 73 | + 'mount_dev_blocklist', |
| 74 | + value: ['/boot', '/dev/shm', '/home', '/run', '/tmp', '/var', '/var/log', '/var/log/audit', '/var/tmp'], |
| 75 | + description: 'List of mountpoints where \'nodev\' mount option shoud be set' |
| 76 | +) |
| 77 | + |
44 | 78 | control 'os-01' do |
45 | 79 | impact 1.0 |
46 | 80 | title 'Trusted hosts login' |
|
282 | 316 | end |
283 | 317 | end |
284 | 318 | end |
| 319 | + |
| 320 | +control 'os-14' do |
| 321 | + impact 1.0 |
| 322 | + title 'Check mountpoints for noexec mount options' |
| 323 | + desc 'Use the noexec mount options to limit attack vectors via mount points' |
| 324 | + |
| 325 | + mount_exec_blocklist.each do |mnt_point| |
| 326 | + next unless mount(mnt_point).mounted? |
| 327 | + |
| 328 | + describe mount(mnt_point) do |
| 329 | + its('options') { should include('noexec') } |
| 330 | + end |
| 331 | + end |
| 332 | +end |
| 333 | + |
| 334 | +control 'os-15' do |
| 335 | + impact 1.0 |
| 336 | + title 'Check mountpoints for nosuid mount options' |
| 337 | + desc 'Use the nosuid mount options to limit attack vectors via mount points' |
| 338 | + |
| 339 | + mount_suid_blocklist.each do |mnt_point| |
| 340 | + next unless mount(mnt_point).mounted? |
| 341 | + |
| 342 | + describe mount(mnt_point) do |
| 343 | + its('options') { should include('nosuid') } |
| 344 | + end |
| 345 | + end |
| 346 | +end |
| 347 | + |
| 348 | +control 'os-16' do |
| 349 | + impact 1.0 |
| 350 | + title 'Check mountpoints for nodev mount options' |
| 351 | + desc 'Use the nodev mount options to limit attack vectors via mount points' |
| 352 | + |
| 353 | + mount_dev_blocklist.each do |mnt_point| |
| 354 | + next unless mount(mnt_point).mounted? |
| 355 | + |
| 356 | + describe mount(mnt_point) do |
| 357 | + its('options') { should include('nodev') } |
| 358 | + end |
| 359 | + end |
| 360 | +end |
0 commit comments