mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-25 23:11:24 +01:00
FIX(99.2): add missing $SUDO_CMD
This commit is contained in:
parent
6ede832685
commit
d18f5edfba
@ -23,9 +23,9 @@ audit () {
|
||||
SEARCH_RES=0
|
||||
for FILE_SEARCHED in $FILES_TO_SEARCH; do
|
||||
if [ $SEARCH_RES = 1 ]; then break; fi
|
||||
if test -d $FILE_SEARCHED; then
|
||||
if $SUDO_CMD test -d $FILE_SEARCHED; then
|
||||
debug "$FILE_SEARCHED is a directory"
|
||||
for file_in_dir in $(ls $FILE_SEARCHED); do
|
||||
for file_in_dir in $( $SUDO_CMD ls $FILE_SEARCHED); do
|
||||
does_pattern_exist_in_file "$FILE_SEARCHED/$file_in_dir" "^$PATTERN"
|
||||
if [ $FNRET != 0 ]; then
|
||||
debug "$PATTERN is not present in $FILE_SEARCHED/$file_in_dir"
|
||||
|
20
tests/hardening/99.2_disable_usb_devices.sh
Normal file
20
tests/hardening/99.2_disable_usb_devices.sh
Normal file
@ -0,0 +1,20 @@
|
||||
# run-shellcheck
|
||||
test_audit() {
|
||||
|
||||
mkdir /etc/udev/rules.d
|
||||
chmod -R 700 /etc/udev
|
||||
|
||||
describe Running on blank host
|
||||
register_test retvalshouldbe 0
|
||||
dismiss_count_for_test
|
||||
# shellcheck disable=2154
|
||||
run blank /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
echo 'ACTION=="add", SUBSYSTEMS=="usb", TEST=="authorized_default", ATTR{authorized_default}="0"' > /etc/udev/rules.d/10-CIS_99.2_usb_devices.sh
|
||||
|
||||
describe compliant
|
||||
register_test retvalshouldbe 0
|
||||
run compliant /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
# TODO fill comprehensive tests
|
||||
}
|
Loading…
Reference in New Issue
Block a user