Code enhancements and allow host alias to be defined in profile

This commit is contained in:
Michael Boelen 2017-03-05 20:45:13 +01:00
parent 44f5209cb9
commit b0cde02c71
1 changed files with 10 additions and 9 deletions

View File

@ -29,6 +29,7 @@
################################################################################# #################################################################################
# #
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 CONFIGOPTION in ${FIND}; do for CONFIGOPTION in ${FIND}; do
@ -162,6 +163,10 @@
AddSetting "group" "${GROUP_NAME}" "Group" AddSetting "group" "${GROUP_NAME}" "Group"
;; ;;
hostalias | host-alias)
Report "host_alias=${VALUE}"
;;
hostid) hostid)
HOSTID="${VALUE}" HOSTID="${VALUE}"
;; ;;
@ -459,23 +464,20 @@
################################################################################# #################################################################################
# #
# Add group name to report # Add group name to report
if [ ! "${GROUP_NAME}" = "" ]; then if [ ! -z "${GROUP_NAME}" ]; then Report "group=${GROUP_NAME}"; fi
Report "group=${GROUP_NAME}"
fi
# #
################################################################################# #################################################################################
# #
# Set default values (only if not configured in profile) # Set default values (only if not configured in profile)
if [ "${MACHINE_ROLE}" = "" ]; then if [ -z "${MACHINE_ROLE}" ]; then
MACHINE_ROLE="server" MACHINE_ROLE="server"
LogText "Set option to default value: MACHINE_ROLE --> ${MACHINE_ROLE}" LogText "Set option to default value: MACHINE_ROLE --> ${MACHINE_ROLE}"
fi fi
if [ "${NTPD_ROLE}" = "" ]; then if [ -z "${NTPD_ROLE}" ]; then
NTPD_ROLE="client" NTPD_ROLE="client"
LogText "Set option to default value: NTPD_ROLE --> ${NTPD_ROLE}" LogText "Set option to default value: NTPD_ROLE --> ${NTPD_ROLE}"
fi fi
# #
################################################################################# #################################################################################
# #
@ -491,8 +493,7 @@
# #
Display --indent 2 --text "- Checking profiles..." --result "DONE" --color GREEN Display --indent 2 --text "- Checking profiles..." --result "DONE" --color GREEN
LogTextBreak LogTextBreak
#================================================================================ #================================================================================
# Lynis - Copyright 2007-2017, Michael Boelen - CISOfy, https://cisofy.com # Lynis - Security Auditing and System Hardening for Linux and UNIX - https://cisofy.com