Last active
December 6, 2023 22:49
-
-
Save varnav/64d38b56fef6ed5e7852bf8fbd0722b1 to your computer and use it in GitHub Desktop.
chef_tmp_partition_cis.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1.1.4 Ensure nodev option set on /tmp partition | |
# 1.1.5 Ensure nosuid option set on /tmp partition | |
if node['filesystem']['by_mountpoint']['/tmp'] and node['platform_version'] >= 7 | |
mount '/tmp' do | |
device node['filesystem']['by_mountpoint']['/tmp']['device'] | |
fstype node['filesystem']['by_mountpoint']['/tmp']['fs_type'] | |
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/sect-using_the_mount_command-mounting | |
options 'defaults,noquota,nodev,nosuid' | |
action [:remount, :enable] | |
end | |
end | |
describe etc_fstab.where { mount_point == '/tmp' } do | |
its('mount_options') { should include 'noexec' } | |
its('mount_options') { should include 'nodev' } | |
its('mount_options') { should include 'nosuid' } | |
# Make sure default options aren't overridden | |
its('mount_options') { should include 'rw' } | |
its('mount_options') { should include 'noquota' } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment