Skip to content

Add noexec Option to /boot

An XCCDF Rule

Description

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

Rationale

The /boot partition contains the kernel and the bootloader. No binaries should be executed from this partition after the booting process finishes.

ID
xccdf_org.ssgproject.content_rule_mount_option_boot_noexec
Severity
Medium
References
Updated



Remediation - Ansible

- name: 'Add noexec Option to /boot: Check information associated to mountpoint'
  command: findmnt --fstab '/boot'
  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 /boot --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 /boot has to be defined in /etc/fstab