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:
authorJim <jim.verheijde@hotmail.com>2020-08-24 18:59:06 +0300
committerGitHub <noreply@github.com>2020-08-24 18:59:06 +0300
commit84fd612c912aa46129d00fea93cb81362df55843 (patch)
treeb3818dfe02e1e87662d522cb96b899b50bd75b7f /include/tests_time
parentdabac5bf89685fb137536409e26d186ec58a94d4 (diff)
Add check for other clock files for earlier systemd versions
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 46db8d71..3c5a8477 100644
--- a/include/tests_time
+++ b/include/tests_time
@@ -574,8 +574,17 @@
Register --test-no TIME-3185 --preqs-met "${PREQS_MET}" --weight L --network NO --category "security" --description "Check systemd-timesyncd synchronized time"
- SYNCHRONIZED_FILE="/var/lib/systemd/timesync/clock"
+ 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