Added 'lynis show os' command and detection improvement

This commit is contained in:
Michael Boelen 2016-10-16 12:01:33 +02:00
parent 7cc56cf4ea
commit c0e63699e5
2 changed files with 9 additions and 2 deletions

View File

@ -32,7 +32,7 @@ COMMANDS="audit show update upload-only"
HELPERS="audit configure show update"
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--license-key\n--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-from-category\n--tests-from-group\n--upload\n--verbose\n--version (-V)\n--wait"
SHOW_ARGS="categories changelog commands dbdir details groups help hostids includedir language license logfile man options pidfile plugindir profiles release releasedate report settings tests version workdir"
SHOW_ARGS="categories changelog commands dbdir details groups help hostids includedir language license logfile man options os pidfile plugindir profiles release releasedate report settings tests version workdir"
SHOW_HELP="lynis show ${BROWN}categories${NORMAL} (display test categories)
lynis show ${BROWN}changelog${NORMAL} ${GRAY}[version]${NORMAL} (release details)
lynis show ${BROWN}commands${NORMAL} (all available commands)
@ -47,6 +47,7 @@ lynis show ${BROWN}license${NORMAL} (license details)
lynis show ${BROWN}logfile${NORMAL} (location of logfile)
lynis show ${BROWN}man${NORMAL} (show help)
lynis show ${BROWN}options${NORMAL} (available flags and options)
lynis show ${BROWN}os${NORMAL} (operating system and version)
lynis show ${BROWN}pidfile${NORMAL} (active file to stored process ID)
lynis show ${BROWN}plugindir${NORMAL} (directory with plugins)
lynis show ${BROWN}profiles${NORMAL} (discovered profiles)
@ -270,6 +271,12 @@ if [ $# -gt 0 ]; then
"logfile") ${ECHOCMD} "${LOGFILE}" ;;
"man") ${ECHOCMD} "Use ./lynis --man or man lynis" ;;
"options") ${ECHOCMD} "${OPTIONS}" ;;
"os")
${ECHOCMD} "OS=${OS}"
${ECHOCMD} "OS_NAME=${OS_NAME}"
${ECHOCMD} "OS_FULLNAME=${OS_FULLNAME}"
${ECHOCMD} "OS_VERSION=${OS_VERSION}"
;;
"pidfile") ${ECHOCMD} "${PIDFILE}" ;;
"profile" | "profiles") for I in ${PROFILES}; do ${ECHOCMD} ${I}; done ;;
"profiledir") ${ECHOCMD} "${PROFILEDIR}" ;;

View File

@ -123,7 +123,7 @@
# Generic
if [ -e /etc/os-release ]; then
OS_ID=$(grep "^ID=" /etc/os-release)
OS_ID=$(grep "^ID=" /etc/os-release | awk -F= '{print $2}')
if [ ! -z "${OS_ID}" ]; then
case ${OS_ID} in
"coreos")