mirror of
https://github.com/tailscale/tailscale.git
synced 2026-09-22 11:35:12 -04:00
The TLS probe fetched and parsed the leaf certificate's CRL on every run. That is fine when the CRL is small, but some CAs publish CRLs of several megabytes: the one for the AWS ACM R2M04 intermediate is about 2.5MB, which at the default 15s interval is a continuous 170kB/s per probed node. Cache parsed CRLs by distribution point URL and reuse each for up to an hour, or until its NextUpdate if that comes first. An hour is the HTTP max-age Let's Encrypt serves on its root CRL. A CRL is cached only after its signature verifies, every use still re-verifies it against the probing leaf's issuer (the cache is keyed by URL alone), and a CRL without a NextUpdate is never cached since it declares no validity window. Concurrent probes fetch through singleflight.DoChanContext to avoid re-fetching a single CRL, with each waiter keeping its own deadline. A caller that missed the cache re-checks it inside the singleflight closure, since singleflight dedupes only calls that overlap. Leaf certificates whose issuer is missing from the presented chain now fail before any fetch. Previously the probe downloaded the CRL and then panicked in CheckSignatureFrom, which the prober recovered and recorded as a probe failure. Also update the TLS probe's doc comments, which said OCSP where the code checks a CRL. Fixes #21310 Signed-off-by: Thomas Desrosiers <git@hive.pw>