From c91522c516120c32e855f6b6fdb9da8fb13ef7ca Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Wed, 19 Feb 2025 13:39:01 +1100 Subject: [PATCH] fix(vpn): force lowercase DNS hostnames --- tailnet/controllers.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tailnet/controllers.go b/tailnet/controllers.go index e0a57660624e2..832baf09cddf5 100644 --- a/tailnet/controllers.go +++ b/tailnet/controllers.go @@ -883,23 +883,30 @@ type Workspace struct { } // updateDNSNames updates the DNS names for all agents in the workspace. +// DNS hosts must be all lowercase, or the resolver won't be able to find them. +// Usernames are globally unique & case-insensitive. +// Workspace names are unique per-user & case-insensitive. +// Agent names are unique per-workspace & case-insensitive. func (w *Workspace) updateDNSNames() error { + wsName := strings.ToLower(w.Name) + username := strings.ToLower(w.ownerUsername) for id, a := range w.agents { + agentName := strings.ToLower(a.Name) names := make(map[dnsname.FQDN][]netip.Addr) // TODO: technically, DNS labels cannot start with numbers, but the rules are often not // strictly enforced. - fqdn, err := dnsname.ToFQDN(fmt.Sprintf("%s.%s.me.coder.", a.Name, w.Name)) + fqdn, err := dnsname.ToFQDN(fmt.Sprintf("%s.%s.me.coder.", agentName, wsName)) if err != nil { return err } names[fqdn] = []netip.Addr{CoderServicePrefix.AddrFromUUID(a.ID)} - fqdn, err = dnsname.ToFQDN(fmt.Sprintf("%s.%s.%s.coder.", a.Name, w.Name, w.ownerUsername)) + fqdn, err = dnsname.ToFQDN(fmt.Sprintf("%s.%s.%s.coder.", agentName, wsName, username)) if err != nil { return err } names[fqdn] = []netip.Addr{CoderServicePrefix.AddrFromUUID(a.ID)} if len(w.agents) == 1 { - fqdn, err := dnsname.ToFQDN(fmt.Sprintf("%s.coder.", w.Name)) + fqdn, err := dnsname.ToFQDN(fmt.Sprintf("%s.coder.", wsName)) if err != nil { return err } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy