Files
Brad Fitzpatrick 21b1804d95 ipn/ipnlocal,cmd/tailscale/cli: add Funnel BYODomain support
This starts to let users serve their own domain (e.g. foo.com) through
Funnel by CNAMEing it to their node's MagicDNS name, rather than being
limited to NODE.TAILNET.ts.net.

Backend (ipn/ipnlocal):
 - serve.go: a process-wide map of pending TLS-ALPN-01 challenge certs
   keyed by SNI, plus install/lookup helpers. Exposed to cert.go via two
   feature.Hook entries declared in local.go so the state only links in
   when serve is compiled in (i.e. not ts_omit_serve).
 - cert.go: resolveCertDomain accepts a non-ts.net domain when the local
   serve config references it as a Web host. getCertPEM dispatches to
   dns-01 (ts.net, control-managed zone) or tls-alpn-01 (BYO) based on
   whether the domain matches DNS.CertDomains. The tls-alpn-01 case
   installs the challenge cert via hookServeInstallALPNChallengeCert and
   defers its cleanup until the ACME order completes.
 - serve.go: getTLSServeCertForPort peeks ClientHelloInfo.SupportedProtos
   for "acme-tls/1" and returns the stashed challenge cert, refusing the
   handshake if the ALPN is offered without an in-flight challenge.
   NextProtos on the HTTPS TLS configs gain "acme-tls/1"; ServeTLS still
   prepends "h2" and appends "http/1.1" so real-client protocol
   selection is unchanged.

CLI (cmd/tailscale/cli):
 - New --host flag on `tailscale serve` / `tailscale funnel`. When set,
   the serve config Web and AllowFunnel entries are keyed under the
   given hostname (e.g. foo.com:443) rather than the node's own
   DNSName. Mutually exclusive with --service.

Tests added for resolveCertDomain BYO acceptance, preferredChallengeType
dispatch, --host serve-config shape, and the --host/--service mutual
exclusion.

Updates tailscale/corp#41736

Change-Id: I95a6a77d72570444f62d5734efcb7a9595887c56
2026-05-13 01:10:07 +00:00
..