Commit 12b7e8ac authored by ale's avatar ale

Ensure that NS records are dot-terminated

parent 35ec85f2
Pipeline #6003 passed with stages
in 5 minutes and 27 seconds
......@@ -19,9 +19,7 @@ const (
)
func newDNSHandler(n *Node, origin string, nameservers []string) dns.Handler {
if !strings.HasSuffix(origin, ".") {
origin += "."
}
origin = ensureFinalDot(origin)
dnsz := newDNSZone(n.lb, origin, nameservers)
mux := dns.NewServeMux()
......@@ -90,7 +88,7 @@ func (d *dnsZone) ServeDNS(w dns.ResponseWriter, req *dns.Msg) {
Class: dns.ClassINET,
Ttl: nsTTL,
},
Ns: ns,
Ns: ensureFinalDot(ns),
})
}
......@@ -238,3 +236,11 @@ func runDNSServerWithContext(ctx context.Context, srv *dns.Server) error {
}()
return srv.ListenAndServe()
}
func ensureFinalDot(s string) string {
if !strings.HasSuffix(s, ".") {
return s + "."
}
return s
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment