lynis/include/profiles

563 lines
27 KiB
Plaintext
Raw Normal View History

2014-08-26 17:33:55 +02:00
#!/bin/sh
#################################################################################
#
# Lynis
# ------------------
#
2016-03-13 16:00:39 +01:00
# Copyright 2007-2013, Michael Boelen
2020-03-20 14:50:25 +01:00
# Copyright 2007-2020, CISOfy
2016-03-13 16:00:39 +01:00
#
# Website : https://cisofy.com
# Blog : http://linux-audit.com
# GitHub : https://github.com/CISOfy/lynis
2014-08-26 17:33:55 +02:00
#
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
# welcome to redistribute it under the terms of the GNU General Public License.
# See LICENSE file for usage of this software.
#
#################################################################################
#
# Read profile/template
#
#################################################################################
#
# Set default values (should be equal to default.prf)
SETTING_LOG_TESTS_INCORRECT_OS=1
SETTING_SHOW_REPORT_SOLUTION=0
2018-01-23 14:29:37 +01:00
DEPRECATED_OPTION=""
2016-08-13 09:45:38 +02:00
#
#################################################################################
#
2016-04-07 16:25:11 +02:00
for PROFILE in ${PROFILES}; do
LogText "Reading profile/configuration ${PROFILE}"
2019-07-18 11:47:24 +02:00
# Show deprecation message for old config entries such as 'config:' and 'apache:'
FOUND=0
2019-09-19 14:05:15 +02:00
DATA=$(grep -E "^[a-z-]{1,}:" ${PROFILE} | od -An -ta | sed 's/ /!space!/g') # od -An (no file offset), -ta (named character, to be on safe side)
if ! IsEmpty "${DATA}"; then FOUND=1; fi
if [ ${FOUND} -eq 1 ]; then
Display --text " "
Display --text "=================================================================================================="
DisplayWarning "Your profile contains old-style configuration entries. See log file for more details and how to convert these entries"
Display --indent 2 --text "* ${RED}ISSUE${NORMAL}"
Display --indent 2 --text "Your profile has one or more lines that are in an old format (key:value). They need to be converted into the new format (key=value) or disabled."
Display --text " "
Display --indent 2 --text "* ${GREEN}HOW TO RESOLVE${NORMAL}"
Display --indent 2 --text "Use grep to see the relevant matches (grep -E \"^[a-z-]{1,}:\" custom.prf)"
Display --text " "
Display --text "=================================================================================================="
Display --text " "
LogText "Insight: Profile '${PROFILE}' contians one or more old-style configuration entries"
ReportWarning "GEN-0020" "Your profile contains one or more old-style configuration entries"
sleep 10
fi
# Security check for unexpected and possibly harmful escape characters (hyphen should be listed as first or last character)
DATA=$(grep -Ev '^$|^ |^#|^config:' "${PROFILE}" | tr -d '[:alnum:]/\[\]\(\)_\|,\.:;= \n\r-' | od -An -ta | sed 's/ /!space!/g')
if ! IsEmpty "${DATA}"; then
DisplayWarning "Your profile '${PROFILE}' contains unexpected characters. See the log file for more information."
LogText "Found unexpected or possibly harmful characters in profile '${PROFILE}'. See which characters matched in the output below and compare them with your profile."
2019-09-19 14:05:15 +02:00
for I in ${DATA}; do
I=$(echo ${I} | sed 's/!space!/ /g')
LogText "Output: ${I}"
done
LogText "Suggestion: comment incorrect lines with a '#' and try again. Open a GitHub issue if valid characters are blocked"
ExitFatal "unexpected characters in profile. Stopping execution (security measure)"
fi
# Now parse the profile and filter out unwanted characters
2019-09-19 14:05:15 +02:00
DATA=$(grep -E "^config:|^[a-z-].*=" ${PROFILE} | tr -dc '[:alnum:]/\[\]\(\)_\|,\.:;= \n\r-' | sed 's/ /!space!/g')
for CONFIGOPTION in ${DATA}; do
if ContainsString "^config:" "${CONFIGOPTION}"; then
# Old style configuration
2016-07-31 15:58:20 +02:00
OPTION=$(echo ${CONFIGOPTION} | cut -d ':' -f2)
VALUE=$(echo ${CONFIGOPTION} | cut -d ':' -f3 | sed 's/!space!/ /g')
2018-01-23 14:29:37 +01:00
DEPRECATED_OPTION="${OPTION}"
else
2016-07-31 15:58:20 +02:00
OPTION=$(echo ${CONFIGOPTION} | cut -d '=' -f1)
VALUE=$(echo ${CONFIGOPTION} | cut -d '=' -f2 | sed 's/!space!/ /g')
fi
2016-04-19 12:38:00 +02:00
Debug "Profile option set: ${OPTION} (with value ${VALUE})"
2016-04-07 16:25:11 +02:00
case ${OPTION} in
# Is Lynis Enterprise allowed to purge this system when it is becomes outdated?
allow-auto-purge)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)$")
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then
Report "allow-auto-purge=1"
else
Report "allow-auto-purge=0"
fi
;;
2016-04-07 16:25:11 +02:00
# Define which compliance standards are enabled
# For this to work, the Enterprise plugins are needed
compliance_standards | compliance-standards | check-compliance) # deprecated: compliance_standards
2016-07-31 15:58:20 +02:00
COMPLIANCE_STANDARDS_ENABLED=$(echo ${VALUE} | tr ',' ' ')
for STANDARD in ${COMPLIANCE_STANDARDS_ENABLED}; do
case ${STANDARD} in
2016-04-07 16:25:11 +02:00
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" ;;
iso27001) COMPLIANCE_ENABLE_ISO27001=1 ; Debug "Compliance scanning for ISO27001 is enabled" ;;
pci-dss) COMPLIANCE_ENABLE_PCI_DSS=1 ; Debug "Compliance scanning for PCI DSS is enabled" ;;
*) LogText "Result: Unknown compliance standard configured" ;;
2016-04-07 16:25:11 +02:00
esac
done
;;
# Check for a specific value
check-value)
STRING=$(echo ${VALUE} | tr -d "[" | tr -d "]" | sed "s/, /,/g")
CHECK_VALUE_ARRAY="${CHECK_OPTION_ARRAY} ${STRING}"
;;
# Colored output
colors)
# Quick mode (SKIP_PLUGINS) might already be set outside profile, so store in different variable
SETTING_COLORS=1 # default is yes
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)$") && COLORS=0
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_COLORS=0; RemoveColors; fi
Debug "Colors set to ${SETTING_COLORS}"
AddSetting "colors" "${SETTING_COLORS}" "Colored screen output"
unset SETTING_COLORS
;;
# Ignore configuration data
config-data | permdir | permfile)
Debug "Ignoring configuration option, as it will be used by a specific test"
;;
2016-04-07 16:25:11 +02:00
# Maximum number of WAITing connections
connections-max-wait-state | connections_max_wait_state)
2016-04-07 16:25:11 +02:00
OPTIONS_CONN_MAX_WAIT_STATE="${VALUE}"
AddSetting "connections-max-wait-state" "${OPTIONS_CONN_MAX_WAIT_STATE}" "Connections (max-wait-state)"
2016-04-07 16:25:11 +02:00
;;
# Append something to URL for control information
2016-08-13 09:48:56 +02:00
control-url-append | control_url_append)
2016-04-07 16:25:11 +02:00
CONTROL_URL_APPEND="${VALUE}"
AddSetting "control-url-append" "${CONTROL_URL_APPEND}" "Control URL (append)"
2016-04-07 16:25:11 +02:00
;;
# Prepend an URL before control information link
2016-08-13 09:48:56 +02:00
control-url-prepend | control_url_prepend)
2016-04-07 16:25:11 +02:00
CONTROL_URL_PREPEND="${VALUE}"
AddSetting "control-url-prepend" "${CONTROL_URL_PREPEND}" "Control URL (prepend)"
2016-04-07 16:25:11 +02:00
;;
# Protocol to use for control information link
2016-08-13 09:48:56 +02:00
control-url-protocol | control_url_protocol)
2016-04-07 16:25:11 +02:00
CONTROL_URL_PROTOCOL="${VALUE}"
AddSetting "control-url-protocol" "${CONTROL_URL_PREPEND}" "Control URL (protocol)"
2016-04-07 16:25:11 +02:00
;;
# Append something to URL for control information (only applies to CUST-*)
custom-url-append | custom_url_append)
2016-04-07 16:25:11 +02:00
CUSTOM_URL_APPEND="${VALUE}"
AddSetting "custom-url-append" "${CUSTOM_URL_APPEND}" "Custom URL (append)"
2016-04-07 16:25:11 +02:00
;;
# Prepend an URL before control information link (only applies to CUST-*)
custom-url-prepend | custom_url_prepend)
2016-04-07 16:25:11 +02:00
CUSTOM_URL_PREPEND="${VALUE}"
AddSetting "custom-url-prepend" "${CUSTOM_URL_PREPEND}" "Custom URL (prepend)"
2016-04-07 16:25:11 +02:00
;;
# Protocol to use for control information link
custom-url-protocol | custom_url_protocol)
2016-04-07 16:25:11 +02:00
CUSTOM_URL_PROTOCOL="${VALUE}"
AddSetting "custom-url-protocol" "${CUSTOM_URL_PREPEND}" "Custom URL (protocol)"
2016-04-07 16:25:11 +02:00
;;
# Do not check security repository in sources.list (Debian/Ubuntu)
2016-08-13 09:53:14 +02:00
debian-skip-security-repository | debian_skip_security_repository)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY=1
AddSetting "debian-skip-security-repository" "OPTION_DEBIAN_SKIP_SECURITY_REPOSITORY" "Skip checking for a security repository (Debian and others)"
2016-04-07 16:25:11 +02:00
;;
2016-08-13 09:51:02 +02:00
# Debug status to show more details while running program
2016-04-07 16:25:11 +02:00
debug)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && DEBUG=1
2016-07-31 20:58:29 +02:00
Debug "Debug mode set to '${DEBUG}'"
AddSetting "debug" "${DEBUG}" "Debugging mode"
2016-04-07 16:25:11 +02:00
;;
# Development mode (--developer)
developer-mode)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && DEVELOPER_MODE=1
Debug "Developer mode set to ${DEVELOPER_MODE}"
AddSetting "developer" "${DEVELOPER_MODE}" "Developer mode"
;;
# Show non-zero exit code when errors are found
error-on-warnings)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && ERROR_ON_WARNINGS=1
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"
;;
2016-04-07 16:25:11 +02:00
# Skip FreeBSD port audit
2016-08-13 09:53:14 +02:00
freebsd-skip-portaudit | freebsd_skip_portaudit)
LogText "Option set: Skip FreeBSD portaudit"
2016-04-07 16:25:11 +02:00
OPTION_FREEBSD_SKIP_PORTAUDIT="${VALUE}"
;;
2019-09-21 16:31:06 +02:00
# Lynis Enterprise: group name - deprecated option
2016-04-07 16:25:11 +02:00
group)
GROUP_NAME="${VALUE}"
AddSetting "group" "${GROUP_NAME}" "Group"
2018-01-23 14:29:37 +01:00
DEPRECATED_OPTION="group"
2016-04-07 16:25:11 +02:00
;;
hostalias | host-alias)
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then Report "hostname_alias=${VALUE}"; fi
;;
hostid)
HOSTID="${VALUE}"
;;
hostid2)
HOSTID2="${VALUE}"
;;
# Home directories to ignore during scans
ignore-home-dir)
Report "ignore-home-dir[]=${VALUE}"
;;
2016-06-11 14:09:41 +02:00
# Language
language | lang)
2016-07-31 20:58:29 +02:00
LogText "Language set via profile to '${VALUE}'"
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then LANGUAGE="${VALUE}"; fi
AddSetting "language" "${LANGUAGE}" "Language"
2016-06-11 14:09:41 +02:00
;;
2016-04-07 16:25:11 +02:00
# Lynis Enterprise license key
2017-10-24 14:15:59 +02:00
license-key | license_key)
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then
LICENSE_KEY="${VALUE}"
Report "license_key=${VALUE}"
fi
AddSetting "license-key" "${VALUE}" "License key"
2016-04-07 16:25:11 +02:00
;;
# Do (not) log tests if they have an different operating system
2016-08-13 09:53:14 +02:00
log-tests-incorrect-os | log_tests_incorrect_os)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)") && SETTING_LOG_TESTS_INCORRECT_OS=0
Debug "Logging of tests with incorrect operating system set to ${SETTING_LOG_TESTS_INCORRECT_OS}"
LOG_INCORRECT_OS=${SETTING_LOG_TESTS_INCORRECT_OS}
2016-04-07 16:25:11 +02:00
;;
# What type of machine we are scanning (eg. personal, workstation or server)
machine-role | machine_role)
2016-04-07 16:25:11 +02:00
MACHINE_ROLE="${VALUE}"
AddSetting "machine-role" "${MACHINE_ROLE}" "Machine role (personal, workstation or server)"
2016-04-07 16:25:11 +02:00
;;
# Define if any found NTP daemon instance is configured as a server or client
ntpd-role | ntpd_role)
2016-04-07 16:25:11 +02:00
NTPD_ROLE="${VALUE}"
AddSetting "ntpd-role" "${NTPD_ROLE}" "NTP role (server or client)"
2016-04-07 16:25:11 +02:00
;;
# How much seconds to wait between tests
pause_between_tests | pause-between-tests)
2016-04-07 16:25:11 +02:00
TEST_PAUSE_TIME="${VALUE}"
AddSetting "pause-between-tests" "${TEST_PAUSE_TIME}" "Pause between tests (in seconds)"
2016-04-07 16:25:11 +02:00
;;
# Plugin
plugin)
2016-07-31 20:58:29 +02:00
LogText "Plugin '${VALUE}' enabled according profile (${PROFILE})"
;;
disable-plugin)
LogText "Plugin '${VALUE}' disabled according profile (${PROFILE})"
DISABLED_PLUGINS="${DISABLED_PLUGINS} ${VALUE}"
;;
# Plugin directory
plugindir | plugin-dir)
if IsEmpty "${PLUGINDIR}"; then
PLUGINDIR="${VALUE}"
else
LogText "Plugin directory was already set to ${PLUGINDIR} before (most likely as a program argument), not overwriting"
fi
AddSetting "plugin-dir" "${PLUGINDIR}" "Plugin directory"
;;
2016-04-07 16:25:11 +02:00
# Profile name
profile-name | profile_name)
2016-04-07 16:25:11 +02:00
PROFILE_NAME="${VALUE}"
;;
2016-04-19 12:03:48 +02:00
# Quick (no waiting for keypresses)
quick)
# Quick mode might already be set outside profile, so store in different variable
SETTING_QUICK_MODE=1 # default is yes
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)$") && QUICKMODE=0
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_QUICK_MODE=1; fi
Debug "Quickmode set to ${SETTING_QUICK_MODE}"
AddSetting "quick" "${SETTING_QUICK_MODE}" "Quick mode (non-interactive)"
2016-04-19 12:03:48 +02:00
;;
2016-08-11 10:01:29 +02:00
# Refresh software repositories
refresh-repositories)
SETTING_REFRESH_REPOSITORIES=1 # default is yes
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)$") && REFRESH_REPOSITORIES=0
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_REFRESH_REPOSITORIES=0; fi
2016-08-11 10:01:29 +02:00
Debug "Refreshing repositories set to ${SETTING_REFRESH_REPOSITORIES}"
AddSetting "refresh-repositories" "${SETTING_REFRESH_REPOSITORIES}" "Refresh repositories (for vulnerable package detection)"
;;
2016-08-13 09:45:38 +02:00
# Show more details in report
show-report-solution)
2016-09-24 15:51:05 +02:00
SETTING_SHOW_REPORT_SOLUTION=${SHOW_REPORT_SOLUTION}
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)$") && SHOW_REPORT_SOLUTION=0
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_SHOW_REPORT_SOLUTION=0; fi
2016-08-13 09:45:38 +02:00
Debug "Show report details (solution) set to ${SETTING_SHOW_REPORT_SOLUTION}"
;;
# Inline tips about tool (default enabled)
show_tool_tips | show-tool-tips)
SETTING_SHOW_TOOL_TIPS=1 # default is yes
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(0|false|no)$") && SHOW_TOOL_TIPS=0
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_SHOW_TOOL_TIPS=0; fi
Debug "Show tool tips set to ${SETTING_SHOW_TOOL_TIPS}"
AddSetting "show-tool-tips" "${SETTING_SHOW_TOOL_TIPS}" "Show tool tips"
2016-04-07 16:25:11 +02:00
;;
# Show warnings only
show-warnings-only)
QUIET=1
QUICKMODE=1
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)$") && SHOW_WARNINGS_ONLY=1
Debug "Show warnings only set to ${SHOW_WARNINGS_ONLY}"
AddSetting "show-warnings-only" "${SHOW_WARNINGS_ONLY}" "Show only warnings"
;;
# Skip plugins
skip-plugins)
# Skip plugins (SKIP_PLUGINS) might already be set, so store in different variable
SETTING_SKIP_PLUGINS=0 # default is no
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)$") && SKIP_PLUGINS=1
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_SKIP_PLUGINS=1; fi
Debug "Skip plugins is set to ${SETTING_SKIP_PLUGINS}"
AddSetting "skip-plugins" "${SETTING_SKIP_PLUGINS}" "Skip plugins"
;;
2016-04-19 12:38:00 +02:00
# Which tests to skip (skip-test=ABCD-1234 or skip-test=ABCD-1234:subtest)
skip-test)
2016-07-31 15:58:20 +02:00
STRING=$(echo ${VALUE} | tr '[:lower:]' '[:upper:]')
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
2016-04-19 12:38:00 +02:00
;;
2016-04-07 16:25:11 +02:00
# Do not check the latest version on the internet
skip_upgrade_test | skip-upgrade-test)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && SKIP_UPGRADE_TEST=1
Debug "Skip upgrade test set to ${SKIP_UPGRADE_TEST}"
2016-04-07 16:25:11 +02:00
;;
# SSL paths
ssl-certificate-paths)
SSL_CERTIFICATE_PATHS="${VALUE}"
Debug "SSL paths set to ${SSL_CERTIFICATE_PATHS}"
AddSetting "ssl-certificate-paths" "${SSL_CERTIFICATE_PATHS}" "Paths for SSL certificates"
;;
ssl-certificate-paths-to-ignore)
# Retrieve paths to ignore when searching for certificates. Strip special characters, replace possible spaces
2019-07-08 21:19:28 +02:00
SSL_CERTIFICATE_PATHS_TO_IGNORE=$(echo ${VALUE} | tr -d '[:cntrl:]' | sed 's/ /__space__/g' | tr ':' ' ')
Debug "SSL paths to ignore: ${SSL_CERTIFICATE_PATHS_TO_IGNORE}"
AddSetting "ssl-certificate-paths-to-ignore" "${SSL_CERTIFICATE_PATHS_TO_IGNORE}" "Paths that should be ignored for SSL certificates"
;;
# Check also certificates provided by packages?
ssl-certificate-include-packages)
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && SSL_CERTIFICATE_INCLUDE_PACKAGES=1
Debug "Check also certificates provided by packages set to ${SSL_CERTIFICATE_INCLUDE_PACKAGES}"
;;
# Set strict mode for development and quality purposes
strict)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && SET_STRICT=1
;;
# The name of the customer/client that uses this system
system-customer-name)
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then Report "system-customer-name=${VALUE}"; fi
;;
# The groups linked to a system (system-groups=customers,webservers,production)
system-groups)
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then Report "system-groups=${VALUE}"; fi
;;
# Tags (tags=db,production,ssn-1304)
tags)
2019-07-16 13:20:30 +02:00
if [ -n "${VALUE}" ]; then Report "tags=${VALUE}"; fi
;;
2016-04-07 16:25:11 +02:00
# Define what kind of scan we are performing
test_scan_mode | test-scan-mode)
2016-04-07 16:25:11 +02:00
if [ "${VALUE}" = "light" ]; then SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="NO"; SCAN_TEST_HEAVY="NO"; fi
if [ "${VALUE}" = "normal" ]; then SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="YES"; SCAN_TEST_HEAVY="NO"; fi
if [ "${VALUE}" = "full" ]; then SCAN_TEST_LIGHT="YES"; SCAN_TEST_MEDIUM="YES"; SCAN_TEST_HEAVY="YES"; fi
AddSetting "test-scan-mode" "${VALUE}" "Scan mode"
2016-04-07 16:25:11 +02:00
;;
2018-01-23 14:37:02 +01:00
# Perform upload
upload)
SETTING_UPLOAD=no # default
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)$") && UPLOAD_DATA=1
2019-07-16 13:20:30 +02:00
if [ -n "${FIND}" ]; then SETTING_UPLOAD=1; fi
Debug "Upload set to ${SETTING_UPLOAD}"
AddSetting "upload" "${SETTING_UPLOAD}" "Data upload after scanning"
unset SETTING_UPLOAD
;;
2016-04-07 16:25:11 +02:00
# Compression of uploads (enabled by default)
upload_compressed | compressed-uploads)
2016-04-07 16:25:11 +02:00
if [ "${VALUE}" = "0" ]; then COMPRESSED_UPLOADS=0; fi
AddSetting "compressed-uploads" "${COMPRESSED_UPLOADS}" "Compressed uploads"
2016-04-07 16:25:11 +02:00
;;
# Options during upload of data
upload_options | upload-options)
2016-04-07 16:25:11 +02:00
UPLOAD_OPTIONS="${VALUE}"
AddSetting "upload-options" "${UPLOAD_OPTIONS}" "Upload options"
2016-04-07 16:25:11 +02:00
;;
# Proxy settings
upload_proxy_port | proxy-port | upload-proxy-port)
2016-04-07 16:25:11 +02:00
UPLOAD_PROXY_PORT="${VALUE}"
AddSetting "upload-proxy-port" "${UPLOAD_PROXY_PORT}" "Proxy port"
2016-04-07 16:25:11 +02:00
;;
upload_proxy_protocol | proxy-protocol)
2016-04-07 16:25:11 +02:00
UPLOAD_PROXY_PROTOCOL="${VALUE}"
AddSetting "upload-proxy-protocol" "${UPLOAD_PROXY_PROTOCOL}" "Proxy protocol"
2016-04-07 16:25:11 +02:00
;;
upload_proxy_server | proxy-server)
2016-04-07 16:25:11 +02:00
UPLOAD_PROXY_SERVER="${VALUE}"
AddSetting "upload-proxy-server" "${UPLOAD_PROXY_PORT}" "Proxy server"
2016-04-07 16:25:11 +02:00
;;
# Receiving system (IP address or hostname)
upload-server)
2016-04-07 16:25:11 +02:00
UPLOAD_SERVER="${VALUE}"
AddSetting "upload-server" "${UPLOAD_SERVER}" "Upload server (ip or hostname)"
2016-04-07 16:25:11 +02:00
;;
# Specify an alternative upload tool
upload-tool)
if [ -f "${VALUE}" ]; then UPLOAD_TOOL="${VALUE}"; fi
AddSetting "upload-tool" "${UPLOAD_TOOL}" "Upload tool"
;;
# Specify arguments for an alternative upload tool
upload-tool-arguments)
UPLOAD_TOOL_ARGS="${VALUE}"
AddSetting "upload-tool-arguments" "${UPLOAD_TOOL_ARGS}" "Upload tool (arguments)"
;;
2016-04-19 19:47:50 +02:00
# Verbose output (--verbose)
verbose)
2019-09-19 14:05:15 +02:00
FIND=$(echo "${VALUE}" | grep -E "^(1|true|yes)") && VERBOSE=1
2016-04-19 19:47:50 +02:00
Debug "Verbose set to ${VERBOSE}"
AddSetting "verbose" "${VERBOSE}" "Verbose output"
2016-04-19 19:47:50 +02:00
;;
########################################################################################################
## DEPRECATED ITEMS
########################################################################################################
# Deprecated: skip tests
test_skip_always)
2016-07-31 15:58:20 +02:00
STRING=$(echo ${VALUE} | tr '[:lower:]' '[:upper:]')
SKIP_TESTS="${SKIP_TESTS} ${STRING}"
LogText "[deprecated option] Tests to be skipped: ${VALUE}"
DisplayToolTip "Replace deprecated option 'test_skip_always' and replace with 'skip-test' (add to custom.prf)"
;;
# Deprecated: receiving system (IP address or hostname)
upload_server)
UPLOAD_SERVER="${VALUE}"
AddSetting "upload-server" "${UPLOAD_SERVER}" "Upload server (ip or hostname)"
DisplayToolTip "Replace deprecated option 'upload_server' and replace with 'upload-server' (add to custom.prf)"
;;
2016-04-07 16:25:11 +02:00
# Catch all bad options and bail out
*)
LogText "Unknown option ${OPTION} (with value: ${VALUE})"
${ECHOCMD:-echo} ""
${ECHOCMD:-echo} "${RED}Error${NORMAL}: found one or more errors in profile ${PROFILE}"
${ECHOCMD:-echo} ""
${ECHOCMD:-echo} ""
${ECHOCMD:-echo} "Full line: ${CONFIGOPTION}"
${ECHOCMD:-echo} "${WHITE}Details${NORMAL}: Unknown option '${YELLOW}${OPTION}${NORMAL}' found (with value: ${VALUE})"
${ECHOCMD:-echo} ""
2016-04-07 16:25:11 +02:00
ExitFatal
;;
esac
done
2014-08-26 17:33:55 +02:00
done
#
#################################################################################
2016-04-19 12:38:00 +02:00
#
SKIP_TESTS=$(echo ${SKIP_TESTS} | sed "s/^ //")
2019-07-16 13:20:30 +02:00
if [ -n "${SKIP_TESTS}" ]; then LogText "Skip tests: ${SKIP_TESTS}"; fi
2016-04-19 12:38:00 +02:00
#
#################################################################################
2014-08-26 17:33:55 +02:00
#
2018-01-23 14:29:37 +01:00
# Add group name to report - deprecated
2019-07-16 13:20:30 +02:00
if [ -n "${GROUP_NAME}" ]; then Report "group=${GROUP_NAME}"; fi
2014-08-26 17:33:55 +02:00
#
#################################################################################
#
# Set default values (only if not configured in profile)
if [ -z "${MACHINE_ROLE}" ]; then
2014-08-26 17:33:55 +02:00
MACHINE_ROLE="server"
LogText "Set option to default value: MACHINE_ROLE --> ${MACHINE_ROLE}"
2014-08-26 17:33:55 +02:00
fi
if [ -z "${NTPD_ROLE}" ]; then
2014-08-26 17:33:55 +02:00
NTPD_ROLE="client"
LogText "Set option to default value: NTPD_ROLE --> ${NTPD_ROLE}"
2014-08-26 17:33:55 +02:00
fi
#
#################################################################################
#
2016-08-13 09:45:38 +02:00
# Register the discovered settings
2016-08-13 10:06:09 +02:00
AddSetting "log-tests-incorrect-os" "${SETTING_LOG_TESTS_INCORRECT_OS}" "Logging of tests that have a different OS"
2016-08-13 09:45:38 +02:00
AddSetting "show-report-solution" "${SETTING_SHOW_REPORT_SOLUTION}" "Show more details in report (solution)"
2016-08-13 11:16:08 +02:00
AddSetting "skip-upgrade-test" "${SKIP_UPGRADE_TEST}" "Skip upgrade test"
AddSetting "strict" "${SET_STRICT}" "Perform strict code test of scripts"
unset SETTING_LOG_TESTS_INCORRECT_OS SETTING_SHOW_REPORT_SOLUTION
2016-08-13 09:45:38 +02:00
#
#################################################################################
#
2019-07-16 13:20:30 +02:00
if [ -n "${DEPRECATED_OPTION}" ]; then
ReportWarning "GEN-0030" "One or more deprecated options used in profile" "${DEPRECATED_OPTION}" "Update your profile"
2018-01-23 14:29:37 +01:00
fi
#
#################################################################################
#
2016-06-18 11:15:39 +02:00
Display --indent 2 --text "- Checking profiles..." --result "DONE" --color GREEN
2014-08-26 17:33:55 +02:00
#================================================================================
# Lynis - Security Auditing and System Hardening for Linux and UNIX - https://cisofy.com