Skip to content

Add nodev Option to /boot

An XCCDF Rule

Description

The nodev mount option can be used to prevent device files from being created in /boot. Legitimate character and block devices should exist only in the /dev directory on the root partition or within chroot jails built for system services. Add the nodev option to the fourth column of /etc/fstab for the line which controls mounting of /boot.

Rationale

The only legitimate location for device files is the /dev directory located on the root partition. The only exception to this is chroot jails.

ID
xccdf_org.ssgproject.content_rule_mount_option_boot_nodev
Severity
Medium
References
Updated



Remediation - Anaconda Pre-Install Instructions


part /boot --mountoptions="nodev"

Remediation - Ansible

- name: 'Add nodev 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 - 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