Run non-interactive by default, use --wait to enforce waiting after finishing a group of tests

This commit is contained in:
Michael Boelen 2019-07-12 14:38:52 +02:00
parent c31c6a5a9e
commit 76e84f4b56
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
4 changed files with 16 additions and 9 deletions

View File

@ -67,8 +67,8 @@ profile-name=Default Audit Template
# Number of seconds to pause between every test (0 is no pause) # Number of seconds to pause between every test (0 is no pause)
pause-between-tests=0 pause-between-tests=0
# Quick mode (no waiting for keypresses) # Quick mode (do not wait for keypresses)
quick=no quick=yes
# Refresh software repositories to help detecting vulnerable packages # Refresh software repositories to help detecting vulnerable packages
refresh-repositories=yes refresh-repositories=yes

View File

@ -3,6 +3,5 @@
debug=yes debug=yes
developer-mode=yes developer-mode=yes
quick=yes
strict=yes strict=yes
verbose=yes verbose=yes

View File

@ -233,7 +233,7 @@
# Cronjob support # Cronjob support
--cron-job | --cronjob | --cron) --cron-job | --cronjob | --cron)
CRONJOB=1 CRONJOB=1
CHECK=1; QUICKMODE=1; COLORS=0; NEVERBREAK=1 # Use some defaults (-c, -Q, no colors) CHECK=1; COLORS=0; NEVERBREAK=1 # Use some defaults ('audit system', -Q, no colors)
RemoveColors RemoveColors
;; ;;
@ -345,7 +345,6 @@
# Quiet mode # Quiet mode
--quiet | -q | --silent) --quiet | -q | --silent)
QUIET=1 QUIET=1
QUICKMODE=1 # Run non-interactive
;; ;;
# Non-interactive mode # Non-interactive mode
@ -444,7 +443,6 @@
# Warnings # Warnings
--warnings-only | --show-warnings-only) --warnings-only | --show-warnings-only)
SHOW_WARNINGS_ONLY=1 SHOW_WARNINGS_ONLY=1
QUICKMODE=1
QUIET=1 QUIET=1
;; ;;
@ -465,5 +463,15 @@
done done
# Ensure non-interactive mode when running quietly or as cronjob
if [ ${CRONJOB} -eq 1 -o ${QUIET} -eq 1 ]; then
if [ ${QUICKMODE} -eq 0 ]; then
if [ ${QUIET} -eq 0 ]; then
echo "Switched back to quick mode (cron/non-interactive/quiet)"
fi
QUICKMODE=1
fi
fi
#================================================================================ #================================================================================
# Lynis - Security Auditing and System Hardening for Linux and UNIX - https://cisofy.com # Lynis - Security Auditing and System Hardening for Linux and UNIX - https://cisofy.com

View File

@ -290,9 +290,9 @@
# Quick (no waiting for keypresses) # Quick (no waiting for keypresses)
quick) quick)
# Quick mode (SKIP_PLUGINS) might already be set outside profile, so store in different variable # Quick mode might already be set outside profile, so store in different variable
SETTING_QUICK_MODE=0 # default is no SETTING_QUICK_MODE=1 # default is yes
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)$") && QUICKMODE=1 FIND=$(echo "${VALUE}" | egrep "^(0|false|no)$") && QUICKMODE=0
if [ ! -z "${FIND}" ]; then SETTING_QUICK_MODE=1; fi if [ ! -z "${FIND}" ]; then SETTING_QUICK_MODE=1; fi
Debug "Quickmode set to ${SETTING_QUICK_MODE}" Debug "Quickmode set to ${SETTING_QUICK_MODE}"
AddSetting "quick" "${SETTING_QUICK_MODE}" "Quick mode (non-interactive)" AddSetting "quick" "${SETTING_QUICK_MODE}" "Quick mode (non-interactive)"