mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-29 16:54:26 +02:00
Only allow 1 default.prf and 1 custom.prf to be used
This commit is contained in:
parent
4225611b5b
commit
91acefeb6e
21
lynis
21
lynis
@ -193,7 +193,7 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
|
|||||||
if [ ${MYID} -eq 0 ]; then
|
if [ ${MYID} -eq 0 ]; then
|
||||||
PRIVILEGED=1
|
PRIVILEGED=1
|
||||||
else
|
else
|
||||||
echo "Starting Lynis non-privileged"
|
Debug "Starting Lynis non-privileged"
|
||||||
# Implied pentesting mode if not performed by root user
|
# Implied pentesting mode if not performed by root user
|
||||||
PENTESTINGMODE=1
|
PENTESTINGMODE=1
|
||||||
fi
|
fi
|
||||||
@ -256,13 +256,26 @@ ${NORMAL}
|
|||||||
|
|
||||||
# Try to find a default and custom profile, unless one was specified manually
|
# Try to find a default and custom profile, unless one was specified manually
|
||||||
if [ "${PROFILE}" = "" ]; then
|
if [ "${PROFILE}" = "" ]; then
|
||||||
|
CUSTOM_PROFILE=""
|
||||||
|
DEFAULT_PROFILE=""
|
||||||
tPROFILE_NAMES="default.prf custom.prf"
|
tPROFILE_NAMES="default.prf custom.prf"
|
||||||
tPROFILE_TARGETS="/usr/local/etc/lynis /etc/lynis /usr/local/lynis ."
|
tPROFILE_TARGETS="/usr/local/etc/lynis /etc/lynis /usr/local/lynis ."
|
||||||
for PNAME in ${tPROFILE_NAMES}; do
|
for PNAME in ${tPROFILE_NAMES}; do
|
||||||
for PLOC in ${tPROFILE_TARGETS}; do
|
for PLOC in ${tPROFILE_TARGETS}; do
|
||||||
FILE="${PLOC}/${PNAME}"
|
# Only use one default.prf
|
||||||
if [ -r ${FILE} ]; then
|
if [ "${PNAME}" = "default.prf" -a ! "${DEFAULT_PROFILE}" = "" ]; then
|
||||||
PROFILES="${PROFILES} ${FILE}"
|
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
|
||||||
|
FILE="${PLOC}/${PNAME}"
|
||||||
|
if [ -r ${FILE} ]; then
|
||||||
|
PROFILES="${PROFILES} ${FILE}"
|
||||||
|
case ${PNAME} in
|
||||||
|
"custom.prf") CUSTOM_PROFILE="${FILE}" ;;
|
||||||
|
"default.prf") DEFAULT_PROFILE="${FILE}" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user