Taking the long-term private key out of a Roughtime server #
A Roughtime server signs every response, so its signing key has to sit on a machine that faces the internet. If that were the key clients trust, anyone who broke into the VPS could sign false time until every client was reconfigured.
The protocol accounts for this. The server’s long-term Ed25519 key never signs responses. It signs a delegation: a certificate saying that some other key, the online key, may sign time responses between two timestamps. So the long-term private key can be stored elsewhere, and the online service only ever holds time-bounded certificates.
I’ve now set my Roughtime server up this way. The long-term root key lives on an ESP32 node. The VPS has only the root public key, which it uses to verify delegations. Time still comes from the VPS’s own system clock, maintained by chrony, and responses are signed with the online key.
The ESP32 node agrees on time with three NTP servers before it issues its first delegation, since a certificate is only as good as the timestamps in it. After that it targets a fresh upload every minute. The Roughtime server verifies each newer delegation and saves it before returning a signed receipt. The ESP32 node verifies that receipt, so it knows the delegation landed, then turns off Wi-Fi and shows “Delegated OK” on the OLED. I verified two successive uploads on the live service, along with responses in both the IETF draft-11 and Google Roughtime formats.
Each certificate is valid for fourteen days, starting twenty-four hours before issuance. So it expires thirteen days after it was issued, and that number cuts both ways. If the ESP32 node goes quiet, the server keeps working for about thirteen days on the last certificate. But if the VPS is compromised, the attacker gets the online key and can sign false time responses for as long as its certificates last, which is up to thirteen days after renewal stops.
What the attacker can’t do is issue a delegation for a replacement key. So recovery is manual but doesn’t touch clients: stop renewing the compromised key, wait for its last certificate to expire, and delegate a new online key under the same root public key.
The root key isn’t safe on the ESP32 node, just harder to reach. Its flash is unencrypted, so anyone with physical access to the board can read the root seed.
(The ESP32 node is an ESP32-C3 on solar power, so it will go quiet sometimes. Its firmware is all Rust, using Ferris-on-Air and embassy, except for some binary bits for the radio.)
Useful commands:
./bin/getroughtime -ping 57.129.106.133:2505 -pubkey "NmF6AgV9Fdgurh64HYsYq9352vcXeTxcrbIG0YeM1Wk=" -ping-version IETF-Roughtime
curl http://57.129.106.133:2505/roughtime-status | jq