ovh / debian-cis

PCI-DSS compliant Debian 10/11/12 hardening
Other
756 stars 130 forks source link

flawed functions easily fixed: is_a_partition and has_mount_option #155

Closed xuancong84 closed 1 year ago

xuancong84 commented 2 years ago

The script assumes that all mounted devices are present in /etc/fstab which is NOT true. For example, /dev/shm (same as /run/shm) is usually not present in /etc/fstab, but it is mounted with correct options during system startup. Maybe it is mounted during some earlier-stage boot, e.g., initrd.img

Solution: replace the following lines in lib/utils.sh:

if [ ! -f /etc/fstab ] || [ -z "$(sed '/^#/d' /etc/fstab)" ]; then

by:

if [ ! "`grep $PARTITION /etc/fstab`" ]; then