DHCP option 42 (defined in RFC 2132) can be used to specify multiple NTP server IPv4 addresses.
(There’s also DHCP option 4, but that’s used to specify the IP for the older RFC 868 time protocol.)
DHCPv6 has option 31 for SNTP (via deprecated RFC 4075), and option 56 for NTP (via RFC 5908).
So, that would probably be the best option: Get an NTP address from DHCP or DHCPv6, use that to set your clock, bring up DNS over TLS/HTTPS, re-configure NTP with your preferred source, re-sync your clock, and then continue booting!
I also added a RTC module so it could hold reasonable time during power-loss but I haven't had a chance to verify that it works as expected.
[1]: https://www.aliexpress.com/item/1005001623104119.html The 7M and M8N are both much better than the 6M, regardless get a module with PPS output pin, not all have it. And grab an active antenna, you'll probably need it.
[2]: https://austinsnerdythings.com/2021/04/19/microsecond-accura...
https://www.ebay.com/itm/384876455621
which is pretty nice because it has an onboard RTC and battery backup. I then added on a timing specific GPS module that was made to fit onto the GPIO pins (https://www.tindie.com/products/nsayer/gps-timing-module-bre...). The CM4 is interesting because it supports hardware timestamping on the ethernet so it can actually run PTP for ultra-precise synchronization. Also added one of those SPI 8 digit seven segment displays and wrote a crappy little program to update the time as fast as possible for some bling. It sucks the CM4 ended up being the biggest cost of the project since I ended up paying ~80 bucks for it. Still far cheaper than the cost of a "real" PTP host.
If the initial NTP addresses are within a datacenter LAN (say, 10.x.x.x, etc), they are likely harder to spoof. Should be fine their case (servers).
DNS needs to be connectionless; it’s building block protocol for TCP. DnsCurve is much closer to what we actually need.
I've also written about performance of DNS over TLS [3] and found it to be negligible. The TLS setup is only done infrequently.
[1] https://ianix.com/pub/dnssec-outages.html [2] https://cyounkins.medium.com/costs-and-benefits-of-local-dns... [3] https://cyounkins.medium.com/performance-of-dns-over-tls-4f4...
TLS DNS provides confidentiality, in addition to hop-by-hop integrity; DNSSEC provides no integrity, which has led to a decade of rationalizing by its advocates about DNS not "needing" confidentiality.
This doesn't make any sense as you could use DNS and TCP separately (for example finding a hostname using DNS to connect your video streaming ingestion server running via UDP and hardcoded addresses to bootstrap installation files via TCP respectively).
Google, Cloudflare and Facebook has vanity IPv6 address, pretty sure they are all static anycast IPs.
time.google.com - 2001:4860:4806::
time.cloudflare.com - 2606:4700:f1::123
time.facebook.com - 2a03:2880:ff0c::123
45.127.112.2
45.127.113.2
The best workaround that we've found is to use the date in a HTTP Header to set the initial time (if we detect this condition):
$ curl -sI http://api.screenlyapp.com | grep Date
Date: Fri, 30 Dec 2022 08:43:56 GMT
With this set, you should be able to trigger the initial NTP service to start and set the date.
There's a Rust library here that can parse these dates for you: https://docs.rs/httpdate/0.3.2/httpdate/
So then you could just query one of the ntp servers using dns instead?
$ curl -sI http://1.1.1.1 | grep Date
$ curl -I http://api.screenlyapp.com
HTTP/1.1 301 Moved Permanently
Date: Fri, 30 Dec 2022 09:01:44 GMT [...]
sudo LC_ALL=C /sbin/tune2fs -l /dev/nvme0n1 |grep 2022 tune2fs 1.46.6-rc1 (12-Sep-2022) Last mount time: Thu Dec 29 20:05:22 2022 Last write time: Fri Dec 30 11:14:35 2022 Last checked: Wed Aug 31 09:37:57 2022
(It looks like "Last write time" is actually "Last umount time", because it is not refreshed during usage of the FS)
You can't (usefully) tunnel NTP inside of wireguard, because if your clock is wrong your peers won't talk to you anymore.
This is my personal pet peeve.
IMHO the wireguard handshake needs to be extended to allow one peer (the one that didn't reboot) to reply to a packet with a non-monotonically-increasing nonce with some signal saying "hey, here is the last nonce I got from you". Obviously this reply would be encrypted.
Then hazmat-free hardware could use these replies to reset its nonce (for that particular peer only) if we haven't had a successful handshake with that peer since the last reboot and/or the system clock is implausible. Obviously this behavior would be off-by-default. I would enable it for my batteryless routers.
Most of the "secure this" wrappers like TLS+X.509 assume a clock.
They do. Cloudflare does anyway. time.cloudflare.com is backed by a set of anycasted IPs covering around 275 POPs.
For me time.cloudflare.com = 162.159.200.123
Rookie mistake, like not using UTC time on the servers. =)
Thus, it is generally a safe assumption to check if the system release date is in the future. One often doesn't want to trip this fix every boot as it can have collateral consequences in poorly written software.
We have a no time-travelers policy in most situations, and recommend others try to also constrain transactional-validity temporal-windows. Some hardware fakes an RTC by writing the current time to a cache file on disk on power cycles, but it would take a hour to explain why this is unwise (even if using GPS stratum time). =)
Of all the validations, this one seems like the one that causes problems in edge cases most frequently. I'm definitely not saying that expiry times should be ignored by default; just that client should have the option to do it.
This is obviously a problem for embedded devices, but it even goes to the browser level: when a certificate expired yesterday but is otherwise valid, I as a user want to be able to ignore that and only that error, particularly for a pinned certificate, since it's more likely to be incompetent sysadmin than malicious attacker.
Or add cert_ignore_timestamp=true to the main configuration file. Initially, cert expiration won't be checked, but as soon as a DNS server will be reachable, this feature will automatically disable itself.
This is for dnscrypt-proxy. Alternative clients may have something similar.
At my high school, we had laptop carts that were notorious for losing their time, and nobody could log in because they were bound to AD over wifi. The system was offline because it would reject the RADIUS certificate of the wifi network due to the time being wrong. We had to manually log in as local admin to change the time or plug them all into ethernet until they could connect to NTP.
Alternatively it would be good to use an anycast IP for NTP. This is normally a bad idea because it makes calculating skew hard/unreliable, but that really should just mean a poorly sync'ed clock. So set the Anycast clock to be an intentionally high/poor Stratum score, list this along with a DNS based address so it's used until the encrypted DNS can be resolved with a better Stratum score.
So, Dear Akamai/Cloudflare/MANGA/etc. please provide a high stratum, Anycast address for basic, approximate NTP.