Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2016-07-05 17:48:32 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-07-05 17:48:32 +0300
commit3b1102c81755318f91dd49efc949a325d861754c (patch)
tree2de8e0cd451aa11eeba4d426238aad5bde40fba2
parent5778d4fa0d75dbd3a7556e88cc9ad7c77360edc9 (diff)
Move profile parsing to its own function
-rwxr-xr-xlynis48
1 files changed, 3 insertions, 45 deletions
diff --git a/lynis b/lynis
index 3dffa9d1..fd0cbf73 100755
--- a/lynis
+++ b/lynis
@@ -277,49 +277,8 @@ ${NORMAL}
#
InsertSection "${GEN_INITIALIZE_PROGRAM}"
- # Try to find a default and custom profile, unless one was specified manually
- if [ "${PROFILE}" = "" ]; then
- CUSTOM_PROFILE=""
- DEFAULT_PROFILE=""
- PROFILEDIR=""
- tPROFILE_NAMES="default.prf custom.prf"
- tPROFILE_TARGETS="/usr/local/etc/lynis /etc/lynis /usr/local/lynis ."
- for PNAME in ${tPROFILE_NAMES}; do
- for PLOC in ${tPROFILE_TARGETS}; do
- # Only use one default.prf
- if [ "${PNAME}" = "default.prf" -a ! "${DEFAULT_PROFILE}" = "" ]; then
- Debug "Already discovered default.prf - skipping this file (${PLOC}/${PNAME})"
- elif [ "${PNAME}" = "custom.prf" -a ! "${CUSTOM_PROFILE}" = "" ]; then
- Debug "Already discovered custom.prf - skipping this file (${PLOC}/${PNAME})"
- else
- if [ "${PLOC}" = "." ]; then FILE="${WORKDIR}/${PNAME}"; else FILE="${PLOC}/${PNAME}"; fi
- if [ -r ${FILE} ]; then
- PROFILES="${PROFILES} ${FILE}"
- case ${PNAME} in
- "custom.prf") CUSTOM_PROFILE="${FILE}" ;;
- "default.prf") DEFAULT_PROFILE="${FILE}" ;;
- esac
- # Set profile directory to last match (Lynis could be both installed, and run as a separate download)
- if [ "${PLOC}" = "." ]; then PROFILEDIR="${WORKDIR}"; else PROFILEDIR="${PLOC}"; fi
- fi
- 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}"
- echo "Search paths used --> ${tPROFILE_TARGETS}"
- ExitCustom 66
- else
- PROFILES=`echo ${PROFILES} | sed 's/^ //'`
- fi
+ # Discover any profiles
+ DiscoverProfiles
# Initialize and check profile file, auditor name, log file and report file
if [ "${AUDITORNAME}" = "" ]; then AUDITORNAME="[Not Specified]"; fi
@@ -551,8 +510,7 @@ ${NORMAL}
#
#################################################################################
#
- SafePerms ${INCLUDEDIR}/profiles
- . ${INCLUDEDIR}/profiles
+ ParseProfiles
# Import a different language when configured
if [ ! "${LANGUAGE}" = "en" ]; then