BlogsCloudflareNetwork Time Synchronization & Debugging Tools

Network Time Synchronization & Debugging Tools

Network Time Synchronization & Debugging Tools

6
posts
2014–2023

Cloudflare is actively involved in securing Network Time Protocol (NTP) through the development and promotion of Network Time Security (NTS). This includes operating a time service that supports NTS on its officially assigned port (4460), contributing to the standardization process, releasing source code for specialized servers, and working with implementers to resolve bugs. The goal is to improve the security of time synchronization, which is foundational for other security protocols like TLS. This post details how Go programs on Linux leverage the vDSO mechanism for efficient time retrieval via clock_gettime, significantly improving performance compared to traditional system calls.

2023

The day my ping took countermeasures

7/11/2023

This post details the author's investigation into 'ping' utility's 'taking countermeasures' message, triggered by a system clock rollback before NTP synchronization. It explains how 'ping' handles negative RTT measurements by resetting them to 0ms. The post also explores the challenges of tracing time-related system calls (gettimeofday) due to the use of VDSO, and demonstrates how to overcome this by using LD_PRELOAD to force fallback to slower syscalls. Finally, it showcases how strace's fault injection feature can be used to reliably trigger the 'taking countermeasures' message by manipulating the gettimeofday return value.

2020

NTS is now an RFC

10/1/2020

This post announces that Network Time Security (NTS) has officially become RFC 8915. Cloudflare has updated its time service to use the official NTS key exchange port (4460) and highlights the availability of NTS support in chrony and ntpsec. It emphasizes the security benefits of NTS over traditional NTP authentication methods, particularly in preventing man-in-the-middle attacks, and encourages wider adoption by operating system vendors, administrators, and NTP server operators. Cloudflare also mentions its ongoing work with Roughtime and its commitment to making secure time synchronization easily accessible.

2019

Announcing cfnts: Cloudflare's implementation of NTS in Rust

10/31/2019

This post announces the open-sourcing of Cloudflare's Rust implementation of the Network Time Security (NTS) protocol, named cfnts. It details the NTS protocol's two sub-protocols (NTS-KE and NTPv4), the security mechanisms employed (AEAD, cookies, nonces, encrypted extensions), and the rationale for choosing Rust (memory safety, non-nullability, thread safety, immutability, error handling) over Go for this critical service. It also outlines dependencies used (Mio, Rustls) and the implementation strategy of leveraging chrony for clock adjustment while focusing on NTS protocol implementation. The post also touches on participation in IETF hackathons for interoperability testing.

Introducing time.cloudflare.com

6/21/2019

This post introduces time.cloudflare.com, a free time service that supports both NTP and the emerging Network Time Security (NTS) protocol. It details the security vulnerabilities in the core NTP protocol, including attacks that can be launched by off-path attackers using IP fragmentation, and explains the need for securing NTP due to its critical role in various security mechanisms like cryptography and two-factor authentication. The post also discusses the limitations of existing NTP security mechanisms (symmetric key sharing, Autokey) and highlights NTS as the future of secure time synchronization.

2018

Roughtime: Securing Time with Digital Signatures

9/21/2018

This post introduces and details Cloudflare's deployment of the Roughtime protocol, a new authenticated time service. It explains the protocol's mechanics, including nonces, digital signatures, delegation, Merkle trees for batching, and UDP transport. It highlights the problem of clock skew in TLS certificate validation and the security vulnerabilities of unauthenticated NTP. Cloudflare's motivation for deploying Roughtime is to improve the validity of TLS artifacts and contribute to a more robust Roughtime ecosystem by providing an independent server.

2014

It's Go Time on Linux

3/5/2014

This post details how Go programs on Linux leverage the vDSO mechanism for efficient time retrieval via clock_gettime, significantly improving performance compared to traditional system calls. It analyzes the evolution of timekeeping system calls (time, gettimeofday, clock_gettime) and benchmarks the performance gains of using vDSO for time.Now and gettimeofday.