mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-25 23:05:01 +02:00
Added detection and display of profile directory
This commit is contained in:
parent
26c67e4ec6
commit
1cbf7244c2
@ -29,6 +29,7 @@
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
COMMANDS="audit show update"
|
COMMANDS="audit show update"
|
||||||
|
HELPERS="audit configure show update"
|
||||||
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--info\n--license-key --log-file\n--manpage_(--man)\n--no-colors --no-log\n--pentest\n--profile\n--plugins-dir\n--quiet (-q)\n--quick (-Q)\n--report-file\n--reverse-colors\n--tests\n--tests-category\n--upload\n--verbose\n--version (-V)\n--view-categories"
|
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--info\n--license-key --log-file\n--manpage_(--man)\n--no-colors --no-log\n--pentest\n--profile\n--plugins-dir\n--quiet (-q)\n--quick (-Q)\n--report-file\n--reverse-colors\n--tests\n--tests-category\n--upload\n--verbose\n--version (-V)\n--view-categories"
|
||||||
|
|
||||||
SHOW_ARGS="commands dbdir help includedir license man options pidfile plugindir profiles release releasedate tests version workdir"
|
SHOW_ARGS="commands dbdir help includedir license man options pidfile plugindir profiles release releasedate tests version workdir"
|
||||||
@ -158,6 +159,7 @@ if [ $# -gt 0 ]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
"helpers") for I in ${HELPERS}; do ${ECHOCMD} ${I}; done ;;
|
||||||
"includedir")
|
"includedir")
|
||||||
${ECHOCMD} "${INCLUDEDIR}"
|
${ECHOCMD} "${INCLUDEDIR}"
|
||||||
;;
|
;;
|
||||||
@ -166,6 +168,7 @@ if [ $# -gt 0 ]; then
|
|||||||
"options") ${ECHOCMD} "${OPTIONS}" ;;
|
"options") ${ECHOCMD} "${OPTIONS}" ;;
|
||||||
"pidfile") ${ECHOCMD} "${PIDFILE}" ;;
|
"pidfile") ${ECHOCMD} "${PIDFILE}" ;;
|
||||||
"profile" | "profiles") for I in ${PROFILES}; do ${ECHOCMD} ${I}; done ;;
|
"profile" | "profiles") for I in ${PROFILES}; do ${ECHOCMD} ${I}; done ;;
|
||||||
|
"profiledir") ${ECHOCMD} "${PROFILEDIR}" ;;
|
||||||
"plugindir") ${ECHOCMD} "${PLUGINDIR}" ;;
|
"plugindir") ${ECHOCMD} "${PLUGINDIR}" ;;
|
||||||
"release" | "version") ${ECHOCMD} "${PROGRAM_VERSION}" ;;
|
"release" | "version") ${ECHOCMD} "${PROGRAM_VERSION}" ;;
|
||||||
"releasedate") ${ECHOCMD} "${PROGRAM_RELEASE_DATE}" ;;
|
"releasedate") ${ECHOCMD} "${PROGRAM_RELEASE_DATE}" ;;
|
||||||
|
5
lynis
5
lynis
@ -267,6 +267,7 @@ ${NORMAL}
|
|||||||
if [ "${PROFILE}" = "" ]; then
|
if [ "${PROFILE}" = "" ]; then
|
||||||
CUSTOM_PROFILE=""
|
CUSTOM_PROFILE=""
|
||||||
DEFAULT_PROFILE=""
|
DEFAULT_PROFILE=""
|
||||||
|
PROFILEDIR=""
|
||||||
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
|
||||||
@ -277,13 +278,15 @@ ${NORMAL}
|
|||||||
elif [ "${PNAME}" = "custom.prf" -a ! "${CUSTOM_PROFILE}" = "" ]; then
|
elif [ "${PNAME}" = "custom.prf" -a ! "${CUSTOM_PROFILE}" = "" ]; then
|
||||||
Debug "Already discovered custom.prf - skipping this file (${PLOC}/${PNAME})"
|
Debug "Already discovered custom.prf - skipping this file (${PLOC}/${PNAME})"
|
||||||
else
|
else
|
||||||
FILE="${PLOC}/${PNAME}"
|
if [ "${PLOC}" = "." ]; then FILE="${WORKDIR}/${PNAME}"; else FILE="${PLOC}/${PNAME}"; fi
|
||||||
if [ -r ${FILE} ]; then
|
if [ -r ${FILE} ]; then
|
||||||
PROFILES="${PROFILES} ${FILE}"
|
PROFILES="${PROFILES} ${FILE}"
|
||||||
case ${PNAME} in
|
case ${PNAME} in
|
||||||
"custom.prf") CUSTOM_PROFILE="${FILE}" ;;
|
"custom.prf") CUSTOM_PROFILE="${FILE}" ;;
|
||||||
"default.prf") DEFAULT_PROFILE="${FILE}" ;;
|
"default.prf") DEFAULT_PROFILE="${FILE}" ;;
|
||||||
esac
|
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
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user