Clean up of old variables

This commit is contained in:
mboelen 2016-04-05 11:28:11 +02:00
parent 03388532ec
commit 2f335eea5f
1 changed files with 32 additions and 49 deletions

81
lynis
View File

@ -27,30 +27,26 @@
#set -u
# Program information
PROGRAM_name="Lynis"
PROGRAM_VERSION="2.2.1"
PROGRAM_version="${PROGRAM_VERSION}"
PROGRAM_RELEASEDATE="2016-04-04"
PROGRAM_releasedate="${PROGRAM_RELEASEDATE}"
PROGRAM_RELEASE_TIMESTAMP=1459768802
PROGRAM_NAME="Lynis"
PROGRAM_AUTHOR="CISOfy"
PROGRAM_author="${PROGRAM_AUTHOR}"
PROGRAM_AUTHOR_CONTACT="lynis-dev@cisofy.com"
PROGRAM_author_contact="${PROGRAM_AUTHOR_CONTACT}"
# Version details
PROGRAM_RELEASEDATE="2016-04-04"
PROGRAM_RELEASE_TIMESTAMP=1459768802
PROGRAM_VERSION="2.2.1"
# Source, documentation and license
PROGRAM_SOURCE="https://github.com/CISOfy/lynis"
PROGRAM_WEBSITE="https://cisofy.com/lynis/"
PROGRAM_website="${PROGRAM_WEBSITE}"
PROGRAM_COPYRIGHT="Copyright 2007-2016 - ${PROGRAM_AUTHOR}, ${PROGRAM_WEBSITE}"
PROGRAM_copyright="${PROGRAM_COPYRIGHT}"
PROGRAM_LICENSE="${PROGRAM_NAME} 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 the LICENSE file for details about using this software."
PROGRAM_license="${PROGRAM_LICENSE}"
PROGRAM_extrainfo="Enterprise support and plugins available via CISOfy"
welcome to redistribute it under the terms of the GNU General Public License.
See the LICENSE file for details about using this software."
PROGRAM_EXTRAINFO="Enterprise support and plugins available via CISOfy"
# Release version (beta or final)
PROGRAM_releasetype="final"
PROGRAM_NAME="Lynis"
PROGRAM_SOURCE="https://github.com/CISOfy/lynis"
PROGRAM_RELEASETYPE="final"
# Version number of report files (when format changes in future)
REPORT_version_major="1"; REPORT_version_minor="0"
@ -72,7 +68,7 @@
if [ "${INCLUDEDIR}" = "" ]; then
printf "%s" "
Fatal error: can't find include directory
Make sure to execute ${PROGRAM_name} from untarred directory or check your installation."
Make sure to execute ${PROGRAM_NAME} from untarred directory or check your installation."
exit 1
fi
@ -235,7 +231,7 @@ Make sure to execute ${PROGRAM_name} from untarred directory or check your insta
# Drop out if our plugin directory can't be found
if [ ! -d ${PLUGINDIR} ]; then
echo "Fatal error: can't find plugin directory ${PLUGINDIR}"
echo "Make sure to execute ${PROGRAM_name} from untarred directory or check your installation."
echo "Make sure to execute ${PROGRAM_NAME} from untarred directory or check your installation."
exit 1
fi
#
@ -246,7 +242,7 @@ Make sure to execute ${PROGRAM_name} from untarred directory or check your insta
#################################################################################
#
# CV - Current Version
PROGRAM_AC=`echo ${PROGRAM_version} | awk '{ print $1 }' | sed 's/[.]//g'`
PROGRAM_AC=`echo ${PROGRAM_VERSION} | awk '{ print $1 }' | sed 's/[.]//g'`
PROGRAM_LV=0
#
#################################################################################
@ -257,19 +253,10 @@ Make sure to execute ${PROGRAM_name} from untarred directory or check your insta
#
if [ ${QUIET} -eq 0 ]; then
printf "%s" "
${WHITE}[ ${PROGRAM_name} ${PROGRAM_version} ]${NORMAL}
################################################################################
${PROGRAM_license}
${PROGRAM_copyright}
${PROGRAM_extrainfo}
################################################################################"
printf "\n${WHITE}[ ${PROGRAM_NAME} ${PROGRAM_VERSION} ]${NORMAL}\n\n################################################################################\n ${PROGRAM_LICENSE}\n ${PROGRAM_COPYRIGHT}\n ${PROGRAM_EXTRAINFO}\n################################################################################\n\n"
fi
if [ "${PROGRAM_releasetype}" = "beta" ]; then
if [ "${PROGRAM_RELEASETYPE}" = "beta" ]; then
printf "%s" "
${WHITE}
#########################################################
@ -498,7 +485,7 @@ ${NORMAL}
#################################################################################
#
# Clear log file and test if it's writable
echo "### Starting ${PROGRAM_name} ${PROGRAM_version} with PID ${OURPID}, build date ${PROGRAM_releasedate} ###" > ${LOGFILE}
echo "### Starting ${PROGRAM_NAME} ${PROGRAM_VERSION} with PID ${OURPID}, build date ${PROGRAM_RELEASEDATE} ###" > ${LOGFILE}
if [ $? -gt 0 ]; then
Display --indent 2 --text "- Clearing log file (${LOGFILE})... " --result WARNING --color RED
echo "${WARNING}Fatal error${NORMAL}: problem while writing to log file. Check location and permissions."
@ -506,16 +493,16 @@ ${NORMAL}
exit 1
fi
logtextbreak
logtext "### ${PROGRAM_copyright} ###"
logtext "### ${PROGRAM_COPYRIGHT} ###"
# Clear report file (to avoid appending to an existing file)
echo "# ${PROGRAM_name} Report" > ${REPORTFILE}
echo "# ${PROGRAM_NAME} Report" > ${REPORTFILE}
report "report_version_major=${REPORT_version_major}"
report "report_version_minor=${REPORT_version_minor}"
CDATE=`date "+%F %H:%M:%S"`
report "report_datetime_start=${CDATE}"
report "auditor=${AUDITORNAME}"
report "lynis_version=${PROGRAM_version}"
report "lynis_version=${PROGRAM_VERSION}"
report "os=${OS}"
report "os_name=${OS_NAME}"
report "os_fullname=${OS_FULLNAME}"
@ -538,7 +525,7 @@ ${NORMAL}
if [ ${QUIET} -eq 0 -a ${SHOW_PROGRAM_DETAILS} -eq 1 ]; then
echo ""
echo " ---------------------------------------------------"
echo " Program version: ${PROGRAM_version}"
echo " Program version: ${PROGRAM_VERSION}"
echo " Operating system: ${OS}"
echo " Operating system name: ${OS_NAME}"
echo " Operating system version: ${OS_VERSION}"
@ -555,7 +542,7 @@ ${NORMAL}
echo " ---------------------------------------------------"
fi
logtext "Program version: ${PROGRAM_version}"
logtext "Program version: ${PROGRAM_VERSION}"
logtext "Operating system: ${OS}"
logtext "Operating system name: ${OS_NAME}"
logtext "Operating system version: ${OS_VERSION}"
@ -618,13 +605,13 @@ ${NORMAL}
logtext "Minimum required version : ${PROGRAM_MINVERSION}"
if [ ${PROGRAM_MINVERSION} -gt ${PROGRAM_AC} ]; then
Display --indent 2 --text "- Program update status... " --result "WARNING" --color RED
logtext "Result: This version is VERY outdated. Newer ${PROGRAM_name} release available!"
logtext "Result: This version is VERY outdated. Newer ${PROGRAM_NAME} release available!"
ReportWarning "LYNIS" "Version of Lynis is very old and should be updated"
report "lynis_update_available=1"
UPDATE_AVAILABLE=1
else
Display --indent 2 --text "- Program update status... " --result "UPDATE AVAILABLE" --color YELLOW
logtext "Result: newer ${PROGRAM_name} release available!"
logtext "Result: newer ${PROGRAM_NAME} release available!"
ReportSuggestion "LYNIS" "Version of Lynis outdated, consider upgrading to the latest version"
report "lynis_update_available=1"
UPDATE_AVAILABLE=1
@ -632,7 +619,7 @@ ${NORMAL}
else
if [ ${UPDATE_CHECK_SKIPPED} -eq 0 ]; then
Display --indent 2 --text "- Program update status... " --result "NO UPDATE" --color GREEN
logtext "No ${PROGRAM_name} update available."
logtext "No ${PROGRAM_NAME} update available."
report "lynis_update_available=0"
else
Display --indent 2 --text "- Program update status... " --result "SKIPPED" --color YELLOW
@ -660,7 +647,7 @@ ${NORMAL}
if [ ${UPDATE_AVAILABLE} -eq 1 ]; then
echo ""
echo " ==============================================================================="
echo " ${CYAN}${PROGRAM_name} update available${NORMAL}"
echo " ${CYAN}${PROGRAM_NAME} update available${NORMAL}"
echo " ==============================================================================="
echo ""
if [ ${OLD_RELEASE} -eq 1 ]; then
@ -712,7 +699,7 @@ ${NORMAL}
#################################################################################
#
# Plugins
if [ ${RUN_PLUGINS} -eq 1 ]; then
N_PLUGIN=0
@ -944,9 +931,9 @@ ${NORMAL}
fi
fi
logtext "${PROGRAM_name} ${PROGRAM_version}"
logtext "${PROGRAM_copyright}"
logtext "${PROGRAM_extrainfo}"
logtext "${PROGRAM_NAME} ${PROGRAM_VERSION}"
logtext "${PROGRAM_COPYRIGHT}"
logtext "${PROGRAM_EXTRAINFO}"
logtext "Program ended successfully"
logtext "================================================================================"
@ -959,10 +946,6 @@ ${NORMAL}
# The End
###########################################################################
##%HASH-SHA1%----------------------------%
###########################################################################
#
#================================================================================
# Lynis - Copyright 2007-2016, Michael Boelen, CISOfy - https://cisofy.com