cmd/nginx-auth/nginx-auth: update auth to allow for new domains

With MagicDNS GA, we are giving every tailnet a tailnet-<hex>.ts.net name.
We will only parse out if legacy domains include beta.tailscale.net; otherwise,
set tailnet to the full domain format going forward.

Signed-off-by: nyghtowl <warrick@tailscale.com>
pull/5063/head
nyghtowl 2 years ago committed by Melanie Warrick
parent 9c66dce8e0
commit cfbbcf6d07

@ -75,12 +75,7 @@ func main() {
log.Printf("can't extract tailnet name from hostname %q", info.Node.Name) log.Printf("can't extract tailnet name from hostname %q", info.Node.Name)
return return
} }
tailnet, _, ok = strings.Cut(tailnet, ".beta.tailscale.net") tailnet = strings.TrimSuffix(tailnet, ".beta.tailscale.net")
if !ok {
w.WriteHeader(http.StatusUnauthorized)
log.Printf("can't extract tailnet name from hostname %q", info.Node.Name)
return
}
} }
if expectedTailnet := r.Header.Get("Expected-Tailnet"); expectedTailnet != "" && expectedTailnet != tailnet { if expectedTailnet := r.Header.Get("Expected-Tailnet"); expectedTailnet != "" && expectedTailnet != tailnet {

Loading…
Cancel
Save