TMAegis
More rules for linux

TMA-ROCKY9-1.1.1.1

Ensure cramfs kernel module is not available

MediumLevel 1Automatedlinux

Description

The cramfs filesystem type is a compressed read-only Linux filesystem embedded in small footprint systems. A cramfs image can be used without having to first decompress the image.

How it is checked

Audit method: Shell command

shell
m=cramfs; found=$(find /lib/modules/$(uname -r)/kernel /usr/lib/modules/$(uname -r)/kernel -path "*/cramfs*" 2>/dev/null | head -n1); if [ -z "$found" ]; then echo compliant; exit 0; fi; lsmod | awk '{print $1}' | grep -Fxq -- "${m//-/_}" && { echo "$m is loaded"; exit 0; }; cfg=$(modprobe --showconfig 2>/dev/null); printf '%s\n' "$cfg" | grep -Pq -- "^\h*blacklist\h+${m//-/_}\b" || { echo "$m is not blacklisted"; exit 0; }; printf '%s\n' "$cfg" | grep -Pq -- "^\h*install\h+${m//-/_}\h+(/usr)?/bin/(true|false)\b" || { echo "$m install is not disabled"; exit 0; }; echo compliant
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

Unload and disable the cramfs kernel module. 1. Run the following commands to unload the cramfs kernel module: # modprobe -r cramfs 2>/dev/null # rmmod cramfs 2>/dev/null 2. Perform the following to disable the cramfs kernel module: Create a file ending in .conf with install cramfs /bin/false in the /etc/modprobe.d/ directory. Example: # printf '%s\n' "" "install cramfs /bin/false" >> /etc/modprobe.d/60- cramfs.conf Create a file ending in .conf with blacklist cramfs in the /etc/modprobe.d/ directory. Example: # printf '%s\n' "" "blacklist cramfs" >> /etc/modprobe.d/60-cramfs.conf

Properties

Operating systems
rocky-9
Tags
cis-convertedkernellinuxmodules
Reference
CIS Rocky Linux 9 Benchmark v3.0.0 - 1.1.1.1

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target linux