Skip to content

Commit 2bc24a9

Browse files
author
Damien Cavagnini
committed
fix: "--only" option in "hardening.sh"
"--only" was broken, it did not match correctly a script passed in only Previously we were checking the numerotation number, we now are using the full script name. Ex: 1.1.1.1_disable_freevxfs.sh Previously: (broken) look up for 1\.1\.1\.1, which could also match 1.1.1.1.1.1.1.1_foo.sh Now: look up for 1.1.1.1_disable_freevxfs.sh
1 parent 231db2b commit 2bc24a9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

bin/hardening.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ fi
319319
for SCRIPT in $(find "${CIS_CHECKS_DIR}"/ -name "*.sh" | sort -V); do
320320
if [ "${#TEST_LIST[@]}" -gt 0 ]; then
321321
# --only X has been specified at least once, is this script in my list ?
322-
SCRIPT_PREFIX=$(grep -Eo '^[0-9.]+' <<<"$(basename "$SCRIPT")")
323-
# shellcheck disable=SC2001
324-
SCRIPT_PREFIX_RE=$(sed -e 's/\./\\./g' <<<"$SCRIPT_PREFIX")
325-
if ! grep -qE "(^|[[:space:]])$SCRIPT_PREFIX_RE([[:space:]]|$)" <<<"${TEST_LIST[@]}"; then
322+
if ! grep -qE $(basename "$SCRIPT") <<<"${TEST_LIST[@]}"; then
326323
# not in the list
327324
continue
328325
fi

0 commit comments

Comments
 (0)