Merge pull request #1013 from Jimver/timesyncd_fix

[TIME-3185]: Change timesyncd synchronization file
This commit is contained in:
Michael Boelen 2020-10-21 15:02:03 +02:00 committed by GitHub
commit 8e07c3e9dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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" 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" SYNCHRONIZED_FILE="/run/systemd/timesync/synchronized"
if [ ${SKIPTEST} -eq 0 ]; then 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 if [ -e "${SYNCHRONIZED_FILE}" ]; then
FIND=$(( $(date +%s) - $(${STATBINARY} -L --format %Y "${SYNCHRONIZED_FILE}") )) FIND=$(( $(date +%s) - $(${STATBINARY} -L --format %Y "${SYNCHRONIZED_FILE}") ))
# Check if last sync was more than 2048 seconds (= the default of systemd) ago # Check if last sync was more than 2048 seconds (= the default of systemd) ago