mirror of
https://github.com/ovh/debian-cis.git
synced 2024-12-22 14:05:23 +01:00
CHORE(2.1x): use "readlink -e" instead of custom func
Removed get_partition_from_symlink()
This commit is contained in:
parent
8031c388c6
commit
de7dfe5956
@ -24,7 +24,7 @@ OPTION="nodev"
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
info "Verifying that $PARTITION is a partition"
|
||||
get_partition_from_symlink "$PARTITION"
|
||||
PARTITION=$(readlink -e "$PARTITION")
|
||||
FNRET=0
|
||||
is_a_partition "$PARTITION"
|
||||
if [ $FNRET -gt 0 ]; then
|
||||
|
@ -24,7 +24,7 @@ OPTION="nosuid"
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
info "Verifying that $PARTITION is a partition"
|
||||
get_partition_from_symlink "$PARTITION"
|
||||
PARTITION=$(readlink -e "$PARTITION")
|
||||
FNRET=0
|
||||
is_a_partition "$PARTITION"
|
||||
if [ $FNRET -gt 0 ]; then
|
||||
|
@ -24,7 +24,7 @@ OPTION="noexec"
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
info "Verifying that $PARTITION is a partition"
|
||||
get_partition_from_symlink "$PARTITION"
|
||||
PARTITION=$(readlink -e "$PARTITION")
|
||||
FNRET=0
|
||||
is_a_partition "$PARTITION"
|
||||
if [ $FNRET -gt 0 ]; then
|
||||
|
14
lib/utils.sh
14
lib/utils.sh
@ -288,20 +288,6 @@ is_kernel_option_enabled() {
|
||||
# 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() {
|
||||
|
||||
|
@ -10,8 +10,10 @@ test_audit() {
|
||||
|
||||
describe Partition symlink
|
||||
register_test retvalshouldbe 1
|
||||
register_test contain "[WARN] /run/shm actually is /dev/shm"
|
||||
run resolved /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
# Cleanup
|
||||
rm /run/shm
|
||||
|
||||
# TODO fill comprehensive tests
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ test_audit() {
|
||||
|
||||
describe Partition symlink
|
||||
register_test retvalshouldbe 1
|
||||
register_test contain "[WARN] /run/shm actually is /dev/shm"
|
||||
run resolved /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
# Cleanup
|
||||
rm /run/shm
|
||||
|
||||
# TODO fill comprehensive tests
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ test_audit() {
|
||||
|
||||
describe Partition symlink
|
||||
register_test retvalshouldbe 1
|
||||
register_test contain "[WARN] /run/shm actually is /dev/shm"
|
||||
run resolved /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
# Cleanup
|
||||
rm /run/shm
|
||||
|
||||
# TODO fill comprehensive tests
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user