mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-23 13:54:35 +02:00
Style and readability improvements
This commit is contained in:
parent
2fe1819c35
commit
0993c0a13b
@ -25,15 +25,15 @@
|
|||||||
|
|
||||||
for PROFILE in ${PROFILES}; do
|
for PROFILE in ${PROFILES}; do
|
||||||
LogText "Reading profile/configuration ${PROFILE}"
|
LogText "Reading profile/configuration ${PROFILE}"
|
||||||
FIND=`egrep "^config:|^[a-z-].*=" ${PROFILE} | sed 's/ /!space!/g'`
|
FIND=$(egrep "^config:|^[a-z-].*=" ${PROFILE} | sed 's/ /!space!/g')
|
||||||
for I in ${FIND}; do
|
for CONFIGOPTION in ${FIND}; do
|
||||||
if ContainsString "config:" "${I}"; then
|
if ContainsString "config:" "${CONFIGOPTION}"; then
|
||||||
# Old style configuration
|
# Old style configuration
|
||||||
OPTION=`echo ${I} | cut -d ':' -f2`
|
OPTION=$(echo ${CONFIGOPTION} | cut -d ':' -f2)
|
||||||
VALUE=`echo ${I} | cut -d ':' -f3 | sed 's/!space!/ /g'`
|
VALUE=$(echo ${CONFIGOPTION} | cut -d ':' -f3 | sed 's/!space!/ /g')
|
||||||
else
|
else
|
||||||
OPTION=`echo ${I} | cut -d '=' -f1`
|
OPTION=$(echo ${CONFIGOPTION} | cut -d '=' -f1)
|
||||||
VALUE=`echo ${I} | cut -d '=' -f2 | sed 's/!space!/ /g'`
|
VALUE=$(echo ${CONFIGOPTION} | cut -d '=' -f2 | sed 's/!space!/ /g')
|
||||||
fi
|
fi
|
||||||
Debug "Profile option set: ${OPTION} (with value ${VALUE})"
|
Debug "Profile option set: ${OPTION} (with value ${VALUE})"
|
||||||
|
|
||||||
@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
# Define which compliance standards are enabled
|
# Define which compliance standards are enabled
|
||||||
compliance_standards | check-compliance)
|
compliance_standards | check-compliance)
|
||||||
COMPLIANCE_STANDARDS_ENABLED=`echo ${VALUE} | tr ',' ' '`
|
COMPLIANCE_STANDARDS_ENABLED=$(echo ${VALUE} | tr ',' ' ')
|
||||||
for I in ${COMPLIANCE_STANDARDS_ENABLED}; do
|
for STANDARD in ${COMPLIANCE_STANDARDS_ENABLED}; do
|
||||||
case $I in
|
case ${STANDARD} in
|
||||||
cis) COMPLIANCE_ENABLE_CIS=1 ; Debug "Compliance scanning for CIS Benchmarks is enabled" ;;
|
cis) COMPLIANCE_ENABLE_CIS=1 ; Debug "Compliance scanning for CIS Benchmarks is enabled" ;;
|
||||||
hipaa) COMPLIANCE_ENABLE_HIPAA=1 ; Debug "Compliance scanning for HIPAA is enabled" ;;
|
hipaa) COMPLIANCE_ENABLE_HIPAA=1 ; Debug "Compliance scanning for HIPAA is enabled" ;;
|
||||||
iso27001) COMPLIANCE_ENABLE_ISO27001=1 ; Debug "Compliance scanning for ISO27001 is enabled" ;;
|
iso27001) COMPLIANCE_ENABLE_ISO27001=1 ; Debug "Compliance scanning for ISO27001 is enabled" ;;
|
||||||
@ -106,21 +106,21 @@
|
|||||||
AddSetting "debian-skip-security-repository" "OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY" "Skip checking for a security repository (Debian and others)"
|
AddSetting "debian-skip-security-repository" "OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY" "Skip checking for a security repository (Debian and others)"
|
||||||
;;
|
;;
|
||||||
debug)
|
debug)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && DEBUG=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && DEBUG=1
|
||||||
Debug "Debug mode set to ${DEBUG}"
|
Debug "Debug mode set to ${DEBUG}"
|
||||||
AddSetting "debug" "${DEBUG}" "Debugging mode"
|
AddSetting "debug" "${DEBUG}" "Debugging mode"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Development mode (--developer)
|
# Development mode (--developer)
|
||||||
developer-mode)
|
developer-mode)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && DEVELOPER_MODE=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && DEVELOPER_MODE=1
|
||||||
Debug "Developer mode set to ${DEVELOPER_MODE}"
|
Debug "Developer mode set to ${DEVELOPER_MODE}"
|
||||||
AddSetting "developer" "${DEVELOPER_MODE}" "Developer mode"
|
AddSetting "developer" "${DEVELOPER_MODE}" "Developer mode"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Show non-zero exit code when errors are found
|
# Show non-zero exit code when errors are found
|
||||||
error-on-warnings)
|
error-on-warnings)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && ERROR_ON_WARNINGS=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && ERROR_ON_WARNINGS=1
|
||||||
Debug "Exit with different code on warnings is set to ${ERROR_ON_WARNINGS}"
|
Debug "Exit with different code on warnings is set to ${ERROR_ON_WARNINGS}"
|
||||||
AddSetting "error-on-warnings" "${ERROR_ON_WARNINGS}" "Use non-zero exit code if one or more warnings were found"
|
AddSetting "error-on-warnings" "${ERROR_ON_WARNINGS}" "Use non-zero exit code if one or more warnings were found"
|
||||||
;;
|
;;
|
||||||
@ -201,7 +201,7 @@
|
|||||||
quick)
|
quick)
|
||||||
# Quick mode (SKIP_PLUGINS) might already be set outside profile, so store in different variable
|
# Quick mode (SKIP_PLUGINS) might already be set outside profile, so store in different variable
|
||||||
SETTING_QUICK_MODE=0 # default is no
|
SETTING_QUICK_MODE=0 # default is no
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)$"` && QUICKMODE=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)$") && QUICKMODE=1
|
||||||
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)"
|
||||||
@ -210,7 +210,7 @@
|
|||||||
# Inline tips about tool (default enabled)
|
# Inline tips about tool (default enabled)
|
||||||
show_tool_tips | show-tool-tips)
|
show_tool_tips | show-tool-tips)
|
||||||
SETTING_SHOW_TOOL_TIPS=1 # default is yes
|
SETTING_SHOW_TOOL_TIPS=1 # default is yes
|
||||||
FIND=`echo "${VALUE}" | egrep "^(0|false|no)$"` && SHOW_TOOL_TIPS=0
|
FIND=$(echo "${VALUE}" | egrep "^(0|false|no)$") && SHOW_TOOL_TIPS=0
|
||||||
if [ ! -z "${FIND}" ]; then SETTING_QUICK_MODE=0; fi
|
if [ ! -z "${FIND}" ]; then SETTING_QUICK_MODE=0; fi
|
||||||
Debug "Show tool tips set to ${SETTING_SHOW_TOOL_TIPS}"
|
Debug "Show tool tips set to ${SETTING_SHOW_TOOL_TIPS}"
|
||||||
AddSetting "show-tool-tips" "${SETTING_SHOW_TOOL_TIPS}" "Show tool tips"
|
AddSetting "show-tool-tips" "${SETTING_SHOW_TOOL_TIPS}" "Show tool tips"
|
||||||
@ -220,7 +220,7 @@
|
|||||||
show-warnings-only)
|
show-warnings-only)
|
||||||
QUIET=1
|
QUIET=1
|
||||||
QUICKMODE=1
|
QUICKMODE=1
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)$"` && SHOW_WARNINGS_ONLY=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)$") && SHOW_WARNINGS_ONLY=1
|
||||||
Debug "Show warnings only set to ${SHOW_WARNINGS_ONLY}"
|
Debug "Show warnings only set to ${SHOW_WARNINGS_ONLY}"
|
||||||
AddSetting "show-warnings-only" "${SHOW_WARNINGS_ONLY}" "Show only warnings"
|
AddSetting "show-warnings-only" "${SHOW_WARNINGS_ONLY}" "Show only warnings"
|
||||||
;;
|
;;
|
||||||
@ -229,7 +229,7 @@
|
|||||||
skip-plugins)
|
skip-plugins)
|
||||||
# Skip plugins (SKIP_PLUGINS) might already be set, so store in different variable
|
# Skip plugins (SKIP_PLUGINS) might already be set, so store in different variable
|
||||||
SETTING_SKIP_PLUGINS=0 # default is no
|
SETTING_SKIP_PLUGINS=0 # default is no
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)$"` && SKIP_PLUGINS=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)$") && SKIP_PLUGINS=1
|
||||||
if [ ! -z "${FIND}" ]; then SETTING_SKIP_PLUGINS=1; fi
|
if [ ! -z "${FIND}" ]; then SETTING_SKIP_PLUGINS=1; fi
|
||||||
Debug "Skip plugins is set to ${SETTING_SKIP_PLUGINS}"
|
Debug "Skip plugins is set to ${SETTING_SKIP_PLUGINS}"
|
||||||
AddSetting "skip-plugins" "${SETTING_SKIP_PLUGINS}" "Skip plugins"
|
AddSetting "skip-plugins" "${SETTING_SKIP_PLUGINS}" "Skip plugins"
|
||||||
@ -244,20 +244,20 @@
|
|||||||
|
|
||||||
# Which tests to skip (skip-test=ABCD-1234 or skip-test=ABCD-1234:subtest)
|
# Which tests to skip (skip-test=ABCD-1234 or skip-test=ABCD-1234:subtest)
|
||||||
skip-test)
|
skip-test)
|
||||||
STRING=`echo ${VALUE} | tr '[:lower:]' '[:upper:]'`
|
STRING=$(echo ${VALUE} | tr '[:lower:]' '[:upper:]')
|
||||||
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
|
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Do not check the latest version on the internet
|
# Do not check the latest version on the internet
|
||||||
skip_upgrade_test | skip-upgrade-test)
|
skip_upgrade_test | skip-upgrade-test)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && SKIP_UPGRADE_TEST=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && SKIP_UPGRADE_TEST=1
|
||||||
Debug "Skip upgrade test set to ${SKIP_UPGRADE_TEST}"
|
Debug "Skip upgrade test set to ${SKIP_UPGRADE_TEST}"
|
||||||
AddSetting "skip-upgrade-test" "${SKIP_UPGRADE_TEST}" "Skip upgrade test"
|
AddSetting "skip-upgrade-test" "${SKIP_UPGRADE_TEST}" "Skip upgrade test"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Set strict mode for development and quality purposes
|
# Set strict mode for development and quality purposes
|
||||||
strict)
|
strict)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && SET_STRICT=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && SET_STRICT=1
|
||||||
AddSetting "strict" "${SET_STRICT}" "Perform strict test of scripts"
|
AddSetting "strict" "${SET_STRICT}" "Perform strict test of scripts"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -351,7 +351,7 @@
|
|||||||
|
|
||||||
# Verbose output (--verbose)
|
# Verbose output (--verbose)
|
||||||
verbose)
|
verbose)
|
||||||
FIND=`echo "${VALUE}" | egrep "^(1|true|yes)"` && VERBOSE=1
|
FIND=$(echo "${VALUE}" | egrep "^(1|true|yes)") && VERBOSE=1
|
||||||
Debug "Verbose set to ${VERBOSE}"
|
Debug "Verbose set to ${VERBOSE}"
|
||||||
AddSetting "verbose" "${VERBOSE}" "Verbose output"
|
AddSetting "verbose" "${VERBOSE}" "Verbose output"
|
||||||
;;
|
;;
|
||||||
@ -362,7 +362,7 @@
|
|||||||
|
|
||||||
# Deprecated: skip tests
|
# Deprecated: skip tests
|
||||||
test_skip_always)
|
test_skip_always)
|
||||||
STRING=`echo ${VALUE} | tr '[:lower:]' '[:upper:]'`
|
STRING=$(echo ${VALUE} | tr '[:lower:]' '[:upper:]')
|
||||||
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
|
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
|
||||||
LogText "[deprecated option] Tests to be skipped: ${VALUE}"
|
LogText "[deprecated option] Tests to be skipped: ${VALUE}"
|
||||||
DisplayToolTip "Replace deprecated option 'test_skip_always' and replace with 'skip-test' (add to custom.prf)"
|
DisplayToolTip "Replace deprecated option 'test_skip_always' and replace with 'skip-test' (add to custom.prf)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user