On physical systems, and virtual systems where host based time synchronization is not available.
One of the three time synchronization daemons should be available; chrony or systemd-timesyncd
Run the following script to verify that a single time synchronization daemon is available on the system:
#!/usr/bin/env bash{l_output=""l_output2=""service_not_enabled_chk(){l_out2=""ifsystemctlis-enabled"$l_service_name"2>/dev/null|grep-q'enabled';thenl_out2="$l_out2\n - Daemon: \"$l_service_name\" is enabled on the system"fiifsystemctlis-active"$l_service_name"2>/dev/null|grep-q'^active';thenl_out2="$l_out2\n - Daemon: \"$l_service_name\" is active on the system"fi}l_service_name="systemd-timesyncd.service"# Check systemd-timesyncd daemonservice_not_enabled_chk
if[-n"$l_out2"];thenl_timesyncd="y"l_out_tsd="$l_out2"elsel_timesyncd="n"l_out_tsd="\n - Daemon: \"$l_service_name\" is not enabled and not active on the system"fil_service_name="chrony.service"# Check chronyservice_not_enabled_chk
if[-n"$l_out2"];thenl_chrony="y"l_out_chrony="$l_out2"elsel_chrony="n"l_out_chrony="\n - Daemon: \"$l_service_name\" is not enabled and not active on the system"fil_status="$l_timesyncd$l_chrony"case"$l_status"inyy)l_output2=" - More than one time sync daemon is in use on the system$l_out_tsd$l_out_chrony";;nn)l_output2=" - No time sync daemon is in use on the system$l_out_tsd$l_out_chrony";;yn|ny)l_output=" - Only one time sync daemon is in use on the system$l_out_tsd$l_out_chrony";;*)l_output2=" - Unable to determine time sync daemon(s) status";;esacif[-z"$l_output2"];thenecho-e"\n- Audit Result:\nelseecho -e "\n-AuditResult:\n:\n$l_output2\n"fi}
NOTE: Follow the guidance in the subsection for the time synchronization daemon available on the system and skip the other time synchronization daemon subsection.
On physical systems, and virtual systems where host based time synchronization is not available.
Select one of two three time synchronization daemons; chrony (1), systemd-timesyncd (2) and following the remediation procedure for the selected daemon.
Note: enabling more than one synchronization daemon could lead to unexpected or unreliable results:
chrony
Run the following command to install chrony:
# apt install chrony
Run the following commands to stop and mask the systemd-timesyncd daemon: