diff --git a/nameserver/http.go b/nameserver/http.go index 29311d4c07..5cd70f5ad3 100644 --- a/nameserver/http.go +++ b/nameserver/http.go @@ -35,6 +35,11 @@ func (n *Nameserver) HandleHTTP(router *mux.Router, dockerCli *docker.Client) { return } + if !dns.IsSubDomain(n.domain, hostname) { + n.infof("Ignoring registration %s %s %s (not a subdomain of %s)", hostname, ipStr, container, n.domain) + return + } + if err := n.AddEntry(hostname, container, n.ourName, ip); err != nil { n.badRequest(w, fmt.Errorf("Unable to add entry: %v", err)) return