Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ginsbach <brian.ginsbach@gmail.com>2020-03-19 23:41:35 +0300
committerBrian Ginsbach <brian.ginsbach@gmail.com>2020-03-20 21:42:28 +0300
commit52344913d3ac3fe1c7120a9c4395d5a3f961e314 (patch)
tree965754c288c9f421330dc6d75b6a8f45a0006041
parent1f8b5fafde1fb5dd4f8c5231240e3a8cf1afa39f (diff)
Add a way to signify undetermined EOL
Replace setting an artificaly high date and converted date for operating systems with no EOL (rolling) or the EOL is still to be determined. This makes it easier for humans and saves making a comparison (when using an artifically high converted time) will always be false (EOL=0). An example entry os:AGreatOS 2.0::-1: The converted time (seconds since the epoch) could be specified as zero but this typically means the OS is out of date (now), A value of -1 is a convention indicating no EOL.
-rw-r--r--db/software-eol.db5
-rw-r--r--include/osdetection16
2 files changed, 14 insertions, 7 deletions
diff --git a/db/software-eol.db b/db/software-eol.db
index d0452616..124334e9 100644
--- a/db/software-eol.db
+++ b/db/software-eol.db
@@ -9,6 +9,9 @@
#
# Date can be converted on Linux using: date "+%s" --date=2020-01-01
#
+# Note: For rolling releases or releases that do not (currently have an
+# EOL date, leave field three empty and set field four to -1.
+#
# Amazon Linux
#
os:Amazon Linux:2020-06-30:1593468000:
@@ -16,7 +19,7 @@ os:Amazon Linux 2:2023-06-26:1687730400:
#
# Arch Linux
#
-os:Arch Linux:2286-11-20:9999999999:
+os:Arch Linux::-1:
#
# CentOS
#
diff --git a/include/osdetection b/include/osdetection
index 12502e20..08fd931e 100644
--- a/include/osdetection
+++ b/include/osdetection
@@ -575,13 +575,17 @@
EOL_TIMESTAMP=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $4}}' ${DBDIR}/software-eol.db | head -n 1)
if [ -n "${EOL_TIMESTAMP}" ]; then
EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $3}}' ${DBDIR}/software-eol.db | head -n 1)
- NOW=$(date "+%s")
- if [ -n "${NOW}" ]; then
- if [ ${NOW} -gt ${EOL_TIMESTAMP} ]; then
- EOL=1
- else
- EOL=0
+ if [ -n "${EOL_DATE}" ]; then
+ NOW=$(date "+%s")
+ if [ -n "${NOW}" ]; then
+ if [ ${NOW} -gt ${EOL_TIMESTAMP} ]; then
+ EOL=1
+ else
+ EOL=0
+ fi
fi
+ else
+ EOL=0
fi
fi
fi