mirror of
https://github.com/ovh/debian-cis.git
synced 2025-06-21 18:23:42 +02:00
IMP(2.1x): Retrieve actual partition when symlink
Add function to retrieve actual partition from symlink in lib/utils.sh Using this func in all 3 audit scripts Improved tests to test this func Apply shellcheck recommendations Trim trailing spaces
This commit is contained in:
16
lib/utils.sh
16
lib/utils.sh
@ -258,9 +258,23 @@ is_kernel_option_enabled() {
|
||||
}
|
||||
|
||||
#
|
||||
# Mounting point
|
||||
# Mounting point
|
||||
#
|
||||
|
||||
get_partition_from_symlink() {
|
||||
local local_partition="$1"
|
||||
if [ ! -e "$local_partition" ]; then
|
||||
return
|
||||
fi
|
||||
filetype=$(stat -c %F "$local_partition")
|
||||
if [ "$filetype" == "symbolic link" ]; then
|
||||
actual_partition=$(readlink "$local_partition" )
|
||||
warn "$local_partition actually is $actual_partition"
|
||||
local_partition="$actual_partition"
|
||||
fi
|
||||
PARTITION="$local_partition"
|
||||
}
|
||||
|
||||
# Verify $1 is a partition declared in fstab
|
||||
is_a_partition() {
|
||||
|
||||
|
Reference in New Issue
Block a user