Labs / Speaking Protocols / Time & office: NTP, files, FTP & PTP

Lab 1 of 4 · Time & office: NTP, files, FTP & PTP

NTP: keeping clocks right, and what a wrong one breaks

Set clocks with NTP, outvote a wrong one, and watch a bad clock break TLS.

Open this lab Pro 5 steps

The idea

Every clock drifts. NTP keeps it right by asking better clocks, and a clock that is wrong breaks HTTPS. The laptop asks timeServer, which follows referenceClock; brokenClock is two years behind, and bank serves a page over HTTPS.

Two clocks, four stamps
Two clocks, four stamps
One certificate, three verdicts
One certificate, three verdicts

Steps

  1. Ask a clock the time

    A computer's clock gains or loses a little every day, and logs, logins and certificates all trust it. So the laptop asks referenceClock, the best clock here, how far off its own clock is. This changes nothing yet: it only measures.

    laptop:~# chronyd -Q 'server referenceClock.lab iburst'
  2. Each clock one step further

    Thousands of devices cannot all ask the one best clock, so clocks follow clocks in a tree. The laptop follows timeServer, and timeServer follows referenceClock. Ask the laptop's clock program, chrony, whom it follows, then walk up the chain.

    laptop:~# chronyc tracking
    timeServer:~# chronyc tracking
    referenceClock:~# chronyc tracking

Pro

3 more steps in the app

  1. A clock that is wrong
  2. More servers outvote a liar
  3. A wrong clock breaks HTTPS
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab