From 904da4d123d6ef74d19f5f1456d93bcccaa39763 Mon Sep 17 00:00:00 2001 From: mboelen Date: Sat, 23 Apr 2016 17:55:32 +0200 Subject: [PATCH] Allow additional profile with --profile --- include/consts | 1 + include/parameters | 2 +- lynis | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/consts b/include/consts index f571a310..d771f08c 100644 --- a/include/consts +++ b/include/consts @@ -151,6 +151,7 @@ unset LANG RUN_TESTS=1 SAMHAINBINARY="" SCAN_TEST_HEAVY=""; SCAN_TEST_MEDIUM=""; SCAN_TEST_LOW="" + SEARCH_PROFILES="" SESTATUSBINARY="" SERVICE_MANAGER="" SHELL_IS_BUSYBOX=0 diff --git a/include/parameters b/include/parameters index 0edd3ffa..689f4564 100644 --- a/include/parameters +++ b/include/parameters @@ -207,7 +207,7 @@ # Define a custom profile file --profile) shift - PROFILE=$1 + SEARCH_PROFILES=$1 ;; # Define a custom plugin directory diff --git a/lynis b/lynis index 5438fa1e..06afea7e 100755 --- a/lynis +++ b/lynis @@ -259,11 +259,17 @@ ${NORMAL} for PLOC in ${tPROFILE_TARGETS}; do FILE="${PLOC}/${PNAME}" if [ -r ${FILE} ]; then - PROFILE=${FILE} - PROFILES="${PROFILES} ${PROFILE}" + PROFILES="${PROFILES} ${FILE}" fi done done + # Search any profiles defined with --profile + for FILE in ${SEARCH_PROFILES}; do + if [ -r ${FILE} ]; then + Debug "Found profile defined with --profile" + PROFILES="${PROFILES} ${FILE}" + fi + done fi if [ "${PROFILES}" = "" ]; then echo "${RED}Fatal error: ${WHITE}No profile defined and could not find default profile${NORMAL}"