Profile Applicability:
• Level 1
Description:
The nodev mount option prevents device files from being interpreted on the mounted filesystem. Applying this option to /var/log restricts the creation and use of device files in the log directory, reducing security risks.
Rationale:
Setting the nodev option on /var/log helps prevent attackers from creating device files that can be exploited for privilege escalation or unauthorized access.
Impact:
Pros:
Prevents device file exploitation on /var/log.
Improves overall system security posture.
Cons:
May affect rare legitimate uses of device files in /var/log.
Default Value:
By default, nodev is usually not set on /var/log unless explicitly configured.
Pre-requisites:
Root or sudo privileges to modify /etc/fstab and remount filesystems.
/var/log must be mounted as a separate partition.
Remediation:
Test Plan:
Using Linux command line:
Check current mount options for /var/log:
mount | grep /var/log
Verify if nodev is included in /etc/fstab for /var/log:
grep /var/log /etc/fstab
Expected output: Mount options for /var/log include nodev.
Implementation Plan:
Using Linux command line:
- Edit /etc/fstab to add nodev to /var/log mount options. Example:
/dev/<partition> /var/log ext4 defaults,nodev,nosuid,noexec 0 0
Remount /var/log with new options without reboot:
mount -o remount,nodev /var/log
Verify mount options:
mount | grep /var/log
Backout Plan:
Using Linux command line:
Remove nodev from /var/log mount options in /etc/fstab.
Remount /var/log without nodev:
mount -o remount /var/log
Verify mount options:
mount | grep /var/log
References:
CIS Amazon Linux 2 Benchmark v3.0.0