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:
Diffstat (limited to 'include/tests_time')
-rw-r--r--include/tests_time11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/tests_time b/include/tests_time
index eda41a6f..95c695bc 100644
--- a/include/tests_time
+++ b/include/tests_time
@@ -22,7 +22,7 @@
#
#################################################################################
#
- InsertSection "Time and Synchronization"
+ InsertSection "${SECTION_TIME_AND_SYNCHRONIZATION}"
#
#################################################################################
#
@@ -575,7 +575,16 @@
Register --test-no TIME-3185 --preqs-met "${PREQS_MET}" --weight L --network NO --category "security" --description "Check systemd-timesyncd synchronized time"
SYNCHRONIZED_FILE="/run/systemd/timesync/synchronized"
+
if [ ${SKIPTEST} -eq 0 ]; then
+ # On earlier systemd versions (237), '/run/systemd/timesync/synchronized' does not exist, so use '/var/lib/systemd/timesync/clock'
+ if [ ! -e "${SYNCHRONIZED_FILE}" ]; then
+ SYNCHRONIZED_FILE="/var/lib/systemd/timesync/clock"
+ fi
+ # DynamicUser=yes moves the clock file to '/var/lib/private/systemd/timesync/clock'
+ if [ ! -e "${SYNCHRONIZED_FILE}" ]; then
+ SYNCHRONIZED_FILE="/var/lib/private/systemd/timesync/clock"
+ fi
if [ -e "${SYNCHRONIZED_FILE}" ]; then
FIND=$(( $(date +%s) - $(${STATBINARY} -L --format %Y "${SYNCHRONIZED_FILE}") ))
# Check if last sync was more than 2048 seconds (= the default of systemd) ago