Commit graph

2870 commits

Author SHA1 Message Date
Francois Tur
2440024772 Plugin/RELOAD - Tune usage of var global, add limit to options (#1457)
* tune usage of var global, add limit to options

* update readme for minimal values

* useless change to quick-off codecov

* fix msgs for min values and tune the flag for end of reload usage, with a 'maybe' option

* adding UT for min values, adding MD5 of corefile on the log
2018-02-02 13:15:56 -05:00
Uladzimir Trehubenka
3fb07161b7 Fixed dnstap panic after graceful restart (send on closed channel) (#1479) 2018-02-02 11:59:22 +02:00
Francois Tur
b93a36b213 Plugin/Proxy - add new policy always_first to mimic windows dns resolvers (#1459)
* add new policy always_first to mimic windows dns resolvers
fill documentation, add UT and cleanup fmt

* change name of policy from always_first to first. Update docs
2018-01-30 16:29:49 -05:00
Tobias Schmidt
0af9b9b16f plugin/proxy: Fix unnecessary message truncation (#1477)
As plugin/proxy always returns compressed messages, it's important to
set this before calling Scrub(), as some messages will be unnecessarily
truncated otherwise.
2018-01-30 23:18:44 +02:00
Tobias Schmidt
64d7268ed6 plugin/proxy: Don't enable HTTP healthchecking if not configured (#1441)
HTTP healthchecking will be implicitely activated for proxy upstream
hosts, even if not configured. The README states that not using the
health_check directive will disable HTTP healthchecks though.

It seems to me that the availability of the HealthCheck.Path attribute
is used as indicator whether HTTP healthchecks should be used or not.
The normalizeCheckURL() function didn't check that attribute though,
always returning a CheckURL. This would increase the healthcheck failure
on every third failure in plugin/proxy, without any possibility for the
upstream host to be marked as healthy again. This would eventually
remove all upstream hosts from the serving pool.
2018-01-30 23:10:07 +02:00
Miek Gieben
841e1a44ac Add OWNERS (#1469)
This adds the inital top-level OWNERS file. Each plugin should also get
one, but that will be more work.

Ref: #1454
2018-01-30 10:28:56 -08:00
Yong Tang
2b268134e9
Golint fix (#1475)
Golint fix to make goreportcard happy

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-30 09:31:39 -08:00
Yong Tang
09d4a9c22c
Uses external context package for server-tls.go (#1471)
This fix uses external context package for server-tls.go
This fix is a follow up to 1468.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-30 08:31:23 -08:00
Miek Gieben
b228054a9a Remove hooks directory (#1470)
This was used for docker automation or someting?
I don't think there are uses for this, lets remove it.
2018-01-30 08:15:51 -08:00
Miek Gieben
f91cb61086 Don't use standard lib context package (#1468)
With Go 1.9 you *can* include the std lib's context package and nothing
breaks. However we never officially made the move (and grpc also doesn't
ues the std lib's one).

Standardize all plugins on using the extern context package.

Fixes #1466
2018-01-30 09:19:37 -05:00
Chris O'Haver
449bb1ac6c
spelling (#1461) 2018-01-29 13:16:13 -05:00
Miek Gieben
399073ec6b pl/kubernetes: drop the comma parsing (#1453)
Let caddyfile parser give us the token, the comma sep thing also didn't
work.

Fixes #1446
2018-01-28 08:40:10 -08:00
John Belamaric
d27be86e3e
Minor refactor of proxy parsing to make upstreams re-usable in other plugins (#1426) 2018-01-27 17:25:39 -05:00
Miek Gieben
3b4235a7c6
plugin.md updates (#1451)
* plugin.md updates

Talk about return code, logging and other bits.

Also checked the code for fmt.Printf logging, there is none.

Fixes #1449 #1450

* review

* more typos
2018-01-27 20:35:52 +00:00
John Belamaric
0b35d4d28f Reload hook (#1445)
* Add reload directive

* gofmt

* Fix default jitter and error message

* remove unneeded call to NextArg, add a couple negative setup tests

* Review feedback
2018-01-27 10:42:57 +00:00
Chris O'Haver
80050766fb Tolerate go get failures for coredns/forward (#1435)
* testpr3

* hack

* chop

* tolerate coredns/coredns get fail

* remove TEST from readme
2018-01-26 16:10:45 -05:00
Miek Gieben
ed02f5f2a2 release improvements (#1439)
Last release I forgot steps, put them in Makefile.release. Generating
the manual files will be skipped if 'ronn' can't be found.
2018-01-26 08:57:08 -08:00
Pat Moroney
4b5fc3002e correct typo from hosts to route53 (#1437) 2018-01-25 23:17:47 +00:00
Miek Gieben
c56fa8dbd3
Updates (#1432)
* Enable forward

* Regen all docs
2018-01-25 21:59:08 +00:00
Miek Gieben
b89480b33f
Golint: make golint happy (#1433)
CoreVersion needs to be documented for golint, but we can't use too much
text because we grep this file for the coredns version.
2018-01-25 21:58:46 +00:00
Miek Gieben
aeacbf6e24
move flag blacklisting to main (#1431)
* move flag blacklisting to main

Doing it in init() is the wrong place or something else changed. Doing
it in main() makes it easy to see *when* this happens.

* keep trapsignals
2018-01-25 21:40:40 +00:00
Miek Gieben
ea95a2003a Release 1.0.5 2018-01-25 19:45:35 +00:00
Miek Gieben
482f9c4f14 Release is 1.0.5 2018-01-25 19:37:15 +00:00
Miek Gieben
2d00080ef5
plugin/forward: add out of tree forward plugin (#1425)
* plugin/forward: add out of tree forward plugin

This is a simpler proxy than *proxy*, include by default so it is easier
to switch (i.e. no recompile). It lacks features compared to proxy (did I
say it was simpler), but does cache udp and tcp connection, so it is
faster than proxy.

* Muck with the makefile

* Versioning forward now
2018-01-25 18:55:35 +00:00
Miek Gieben
fcfb998b86 release: default to using go-dns 1.0.4 (#1424) 2018-01-25 16:33:08 +01:00
Miek Gieben
77bd7eaede
Add on plugin (#1412)
Enable this Caddy plugin by default. Docs will go up coredns.io for this
as well.

See https://caddyserver.com/docs/on
2018-01-25 11:02:51 +00:00
Ilya Galimyanov
1e75061aec Remove pointers to labels.Selector and pass normally instead (#1422) 2018-01-24 20:44:18 +00:00
Tobias Schmidt
a0ad2ff0af plugin/etcd: Remove unnecessary test cases (#1421)
These test cases became invalid with the fix of message truncation and
don't validate anything.
2018-01-24 14:09:57 +00:00
Tobias Schmidt
697e2b4bda Fix truncation of messages longer than permitted by the client (#1417)
* Fix truncation of messages longer than permitted by the client

CoreDNS currently doesn't respect the maximum response size advertised
by the client and returns the full answer on a message with the TC bit
set. This breaks client implementations which rely on DNS servers
respecting the advertised size limit, for example the Ruby stdlib
client. It also has negative network performance implications, as large
messages will be split up into multiple UDP packets, even though the
client will discard the truncated response anyway.

While RFC 2181 permits the response of partial RRSets, finding the
correct number of records fitting into the advertised response size is
non-trivial. As clients should ignore truncated messages, this change
simply removes the full RRSet on truncated messages.

* Remove incorrect etcd test assertion

If a client requests a TXT record larger than its advertised buffer
size, a DNS server should _not_ respond with the answer, but truncate
the message and set the TC bit, so that the client can retry using TCP.
2018-01-24 13:28:26 +00:00
Tobias Schmidt
b707438534 Add coredns_build_info metric (#1418)
In order to track the rollout status of CoreDNS versions, add the common
build_info metric.
2018-01-23 20:10:55 +00:00
Francois Tur
f9c03c2ead fix computation of reverse zone based on Ipv6 CIDRs (#1415) 2018-01-23 15:58:36 +00:00
Miek Gieben
9575789c36
plugin/secondary: don't duplicate apex records (#1413)
See #1400 and the discussion in that bug.

Fixes #1400
2018-01-23 10:35:31 +00:00
Miek Gieben
85457cf50d
plugin/secondary: fix a bunch of things and tests (#1406)
Fix the error handling. Log when we have an error during any of the
transfer state. And if there isn't an error transfer the zones.

Also fix the tests in test/ so we, at least, check the initial transfer.

Update the docs to show more about how errors are handled.

Ref #1400
2018-01-23 10:35:10 +00:00
Paul Greenberg
7d371edb2d plugin/rewrite: add response rewrite docs (#1414) 2018-01-22 22:01:13 -05:00
Ruslan Drozhdzh
d4bf076ccf Emit InstanceStartupEvent after starting server (#1410) 2018-01-21 19:28:21 +00:00
Miek Gieben
4f54bd9e52
Add .dockerignore (#1411)
Ignore most of the source code - this should lead to smaller docker
images.
2018-01-21 19:27:11 +00:00
Christian Nilsson
334b6e4732 Add Tradeshift to adopters list (#1409) 2018-01-19 06:51:23 -05:00
Miek Gieben
62d9298401
Up version to 1.0.4 (#1404)
Due to the one-off nature of releases 1.0.4 we need to manually bump
the version in master.
2018-01-18 20:41:44 +00:00
Paul Greenberg
258c163bb0 feature: plugin/rewrite: rewrite ANSWER SECTION (#1318)
Resolves: #1313
2018-01-18 10:41:14 -05:00
Miek Gieben
cb3190bab1
plugin/dnssec: fix blacklies for NXDOMAIN (#1399)
* plugin/dnssec: filter bitmap also for NXDOMAIN responses

We change nxdomain to nodata, so at the point when we receive the
reply it can be nxdomain or nodata. In both cases we should filter the
nsec bitmap.

Change the code and add explicit tests for this.

* More tests
2018-01-18 13:07:23 +00:00
Miek Gieben
c39e5cd014
plugin/health: add lameduck mode (#1379)
* plugin/health: add lameduck mode

Add a way to configure lameduck more, i.e. set health to false, stop
polling plugins. Then wait for a duration before shutting down. As the
health middleware is configured early on in the plugin list, it will
hold up all other shutdown, meaning we still answer queries.

* Add New

* More tests

* golint

* remove confusing text
2018-01-18 10:40:09 +00:00
Miek Gieben
318bab7795
plugin/dnssec: check validityperiod of RRSIGs (#1385)
* plugin/dnssec: check validityperiod of RRSIGs

Somehow we missed implementing this. If a sig a retrieved from the
cache, but not valid anymore, regenerate it instead of server invalid
signatures.

Fixes #1378

* drop from cache after 3/4 validity

* six days means 6 days
2018-01-18 10:39:22 +00:00
Tobias Schmidt
dd9fc8962c plugin/cache: Fix prefetching issues (#1363)
* Improve plugin/cache metrics

* Add coredns_cache_prefetch_total metric to track number of prefetches.
* Remove unnecessary Cache.get() call which would incorrectly increment
  cache counters.
* Initialize all counters and gauges at zero.

* Allow prefetching of a single request per ttl

The original implementation didn't allow prefetching queries which are
only requested once during the duration of a TTL. The minimum amount of
queries which had to be seen was therefore capped at 2.

This change also implements a real prefetch test. The existing test was
a noop and always passed regardless of any prefetch implementation.

* Fix prefetching for items with a short TTL

The default prefetch threshold (percentage) is 10% of the lifetime of a
cache item. With the previous implementation, this disabled prefetching
for all items with a TTL < 10s (the resulting percentage would be 0, at
which point a cached item is already discarded).

This change uses a time based threshold calculation and ensures that
a prefetch is triggered at a TTL of 1 at the latest.

* Fix wrong duration reporting of cached responses

The logging and metrics plugins (among others) included the duration of
a cache prefetch in the request latency of client request. This change
fixes this wrong reporting and executes the prefetch request in a
goroutine in the background.
2018-01-17 07:35:22 +00:00
Yong Tang
fe0767987e
Fix several typos (#1395)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 18:27:47 -08:00
Yong Tang
9d87b953a0 Enhancement of external plugin enabling (#1392)
This fix is an enhancement of external plugin enabling.
Previously, it was already able to build a customerized
coredns with plugins enabled selectively, without changing
coredns source code. However, all default plugins are
actually bundled because of the import rule:
```
"github.com/coredns/coredns/coremain"
```

The issue is best described with the following:
```
root@localhost:/go/src/github.com/coredns/coredns/sample# cat sample.go
package main

import (
        _ "github.com/coredns/forward"

        "github.com/coredns/coredns/coremain"
        "github.com/coredns/coredns/core/dnsserver"
)

var directives = []string{
        "forward",
        "startup",
        "shutdown",
}

func init() {
        dnsserver.Directives = directives
}

func main() {
        coremain.Run()
}
root@localhost:/go/src/github.com/coredns/coredns/sample#
root@localhost:/go/src/github.com/coredns/coredns/sample# go build -v sample.go
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
Server types:
  dns

Caddyfile loaders:
  flag
  default

Other plugins:
  dns.auto
  dns.autopath
  dns.bind
  dns.cache
  dns.chaos
  dns.debug
  dns.dnssec
  dns.dnstap
  dns.erratic
  dns.errors
  dns.etcd
  dns.federation
  dns.file
  dns.forward
  dns.health
  dns.hosts
  dns.kubernetes
  dns.loadbalance
  dns.log
  dns.nsid
  dns.pprof
  dns.prometheus
  dns.proxy
  dns.reverse
  dns.rewrite
  dns.root
  dns.route53
  dns.secondary
  dns.template
....
```

This fix moves zplugins.go to a different package/directory so that
it is possible to "only import plugins as needed".

The following is the new output after this fix:
```
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
Server types:
  dns

Caddyfile loaders:
  flag
  default

Other plugins:
  dns.forward
  dns.prometheus
  shutdown
  startup

root@localhost:/go/src/github.com/coredns/coredns/sample#
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 21:54:10 +00:00
Yong Tang
584dd87c70
Add route53 plugin (#1390)
* Update vendor

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add route53 plugin

This fix adds route53 plugin so that it is possible to
query route53 record through CoreDNS.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 09:59:29 -08:00
Tobias Schmidt
d699b89063 Fix SOA examples in plugin/template README (#1391)
SOA records are returned in the authority section, not as answer.
2018-01-15 13:55:10 +00:00
Yue Ko
1112145f5a Allow graceful restart when using TLS listener (#1389)
The original ServergRPC.Listen() method returns a tls.Listener
when tls protocol is specified. Unfortunate, tls.Listener
does not implement the caddy.Listener interface that is
needed for graceful restart to work.

The change is to have the ServergRPC.Listen() method returns the
inner net.Listener instead. The creation of the tls.Listener
is deferred to the ServergRPC.Serve() method.
2018-01-14 08:09:14 +00:00
Yong Tang
e50c425d67 Add NSID description to README.md. (#1388)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-13 16:17:59 +00:00
Miek Gieben
05ebfaa36a
plugin/log: add the super useful msg ID into the logs (#1387) 2018-01-12 18:03:47 +00:00