mirror of
https://github.com/ovh/debian-cis.git
synced 2024-12-23 14:35:26 +01:00
FIX: usage if no RUN_MODE, fix only that used to run too many checks
If no RUN_MODE passed as arguments, display usage and exits Fix --only option to run only specific check Found bug that used to run 2.2 and 2.24 when launching --only 2.24
This commit is contained in:
parent
2421d96ae2
commit
7e3ee2eb93
@ -155,6 +155,11 @@ while [[ $# > 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# if no RUN_MODE was passed, usage and quit
|
||||||
|
if [ "$AUDIT" -eq 0 -a "$AUDIT_ALL" -eq 0 -a "$AUDIT_ALL_ENABLE_PASSED" -eq 0 -a "$APPLY" -eq 0 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
# Source Root Dir Parameter
|
# Source Root Dir Parameter
|
||||||
if [ -r /etc/default/cis-hardening ]; then
|
if [ -r /etc/default/cis-hardening ]; then
|
||||||
. /etc/default/cis-hardening
|
. /etc/default/cis-hardening
|
||||||
@ -211,7 +216,7 @@ for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh -v); do
|
|||||||
# --only X has been specified at least once, is this script in my list ?
|
# --only X has been specified at least once, is this script in my list ?
|
||||||
SCRIPT_PREFIX=$(grep -Eo '^[0-9.]+' <<< "$(basename $SCRIPT)")
|
SCRIPT_PREFIX=$(grep -Eo '^[0-9.]+' <<< "$(basename $SCRIPT)")
|
||||||
SCRIPT_PREFIX_RE=$(sed -e 's/\./\\./g' <<< "$SCRIPT_PREFIX")
|
SCRIPT_PREFIX_RE=$(sed -e 's/\./\\./g' <<< "$SCRIPT_PREFIX")
|
||||||
if ! grep -qE "(^| )$SCRIPT_PREFIX_RE" <<< "${TEST_LIST[@]}"; then
|
if ! grep -qwE "(^| )$SCRIPT_PREFIX_RE" <<< "${TEST_LIST[@]}"; then
|
||||||
# not in the list
|
# not in the list
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user