Support outgoing zone transfers

These can be enabled by adding "transfer out" to the Corefile. Without
it no AXFR is allowed.

For now only AXFR and no IXFR. No TSIG and no ACLs.
This commit is contained in:
Miek Gieben
2016-03-28 12:08:05 +01:00
parent 6324bb1fa7
commit e56d206542
10 changed files with 195 additions and 27 deletions

View File

@@ -1,10 +1,5 @@
package file
// TODO(miek): the zone's implementation is basically non-existent
// we return a list and when searching for an answer we iterate
// over the list. This must be moved to a tree-like structure and
// have some fluff for DNSSEC (and be memory efficient).
import (
"io"
"log"
@@ -19,7 +14,6 @@ type (
File struct {
Next middleware.Handler
Zones Zones
// Maybe a list of all zones as well, as a []string?
}
Zones struct {
@@ -40,6 +34,11 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
return f.Next.ServeDNS(ctx, w, r)
}
if state.Proto() != "udp" && state.QType() == dns.TypeAXFR {
xfr := Xfr{z}
return xfr.ServeDNS(ctx, w, r)
}
rrs, extra, result := z.Lookup(qname, state.QType(), state.Do())
m := new(dns.Msg)