Chapter 4. Overview of Network Time Security (NTS) in chrony
Network Time Security (NTS) is an authentication mechanism for Network Time Protocol (NTP), designed to scale substantial clients. It verifies that the packets received from the server machines are unaltered while moving to the client machine. Network Time Security (NTS) includes a Key Establishment (NTS-KE) protocol that automatically creates the encryption keys used between the server and its clients.
NTS is not compatible with the FIPS and OSPP profile. When you enable the FIPS and OSPP profile, chronyd that is configured with NTS can abort with a fatal message. You can disable the OSPP profile and FIPS mode for chronyd service by adding the GNUTLS_FORCE_FIPS_MODE=0 setting to the /etc/sysconfig/chronyd file.
4.1. Enabling Network Time Security (NTS) on a client Copy linkLink copied to clipboard!
By default, Network Time Security (NTS) is not enabled. You can enable NTS in the /etc/chrony.conf file.
Prerequisites
- The time server supports NTS.
Procedure
Edit the /etc/crony.conf file, and make the following changes:
Specify the server with the
ntsoption in addition to theiburstoption.For example: server time.example.com iburst nts server nts.netnod.se iburst nts server ptbtime1.ptb.de iburst nts
For example: server time.example.com iburst nts server nts.netnod.se iburst nts server ptbtime1.ptb.de iburst ntsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following setting to avoid repeating the Network Time Security-Key Establishment (NTS-KE) session during system boot:
ntsdumpdir /var/lib/chrony
ntsdumpdir /var/lib/chronyCopy to Clipboard Copied! Toggle word wrap Toggle overflow If present, comment out or remove the following setting to disable synchronization with Network Time Protocol (NTP) servers provided by
DHCP:sourcedir /run/chrony-dhcp
sourcedir /run/chrony-dhcpCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the
chronydservice:systemctl restart chronyd
systemctl restart chronydCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify if the
NTSkeys were successfully established:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
KeyID,Type, andKLenshould have non-zero values. If the value is zero, check the system log for error messages fromchronyd.Verify the client is making NTP measurements:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
Reachcolumn should have a non-zero value; ideally 377. If the value rarely gets 377 or never gets to 377, it indicates that NTP requests or responses are getting lost in the network.
4.2. Enabling Network Time Security (NTS) on a time server Copy linkLink copied to clipboard!
If you run your own Network Time Protocol (NTP) server, you can enable the server Network Time Security (NTS) support to facilitate its clients to synchronize securely.
If the NTP server is a client of other servers, that is, it is not a Stratum 1 server, it should use NTS or symmetric key for its synchronization.
Prerequisites
-
Server private key in
PEMformat -
Server certificate with required intermediate certificates in
PEMformat
Procedure
Edit the
/etc/chrony.conffile, and make the following changes:ntsserverkey /etc/pki/tls/private/<ntp-server.example.net>.key ntsservercert /etc/pki/tls/certs/<ntp-server.example.net>.crt
ntsserverkey /etc/pki/tls/private/<ntp-server.example.net>.key ntsservercert /etc/pki/tls/certs/<ntp-server.example.net>.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set permissions on both the private key and the certificate file that allow the chrony user to read the files, for example
chown root:chrony /etc/pki/tls/private/<ntp-server.example.net>.key /etc/pki/tls/certs/<ntp-server.example.net>.crt chmod 644 /etc/pki/tls/private/<ntp-server.example.net>.key /etc/pki/tls/certs/<ntp-server.example.net>.crt
# chown root:chrony /etc/pki/tls/private/<ntp-server.example.net>.key /etc/pki/tls/certs/<ntp-server.example.net>.crt # chmod 644 /etc/pki/tls/private/<ntp-server.example.net>.key /etc/pki/tls/certs/<ntp-server.example.net>.crtCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Ensure that the
ntsdumpdir /var/lib/chronysetting is present. Open the required ports in firewalld:
firewall-cmd --permanent --add-port={323/udp,4460/tcp} firewall-cmd --reload# firewall-cmd --permanent --add-port={323/udp,4460/tcp} # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the
chronydservice:systemctl restart chronyd
# systemctl restart chronydCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Perform a test from a client machine:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
System clock wrongmessage indicates the NTP server is accepting NTS-KE connections and responding with NTS-protected NTP messages.Verify the NTS-KE connections and authenticated NTP packets observed on the server:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the value of the
NTS-KE connections acceptedandAuthenticated NTP packetsfield is a non-zero value, it means that at least one client was able to connect to the NTS-KE port and send an authenticated NTP request.