2016-04-07 16:24:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#################################################################################
|
|
|
|
#
|
|
|
|
# Lynis
|
|
|
|
# ------------------
|
|
|
|
#
|
|
|
|
# Copyright 2007-2013, Michael Boelen
|
|
|
|
# Copyright 2013-2016, CISOfy
|
|
|
|
#
|
|
|
|
# Website : https://cisofy.com
|
|
|
|
# Blog : http://linux-audit.com
|
|
|
|
# GitHub : https://github.com/CISOfy/lynis
|
|
|
|
#
|
|
|
|
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
|
|
|
|
# welcome to redistribute it under the terms of the GNU General Public License.
|
|
|
|
# See LICENSE file for usage of this software.
|
|
|
|
#
|
|
|
|
######################################################################
|
|
|
|
#
|
|
|
|
# Helper program to share details
|
|
|
|
#
|
|
|
|
######################################################################
|
|
|
|
#
|
|
|
|
# How to use:
|
|
|
|
# ------------
|
|
|
|
# Run: lynis show <option>
|
|
|
|
#
|
|
|
|
######################################################################
|
|
|
|
|
2016-04-12 21:59:23 +02:00
|
|
|
COMMANDS="audit show update"
|
|
|
|
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\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--version (-V)\n--view-categories"
|
2016-04-13 16:12:22 +02:00
|
|
|
|
|
|
|
SHOW_ARGS="commands help license man options pidfile plugindir profiles release releasedate version"
|
2016-04-12 21:59:23 +02:00
|
|
|
SHOW_HELP="lynis show ${BROWN}commands${NORMAL} (all available commands)
|
|
|
|
lynis show ${BROWN}help${NORMAL} (detailed information about arguments)
|
|
|
|
lynis show ${BROWN}license${NORMAL} (license details)
|
|
|
|
lynis show ${BROWN}man${NORMAL} (show help)
|
|
|
|
lynis show ${BROWN}options${NORMAL} (available flags and options)
|
|
|
|
lynis show ${BROWN}pidfile${NORMAL} (active file to stored process ID)
|
2016-04-13 16:12:22 +02:00
|
|
|
lynis show ${BROWN}plugindir${NORMAL} (directory with plugins)
|
2016-04-12 21:59:23 +02:00
|
|
|
lynis show ${BROWN}profiles${NORMAL} (discovered profiles)
|
|
|
|
lynis show ${BROWN}release${NORMAL} (version)
|
|
|
|
lynis show ${BROWN}releasedate${NORMAL} (date of release)
|
|
|
|
lynis show ${BROWN}version${NORMAL} (${PROGRAM_NAME} version)"
|
|
|
|
|
|
|
|
AUDIT_ARGS="( dockerfile | system )"
|
|
|
|
AUDIT_HELP="
|
|
|
|
audit ${CYAN}dockerfile${NORMAL}
|
|
|
|
|
|
|
|
Perform audit on a Docker build file
|
|
|
|
${GRAY}Usage:${NORMAL} lynis audit dockerfile ${BROWN}<file>${NORMAL}
|
|
|
|
|
|
|
|
|
|
|
|
audit ${CYAN}system${NORMAL}
|
|
|
|
|
|
|
|
Perform system audit
|
|
|
|
${DARKGRAY}Usage:${NORMAL} lynis audit system
|
|
|
|
"
|
2016-04-07 16:24:38 +02:00
|
|
|
|
|
|
|
UPDATE_ARGS="info release"
|
|
|
|
|
|
|
|
COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system"
|
|
|
|
COMMANDS_AUDIT_SYSTEM_FUNCTION="Function: performs a security audit of the system"
|
|
|
|
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
case $1 in
|
|
|
|
"commands")
|
|
|
|
if [ $# -eq 1 ]; then
|
2016-04-12 21:59:23 +02:00
|
|
|
echo "\n${WHITE}Commands:${NORMAL}"
|
|
|
|
for I in ${COMMANDS}; do
|
|
|
|
echo "lynis ${CYAN}${I}${NORMAL}"
|
|
|
|
done
|
|
|
|
echo ""
|
2016-04-07 16:24:38 +02:00
|
|
|
else
|
|
|
|
shift
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
case $1 in
|
2016-04-12 21:59:23 +02:00
|
|
|
"audit") printf "${AUDIT_HELP}" ;;
|
|
|
|
"show") echo "${SHOW_HELP}" ;;
|
2016-04-07 16:24:38 +02:00
|
|
|
*) echo "Unknown argument for 'commands'"
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
"dockerfile")
|
|
|
|
echo "Usage: lynis audit dockerfile <file>"
|
|
|
|
;;
|
|
|
|
"system")
|
|
|
|
printf "${COMMANDS_AUDIT_SYSTEM_USAGE}\n${COMMANDS_AUDIT_SYSTEM_FUNCTION}\n"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown argument for 'commands'"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
"help")
|
|
|
|
if [ $# -eq 1 ]; then
|
2016-04-12 21:59:23 +02:00
|
|
|
echo "${WHITE}Commands${NORMAL}:"
|
|
|
|
for I in ${COMMANDS}; do
|
|
|
|
echo "lynis ${CYAN}${I}${NORMAL}"
|
|
|
|
done
|
|
|
|
echo ""
|
|
|
|
echo "${WHITE}Options${NORMAL}:\n${BLUE}${OPTIONS}${NORMAL}"
|
2016-04-07 16:24:38 +02:00
|
|
|
else
|
|
|
|
shift
|
|
|
|
case $1 in
|
2016-04-12 21:59:23 +02:00
|
|
|
"audit") echo "${AUDIT_HELP}" ;;
|
2016-04-07 16:24:38 +02:00
|
|
|
"show") echo "${SHOW_ARGS}" ;;
|
|
|
|
"update") echo "${UPDATE_ARGS}" ;;
|
|
|
|
"?") echo "${SHOW_ARGS}" ;;
|
|
|
|
*) echo "Invalid argument provided" ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
"license") echo "${PROGRAM_LICENSE}" ;;
|
|
|
|
"man") echo "Use ./lynis --man or man lynis" ;;
|
|
|
|
"options") echo "${OPTIONS}" ;;
|
|
|
|
"pidfile") echo "${PIDFILE}" ;;
|
|
|
|
"profile" | "profiles") for I in ${PROFILES}; do echo ${I}; done ;;
|
|
|
|
"plugindir") echo "${PLUGINDIR}" ;;
|
|
|
|
"release" | "version") echo "${PROGRAM_VERSION}" ;;
|
|
|
|
"releasedate") echo "${PROGRAM_RELEASE_DATE}" ;;
|
|
|
|
"?") echo "${SHOW_ARGS}" ;;
|
|
|
|
*) echo "Unknown option" ;;
|
|
|
|
esac
|
|
|
|
else
|
2016-04-12 21:59:23 +02:00
|
|
|
printf "\n ${WHITE}Provide an additional argument${NORMAL}\n\n"
|
2016-04-07 16:24:38 +02:00
|
|
|
for I in ${SHOW_ARGS}; do
|
2016-04-12 21:59:23 +02:00
|
|
|
echo " lynis show ${BROWN}${I}${NORMAL}"
|
2016-04-07 16:24:38 +02:00
|
|
|
done
|
2016-04-12 21:59:23 +02:00
|
|
|
printf "\n"
|
2016-04-07 16:24:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
ExitClean
|
|
|
|
|
|
|
|
# The End
|