CoreDNS is a DNS server that chains plugins
Find a file
Miek Gieben fc667b98e0
Fix EDNS0 compliance (#2357)
* Fix EDNS0 compliance

Do SizeAndDo in the server (ScrubWriter) and remove all uses of this
from the plugins. Also *always* do it. This is to get into compliance
for https://dnsflagday.net/.

The pkg/edns0 now exports the EDNS0 options we understand; this is
exported to allow plugins add things there. The *rewrite* plugin used
this to add custom EDNS0 option codes that the server needs to
understand.

This also needs a new release of miekg/dns because it triggered a
race-condition that was basicly there forever.

See:
* https://github.com/miekg/dns/issues/857
* https://github.com/miekg/dns/pull/859

Running a test instance and pointing the https://ednscomp.isc.org/ednscomp
to it shows the tests are now fixed:

~~~
EDNS Compliance Tester
Checking: 'miek.nl' as at 2018-12-01T17:53:15Z

miek.nl. @147.75.204.203 (drone.coredns.io.): dns=ok edns=ok edns1=ok edns@512=ok ednsopt=ok edns1opt=ok do=ok ednsflags=ok docookie=ok edns512tcp=ok optlist=ok
miek.nl. @2604:1380:2002:a000::1 (drone.coredns.io.): dns=ok edns=ok edns1=ok edns@512=ok ednsopt=ok edns1opt=ok do=ok ednsflags=ok docookie=ok edns512tcp=ok optlist=ok

All Ok
Codes
ok - test passed.
~~~

Signed-off-by: Miek Gieben <miek@miek.nl>

Signed-off-by: Miek Gieben <miek@miek.nl>

* typos in comments

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-12-06 21:18:11 +00:00
.github Create ISSUE_TEMPLATE.md (#2297) 2018-11-13 15:32:40 +00:00
.presubmit Make presubmit actually fail the build (#2013) 2018-07-29 23:41:52 -07:00
core Log error on SO_REUSEPORT and continue (#2243) 2018-10-28 16:02:58 +00:00
coremain Bump version to 1.2.6 (#2271) 2018-11-04 18:06:20 +00:00
man docs: run make Makefile.doc (#2210) 2018-10-18 09:47:03 +01:00
pb Watch feature (#1527) 2018-06-27 07:45:32 -07:00
plugin Fix EDNS0 compliance (#2357) 2018-12-06 21:18:11 +00:00
request Fix EDNS0 compliance (#2357) 2018-12-06 21:18:11 +00:00
test Fix EDNS0 compliance (#2357) 2018-12-06 21:18:11 +00:00
vendor Add request and response context to traces (#2162) 2018-10-05 20:13:16 +00:00
.benchmark.sh benchmark are spammy (#2144) 2018-09-27 22:04:04 +01:00
.codecov.yml Increase codecov target requirement to 50% (from 40%) (#1344) 2018-01-03 14:48:39 +00:00
.dockerignore dockerignore: ignore .git (#1723) 2018-04-24 09:23:50 +01:00
.gitignore Add debug.Hexdump (#1902) 2018-07-04 07:54:17 +01:00
.stickler.yml Add stickler config (#2009) 2018-07-27 15:00:49 +01:00
.travis.yml Remove benchmark from travis (#2350) 2018-11-29 12:29:37 -08:00
ADOPTERS.md Add more adopters from the survey (#2231) 2018-10-23 14:13:03 -04:00
CODE-OF-CONDUCT.md Add CNCF Code of Conduct (#565) 2017-03-03 07:34:17 +00:00
CONTRIBUTING.md Dep helper (#2151) 2018-09-29 23:47:07 +01:00
coredns.1.md Run make -f Makefile.doc (#1875) 2018-06-13 11:02:14 +01:00
coredns.go Enhancement of external plugin enabling (#1392) 2018-01-15 21:54:10 +00:00
corefile.5.md Typo fixes (#2031) 2018-08-14 08:55:55 -07:00
directives_generate.go Enhancement of external plugin enabling (#1392) 2018-01-15 21:54:10 +00:00
Dockerfile Docker: drop alpine (#1843) 2018-06-04 19:20:21 +01:00
Gopkg.lock Add request and response context to traces (#2162) 2018-10-05 20:13:16 +00:00
Gopkg.toml Update k8s client-go to v8.0.0 (#1922) 2018-07-01 12:08:46 -07:00
GOVERNANCE.md Governance: Clarify definition of "Transparent and accessible" (#2300) 2018-11-13 23:24:56 +00:00
LICENSE Cleanups, removing Caddy name a bit more 2016-03-19 07:42:21 +00:00
Makefile Fix EDNS0 compliance (#2357) 2018-12-06 21:18:11 +00:00
Makefile.doc Run make -f Makefile.doc (#1875) 2018-06-13 11:02:14 +01:00
Makefile.fuzz fuzz: put fuzzing stuff in own build tag (#1215) 2017-11-10 13:59:42 +00:00
Makefile.release rename VERBOSE to be more generic (#2172) 2018-10-10 09:39:31 -04:00
OWNERS OWNERS: Add email (#2313) 2018-11-15 21:44:27 +00:00
plugin.cfg New plugin: loop (#1989) 2018-07-20 19:45:17 +01:00
plugin.md Use logging (#1718) 2018-04-22 21:40:33 +01:00
README.md Revert "Invite users to fill the survey (#2020)" (#2222) 2018-10-23 20:18:49 +01:00
SECURITY-RELEASE-PROCESS.md Update SECURITY-RELEASE-PROCESS.md (#2237) 2018-10-25 06:39:43 +00:00

CoreDNS

Documentation Build Status Code Coverage Docker Pulls Go Report Card CII Best Practices

CoreDNS (written in Go) chains plugins. Each plugin performs a DNS function.

CoreDNS is a Cloud Native Computing Foundation incubating level project.

CoreDNS is a fast and flexible DNS server. The keyword here is flexible: with CoreDNS you are able to do what you want with your DNS data by utilizing plugins. If some functionality is not provided out of the box you can add it by writing a plugin.

CoreDNS can listen for DNS request coming in over UDP/TCP (go'old DNS), TLS (RFC 7858) and gRPC (not a standard).

Currently CoreDNS is able to:

  • Serve zone data from a file; both DNSSEC (NSEC only) and DNS are supported (file).
  • Retrieve zone data from primaries, i.e., act as a secondary server (AXFR only) (secondary).
  • Sign zone data on-the-fly (dnssec).
  • Load balancing of responses (loadbalance).
  • Allow for zone transfers, i.e., act as a primary server (file).
  • Automatically load zone files from disk (auto).
  • Caching (cache).
  • Use etcd as a backend (replace SkyDNS) (etcd).
  • Use k8s (kubernetes) as a backend (kubernetes).
  • Serve as a proxy to forward queries to some other (recursive) nameserver (proxy, and forward).
  • Provide metrics (by using Prometheus) (metrics).
  • Provide query (log) and error (errors) logging.
  • Support the CH class: version.bind and friends (chaos).
  • Support the RFC 5001 DNS name server identifier (NSID) option (nsid).
  • Profiling support (pprof).
  • Rewrite queries (qtype, qclass and qname) (rewrite and template).

And more. Each of the plugins is documented. See coredns.io/plugins for all in-tree plugins, and coredns.io/explugins for all out-of-tree plugins.

Compilation from Source

Check out the project and do dependency resolution with:

% go get github.com/coredns/coredns

Some of the dependencies require Go version 1.9 or later.

We vendor most (not all!) packages. Building from scratch is easiest, by just using make:

% make

This should yield a coredns binary.

Compilation with Docker

CoreDNS requires Go to compile. However, if you already have docker installed and prefer not to setup a Go environment, you could build CoreDNS easily:

$ docker run --rm -i -t -v $PWD:/go/src/github.com/coredns/coredns \
      -w /go/src/github.com/coredns/coredns golang:1.11 make

The above command alone will have coredns binary generated.

Examples

When starting CoreDNS without any configuration, it loads the whoami plugin and starts listening on port 53 (override with -dns.port), it should show the following:

.:53
2016/09/18 09:20:50 [INFO] CoreDNS-001
CoreDNS-001

Any query send to port 53 should return some information; your sending address, port and protocol used.

If you have a Corefile without a port number specified it will, by default, use port 53, but you can override the port with the -dns.port flag:

./coredns -dns.port 1053, runs the server on port 1053.

Start a simple proxy, you'll need to be root to start listening on port 53.

Corefile contains:

.:53 {
    forward . 8.8.8.8:53
    log
}

Just start CoreDNS: ./coredns. Then just query on that port (53). The query should be forwarded to 8.8.8.8 and the response will be returned. Each query should also show up in the log which is printed on standard output.

Serve the (NSEC) DNSSEC-signed example.org on port 1053, with errors and logging sent to standard output. Allow zone transfers to everybody, but specifically mention 1 IP address so that CoreDNS can send notifies to it.

example.org:1053 {
    file /var/lib/coredns/example.org.signed {
        transfer to *
        transfer to 2001:500:8f::53
    }
    errors
    log
}

Serve example.org on port 1053, but forward everything that does not match example.org to a recursive nameserver and rewrite ANY queries to HINFO.

.:1053 {
    rewrite ANY HINFO
    forward . 8.8.8.8:53

    file /var/lib/coredns/example.org.signed example.org {
        transfer to *
        transfer to 2001:500:8f::53
    }
    errors
    log
}

IP addresses are also allowed. They are automatically converted to reverse zones:

10.0.0.0/24 {
    whoami
}

Means you are authoritative for 0.0.10.in-addr.arpa..

This also works for IPv6 addresses. If for some reason you want to serve a zone named 10.0.0.0/24 add the closing dot: 10.0.0.0/24. as this also stops the conversion.

This even works for CIDR (See RFC 1518 and 1519) addressing, i.e. 10.0.0.0/25, CoreDNS will then check if the in-addr request falls in the correct range.

Listening on TLS and for gRPC? Use:

tls://example.org grpc://example.org {
    whoami
}

Specifying ports works in the same way:

grpc://example.org:1443 {
    # ...
}

When no transport protocol is specified the default dns:// is assumed.

Community

We're most active on Github (and Slack):

More resources can be found:

Deployment

Examples for deployment via systemd and other use cases can be found in the deployment repository.

Security

If you find a security vulnerability or any security related issues, please DO NOT file a public issue, instead send your report privately to security@coredns.io. Security reports are greatly appreciated and we will publicly thank you for it.

Please consult security vulnerability disclosures and security fix and release process document