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:
authorSimon Biewald <simon@fam-biewald.de>2020-07-10 01:48:12 +0300
committerSimon Biewald <simon@fam-biewald.de>2020-07-10 01:48:12 +0300
commite27208a342aee4ac5c1c19cac0f27700201a7708 (patch)
tree304e8a9649c224ab5a719902bcf9e0ab5baa609d /include/tests_time
parent38b6105c6061c01b7075a76c23a9e73a962692bf (diff)
use STATBINARY, put filename in variable
Diffstat (limited to 'include/tests_time')
-rw-r--r--include/tests_time9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/tests_time b/include/tests_time
index 1fb512ae..e3cf4ac8 100644
--- a/include/tests_time
+++ b/include/tests_time
@@ -585,11 +585,12 @@
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
- if [ -e /run/systemd/timesync/synchronized ]; then
- FIND=$(( $(date +%s) - $(stat -L --format %Y /run/systemd/timesync/synchronized) ))
+ 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
- if [ ${FIND} -ge 2048 ]; then
+ if [ "${FIND}" -ge 2048 ]; then
COLOR=RED
ReportWarning "${TEST_NO}" "systemd-timesyncd did not synchronized the time recently."
else
@@ -602,7 +603,7 @@
ReportWarning "${TEST_NO}" "systemd-timesyncd never successfully synchronized time"
fi
fi
-
+ unset SYNCHRONIZED_FILE
#
#################################################################################