Commit graph

34 commits

Author SHA1 Message Date
Yong Tang
c08497adee Misspell correction (#826)
Did a `misspell . | grep -v ^vendor` and fixed
several typos.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04 09:06:06 -07:00
Miek Gieben
07c7ac80e7 middleware/file: fix multiple wildcards (#787)
Don't hold on to the *first* wildcard you'll find, but keep searching,
there may be one even deeper in the tree.
Also add multi level wildcard test

Fixes #776
2017-07-24 14:21:40 -07:00
Miek Gieben
7be066e4de middleware/file: add DNSSEC support (#697)
* middleware/file: add DNSSEC support

Add tests for DNSSEC and check if everything is working.

* add signatures

* tweak

* Add DNSSEC signing tests for DNAME

* Just sign it all
2017-06-02 17:18:58 +01:00
Miek Gieben
30ecb83dce middleware/secondary: fix crash with no zone (#680)
When CoreDNS starts up and can't get a zone transfer going the Apex is
empty. This `nil` is then transformed into wireformat, which fails with
a nil pointer dereference in Go DNS.

In this case we should just return SERVFAIL, because we don't have any
info (yet). Note the lookup code returned NXDOMAIN, which is correct
from a lookup standpoint, but also invalidates every name in the future
loaded zone.

Anyway, look for an apex before doing the lookup and return SERVFAIL if
nothing is found.

Fixes #679
2017-06-01 12:33:40 +01:00
Eric Yan
d2268d3030 middleware/file: add DNAME support (#651)
* Test DNAME handling

If the DNAME itself matches the QTYPE, and the owner name matches QNAME,
the relevant DNAME RR should be included in the answer section.

Other parts of RFC 6672 are not implemented yet and hence left untested.

* Implement the DNAME substitution

As specified in RFC 6672, a DNAME substitution is performed by replacing
the suffix labels of the name being sought matching the owner name of
the DNAME resource record with the string of labels in the RDATA field.
The matching labels end with the root label in all cases. Only whole
labels are replaced.

* Handle DNAME redirection

A CNAME RR is created on-the-fly for the DNAME redirection. Be aware
that we do not have all the edge cases covered yet.

* Test DNAME owner name matching the QNAME

A DNAME RR redirects DNS names subordinate to its owner name; the owner
name of a DNAME is NOT redirected itself.

* Ignore names next to and below a DNAME record

According to RFC 6672, resource records MUST NOT exist at any subdomain
of the owner of a DNAME RR. When loading a zone, those names below the
DNAME RR will be quietly ignored.

* Streamline DNAME processing

Instead of checking DNAMEs during lookup, we use a preloaded list of
DNAME RRs to streamline the process without any runtime performance
penalty:

 * When loading the zone, keep a record of any DNAME RRs.
 * If there aren't any DNAMEs in the zone, just do the lookup as usual.
 * Only when the zone has one or more DNAME records, we look for the
   matching DNAME and ignore confronting subdomain(s) in the process.

* Make it easier to trace back through test errors

* Make DNAME handling part of lookup routine

DNAME processing is invoked only if the zone has at least one DNAME RR.

* Put DNAME resolution inside the searching of a hit

We can drop some of the other ideas; we don't need to track if we
have DNAMEs in the zone it just follows naturally from the current
lookup code.

See also: #664
2017-05-26 10:37:06 +01:00
Yong Tang
81af74aad0 Fix import path github.com/miekg/coredns -> github.com/coredns/coredns (#547)
This fix fixes import path from
`github.com/miekg/coredns`
->
`github.com/coredns/coredns`
2017-02-22 06:51:47 +00:00
Miek Gieben
3e26398e08 middleware/file: additional section processing (#531)
Add additional section processing for MX and SRV records. Update the
tests.
2017-02-19 20:42:34 +00:00
Miek Gieben
5d2e4db99d middleware/file: include sigs in additional (#456)
When asked for the NSset include glue and possible sigs in the
additional section.

Fixes #411
2016-12-14 12:50:00 +00:00
Miek Gieben
187e1dc512 middleware/file: include nsset in replies
This is required so that a resolver can upade the referral NSset
with the NSset at the child.

Update tests as well.
2016-12-09 11:59:14 +00:00
Miek Gieben
8dd47dd932 Remove some printlns 2016-11-10 14:09:49 +00:00
Miek Gieben
9328a8e7a4 Compile fixes and make it work 2016-11-10 12:58:40 +00:00
Miek Gieben
d383f279a0 Implement external lookups for CNAMEs 2016-11-10 07:48:47 +00:00
Miek Gieben
0919216d3c middleware/{file, auto}: resolve external CNAMEs
Do the same thing as in etcd and give the option of externally resolving
CNAME. This is needed when CoreDNS is a proxy as well is serving zones.
2016-11-09 21:26:49 +00:00
Miek Gieben
4ef53081c5 middleware/file: Add CNAME chain support (#400)
Up till now we would only chase 1 CNAME. Spec requires we will chase
all. This PR add support for this.  Up to 8 CNAMEs are chased (this
could be longer, by just checking for cycles, but 8 seems enough for
now).

Also add RRSIG of the first CNAME for DNSSEC.
2016-11-09 10:02:26 +00:00
Miek Gieben
243797a387 middleware/file: add nsec for wildcard expansion (#382)
A NSEC record is need to deny any other name that might exist.
Also don't blindly perform the interface conversion when getting
glue for NS records as they now may include RRSIG - also add tests
for that.
2016-11-06 08:32:07 +00:00
Miek Gieben
2cca527d9f middleware/file: fix delegations (#376)
Fix the delegation handling in the *file* and *dnssec* middleware.
Refactor tests a bit and show that they are failling.

Add a Tree printer, cleanups and tests.
Fix wildcard test - should get no answer from empty-non-terminal
2016-11-05 14:39:49 +00:00
Miek Gieben
0509f4b4ac middleware/file: reload on file mv (#365)
When a file is moved into position we should also reload the zones'
content.

This also fixes deadlock bug in the locking, a reload would block any
further lookups.
2016-10-28 12:57:02 +01:00
Miek Gieben
039596f319 middleware/file: add test for reload (#361)
This add a highlevel integration test for zone reloading. It also
fixes a data race in the actual reloading process.
2016-10-27 21:01:04 +01:00
Miek Gieben
e43384b501 middleware/file: proper support for wildcard (#323)
Add support for wildcard records, while taking care of wildcard-cnames
and DNSSEC. Add enough tests to check all the corner cases.
2016-10-08 15:22:31 +01:00
Miek Gieben
090d1872e9 Golint2 (#280)
* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* More lint fixes

This leaves:

~~~
middleware/kubernetes/nametemplate/nametemplate.go:64:6: exported type NameTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:71:1: exported method NameTemplate.SetTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:108:1: exported method NameTemplate.GetZoneFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:116:1: exported method NameTemplate.GetNamespaceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:120:1: exported method NameTemplate.GetServiceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:124:1: exported method NameTemplate.GetTypeFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:135:1: exported method NameTemplate.GetSymbolFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:167:1: exported method NameTemplate.IsValid should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:182:6: exported type NameValues should have comment or be unexported
middleware/kubernetes/util/util.go:1:1: package comment should be of the form "Package util ..."
middleware/kubernetes/util/util.go:27:2: exported const WildcardStar should have comment (or a comment on this block) or be unexported
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
~~~

I plan on reworking the proxy anyway, so I'll leave that be.
2016-09-23 09:14:12 +01:00
Miek Gieben
4e3c82bec5 CNAMEs targets should be in answer section.
A target of a cname must be put in the answer section. Fix this and add
a AAAA test for quad-AAAA CNAME responses.

Fixes #125
2016-04-16 17:55:11 +01:00
Miek Gieben
e294c95582 middleware/file: Support delegations (#124)
Return a delegation when seeing one while traversing the tree in
search of an answer.

Put the SOA and NS record in the zone.Apex as these are to be handled
somewhat special.

Lowercase record on insert to make compares easier. This lowercases
all RR that have domain names in their rdata as well.
2016-04-16 16:16:52 +01:00
Miek Gieben
2adbdf34d9 Use qname/qtype for lookups
Drop the use of dns.RR when in fact the only thing we use is the name

and type of the RR. Cleans up a bunch of stuff and also stops the weird

making of dns.RRs just for a lookup. Should safe some memory as well.



Fixes: #66
2016-04-02 17:49:13 +01:00
Miek Gieben
9b21646954 empty non-terminal support
When looking for a name in tree, return wether we got to a longer one -

if so we had an ent. Add tests + dnssec tests and refactor the tests as

well a bit.
2016-04-02 16:56:16 +01:00
Miek Gieben
09c94fa443 Positive wildcare replies
Reply to queries when you have a wildcard in the zone. This works
for DNS and DNSSEC. Thing missing is NODATA responses for that specific
wildcard.

Add wildcard_test.go as well.
2016-03-31 21:47:44 +01:00
Miek Gieben
3591e2a6aa Add nameerror proof 2016-03-30 20:47:38 +01:00
Miek Gieben
bf6d90600b add closest encloser stuff 2016-03-30 16:45:02 +00:00
Miek Gieben
9ba31ceb87 Think about wildcards 2016-03-30 13:26:51 +00:00
Miek Gieben
ec69798ca2 Add the nsecs for nxdomain 2016-03-30 13:26:51 +00:00
Miek Gieben
b67ecb3e55 More nameerror stuff 2016-03-30 13:26:51 +00:00
Miek Gieben
4be4d92ccb Fix positive replies 2016-03-30 13:25:45 +00:00
Miek Gieben
547a4ab2a8 More stuff 2016-03-30 13:25:45 +00:00
Miek Gieben
48f7d55f27 Get positive dnssec stuff going 2016-03-30 13:25:45 +00:00
Miek Gieben
5387c162c9 Implement a DNS zone
Full implementation, DNS (and in the future DNSSEC). Returns answer in a
hopefully standards compliant way.
Testing with my miek.nl zone are included as well.
This should correctly handle nodata, nxdomain and cnames.
2016-03-28 10:15:05 +01:00