mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-01 14:12:32 -08:00
crypto/tls sends no SNI for an IP address ServerName, so the ConnectionState.ServerName seen by our VerifyConnection hook was empty. x509 verification with an empty DNSName skips the name check, so any cert from a trusted CA was accepted when dialing by IP, such as a DERP node whose HostName is an IP using a LetsEncrypt IP cert. Fall back to the IP in the tls.Config's ServerName, and fail if there's no name to check, which includes net/http dials by IP. Also, stop clearing RootCAs in Config, so SetConfigExpectedCert (used for DERPNode.CertName) no longer drops the caller's extra roots. Updates #11776 Updates #8085 Signed-off-by: Brad Fitzpatrick <[email protected]> Change-Id: I3c810277895ba18f16f0b5de229b7d4fd972a802