Skip to content

Add noexec Option to /home

An XCCDF Rule

Description

The noexec mount option can be used to prevent binaries from being executed out of /home. Add the noexec option to the fourth column of /etc/fstab for the line which controls mounting of /home.

Rationale

The /home directory contains data of individual users. Binaries in this directory should not be considered as trusted and users should not be able to execute them.

ID
xccdf_org.ssgproject.content_rule_mount_option_home_noexec
Severity
Medium
References
Updated



Remediation - Ansible

- name: 'Add noexec Option to /home: Check information associated to mountpoint'
  command: findmnt --fstab '/home'
  register: device_name
  failed_when: device_name.rc > 1
  changed_when: false
  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]

Remediation - Anaconda Pre-Install Instructions


part /home --mountoptions="noexec"

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

function perform_remediation {
    
        # the mount point /home has to be defined in /etc/fstab