Commit graph

59 commits

Author SHA1 Message Date
Ondřej Benkovský
c2dbb7141a
add golangci-lint linter (#5499) 2022-07-10 11:06:33 -07:00
dilyevsky
2895b06732
[plugin/route53] Cleanup AWS config/credentials setup. (#5370)
Signed-off-by: Dmitry Ilyevsky <ilyevsky@gmail.com>
2022-05-09 13:35:42 -04:00
Yong Tang
6bb2db758f
[plugin/route53] Deprecate plaintext secret in Corefile for route53 plugin (#5228)
This PR deprecates plaintext secret in Corefile for route53 plugin (`aws_access_key`).
Since using environmental variables of `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
have already been available, no other changes other than deprecation is needed.

This will avoid saving plaintext secret in Corefile which could be
of security concern.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-03-11 11:32:44 -08:00
Chris O'Haver
967814161a
use tickers instead of time.After to avoid memory leak (#5220)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-03-03 23:36:02 -08:00
Ting Yuan
39a99a5bbe
fix goroutine leaks in TestRoute53 (#5070)
Signed-off-by: Ting Yuan <yuanting@ict.ac.cn>
2022-01-05 05:20:32 -08:00
Matt Palmer
e53bff9043
plugin/route53: Configurable AWS Endpoint (#4963)
Provide the ability to configure the AWS endpoint

Signed-off-by: Matthew Palmer <matthew.palmer@helpsystems.com>
2021-11-08 06:45:45 -08:00
Licht Takeuchi
b9b27bbbd0
Fix Route53 plugin cannot retrieve ECS Task Role (#4669)
Signed-off-by: Licht Takeuchi <licht-t@outlook.jp>
2021-06-07 16:58:56 +02:00
Matt Kulka
3168a722ca
Use cancelable contexts for cloud provider plugin refreshes (#4226)
This commit uses a cancelable context to spawn goroutines that refresh
records from a cloud DNS provider. The Caddy shutdown routine uses the
returned cancel function to terminate existing goroutines when a USR1
reload signal is received.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2020-10-24 14:37:01 +02:00
Miek Gieben
b003d06003
For caddy v1 in our org (#4018)
* For caddy v1 in our org

This RP changes all imports for caddyserver/caddy to coredns/caddy. This
is the v1 code of caddy.

For the coredns/caddy repo the following changes have been made:

* anything not needed by us is deleted
* all `telemetry` stuff is deleted
* all its import paths are also changed to point to coredns/caddy
* the v1 branch has been moved to the master branch
* a v1.1.0 tag has been added to signal the latest release

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

* Fix imports

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

* Group coredns/caddy with out plugins

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

* remove this file

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

* Relax import ordering

github.com/coredns is now also a coredns dep, this makes
github.com/coredns/caddy fit more natural in the list.

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

* Fix final import

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-24 18:14:41 +02:00
Miek Gieben
9e4a177d9f
clouddns,route53: fix lingering goroutines after restart (#4096)
Stop the context so the refresh loop terminates on restart.

Fixes: #3815

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-08-31 06:39:01 -07:00
Yong Tang
f23171af5f
Fix wildcard records issue in rout53 plugin (#4038)
* Fix wildcard records issue in rout53 plugin

This PR tries to address 4035 where wild card records does not return
correctly in route53 plugin. The issue was that `strings.Index(s, substr string)`
expect substr to be a string but the code defines as char.

This PR fixes 4035.

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

* Fix failed tests

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-31 07:51:14 +02:00
Miek Gieben
7aaed71b92
Fix query for SOA record for delegated zone (#3875)
Addresses a bug in the file plugin where SOA queries to zone delegations are
inappropriately returned the SOA for the delegating zone, and not a downward
referral to the delegated zone.

Here is an example of what I believe the expected downward referral in response
to a SOA query for a delegated zone should be (note that no SOA record is
returned):

~~~
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @k.root-servers.net. miek.nl. SOA
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58381
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 7
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;miek.nl.                       IN      SOA

;; AUTHORITY SECTION:
nl.                     172800  IN      NS      ns1.dns.nl.
nl.                     172800  IN      NS      ns2.dns.nl.
nl.                     172800  IN      NS      ns3.dns.nl.

;; ADDITIONAL SECTION:
ns1.dns.nl.             172800  IN      A       194.0.28.53
ns2.dns.nl.             172800  IN      A       194.146.106.42
ns3.dns.nl.             172800  IN      A       194.0.25.24
ns1.dns.nl.             172800  IN      AAAA    2001:678:2c:0:194:0:28:53
ns2.dns.nl.             172800  IN      AAAA    2001:67c:1010:10::53
ns3.dns.nl.             172800  IN      AAAA    2001:678:20::24
~~~

See #3852 for the original fix.

Modified clouddns/route53 and removed the faulty tests there.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-05-11 07:51:02 -07:00
Miek Gieben
fc546cf129
doc: fix generated manual pages (#3571)
Went over all generated manual pages and fixed some markdown issues,
mostly escaping "_" to avoid underlining entire paragraphs.

Some textual fixes in route53 and other cloud DNS plugins.

Regenerated the markdown with mmark.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-29 13:35:17 +01:00
Miek Gieben
24176a97e6
Move to CODEOWNERS (#3489)
* Move to CODEOWNERS

No change in who own what; just a move to CODEOWNERS. This allows
dreck cleanups.

Added .dreck.yaml for alias and exec.

Fixes: #3486

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

* stickler bot

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

* sort the file

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-11-29 13:17:05 +00:00
yuxiaobo96
bf356e79fc fix spelling mistakes (#3364)
Automatically submitted.
2019-10-09 07:24:18 +00:00
Miek Gieben
aa96d6b443
plugin/route53: remove amazon intialization from init (#3348)
Don't perform this code in the init, this allocated 1 megabyte of memory
even if you don't use the plugin. Looks to be only there for testing,
adding a comment to reflect that.

Fixes #3342

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-03 07:21:11 +01:00
Erfan Besharat
4ffbee299a Remove deprecated function calls flagged by staticcheck (#3333)
* Use session.NewSession instead of session.New

Signed-off-by: Erfan Besharat <erbesharat@gmail.com>

* Use grpc.DialContext instead of grpc.WithTimeout

Signed-off-by: Erfan Besharat <erbesharat@gmail.com>

* Pass non-nil context to context.WithTimeout

Signed-off-by: Erfan Besharat <erbesharat@gmail.com>

* Return the error directly in route53 setup

Co-Authored-By: Miek Gieben <miek@miek.nl>
Signed-off-by: Erfan Besharat <erbesharat@gmail.com>
2019-10-01 07:42:10 +01:00
Miek Gieben
004c5fca9d
all: simply registering plugins (#3287)
Abstract the caddy call and make it simpler.

See #3261 for some part of the discussion.

Go from:

~~~ go
func init() {
       caddy.RegisterPlugin("any", caddy.Plugin{
               ServerType: "dns",
               Action:     setup,
       })
}
~~~

To:

~~~ go
func init() { plugin.Register("any", setup) }
~~~

This requires some external documents in coredns.io to be updated as
well; the old way still works, so it's backwards compatible.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-20 08:02:30 +01:00
Miek Gieben
62317c3c14 update doc to not use the root zone for everything (#3288)
Update all documentation in the tree to use example.org as an example
configuration (in so far possible). As to get out of the just use "."
and fallthrough and things would be fine.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-19 06:17:53 -07:00
Miek Gieben
fcbe70f4f8
run gofmt -w -s **/*.go (#3126)
format and simplify; highlighted some stuff in route53_test.go that
could be further simplified.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-08-14 07:56:12 +00:00
Miek Gieben
ebc465d0dc plugin/route53: various updates (#3108)
In the setup function use plugin.Error() to wrap the errors with the
plugin name. Because there isn't a separate setup() function this is
done for all returned errors.

Remove *upstream.Upstream from the New parameters as this is always set
and adjust the tests to account for this.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-08-13 08:02:29 -07:00
Matt Kulka
94468c41b0 plugin/route53: make refresh frequency adjustable (#3083)
the current update frequency for the refresh loop in the route 53 plugin is hard-coded
to 1 minute. aws rate-limits the number of api requests so less frequent record refreshes
can help when reaching those limits depending upon your individual scenarios. this pull
adds a configuration option to the route53 plugin to adjust the refresh frequency.

thanks for getting my last pull released so quickly. this is the last local change that
i have been running and would love to get it contributed back to the project.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2019-08-03 18:07:28 -07:00
Matt Kulka
45e17c325c [plugin/route53]: Increase ListResourceRecordSets paging size. (#3073)
without the paging parameter set, it will default to 100 records per request. with large enough zones and
potentially multiple coredns daemons configured to pull from route 53, this can quickly add up and reach
aws global api rate limits (5/sec per root account). increasing paging to max can help reduce the number
of requests needed to pull records for a zone without no down side that i am aware of.

this helps issue #2353, but probably is not a complete fix.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2019-07-31 12:09:10 -07:00
Miek Gieben
eefe49dd3e plugin/route53: small doc cleanups (#3016)
Adjust style to rest fo the plugins.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-17 13:40:15 -07:00
Anshul Sharma
0674325efb plugin/route53: fix IAM credential file (#2983)
- Fix the ability for CoreDNS to fetch credentials via IAM
2019-07-15 05:56:28 +00:00
Jintao Zhang
2874c963c1 doc:remove duplicate word (#3005)
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2019-07-15 05:51:08 +00:00
Anshul Sharma
2bd77d0823 Fix multiple credentials in route53 (#2859) 2019-07-03 20:14:31 +01:00
Yong Tang
f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* Update Caddy to 1.0.1, and update import path

This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy

This fix fixes 2959

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

* Also update plugin.cfg

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

* Update and bump zplugin.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-03 09:04:47 +08:00
Miek Gieben
22c6e3e179
plugins: set upstream unconditionally (#2956)
`upstream` is not needed as a setting; just set if unconditionally and
remove all documentation and tests for it.

At some point we want remove the hanlding for `upstream` as well and
error out on seeing it.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-02 16:23:47 +01:00
Miek Gieben
be1ac9fed4
plugins: remove upstream [ADDRESS] from docs (#2772)
Various plugins still had this documented, the setup functions still
allow it (which is fine), but update the docs that this arguments isn't
there any more.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-08 16:45:29 +01:00
Miek Gieben
58c703f5ef
Run gofmt -w -s on codebase (#2773)
This formats and simplifies all code by running gofmt -w -s on all Go
files.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-08 11:13:46 +01:00
Miek Gieben
5a4e4d92ef
Doc tweaks (#2763)
* fix date on 150 release notes
* fix syntax in route53 plugin

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-06 08:43:19 +01:00
dilyevsky
1e150674c5 [plugin/route53]: Do not return NXDOMAIN where it should be NODATA. (#2734)
* [plugin/route53]: Do not return NXDOMAIN where it should be NODATA.

Signed-off-by: Dmitry Ilyevskiy <dmitry.ilyevskiy@getcruise.com>

* Fix bad merge.

Signed-off-by: Dmitry Ilyevskiy <dmitry.ilyevskiy@getcruise.com>
2019-03-31 10:12:33 -07:00
Miek Gieben
53f3f0b666
Remove context.Context from request.Request (#2726)
* Remove context.Context from request.Request

This removes the context from request.Request and makes all the changes
in the code to make it compile again. It's all mechanical. It did
unearth some weirdness in that the context was kept in handler structs
which may cause havoc with concurrently handling of requests.

Fixes #2721

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

* Make test compile

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-26 14:37:30 +00:00
dilyevsky
0d8e1cf8b4 [plugin/route53] Support wildcards and other escaped chars. (#2352)
* [plugin/route53] Support wildcards and other escaped chars.

* Fix multiple issues. Add tests.

* Cleanup some comments.
2019-03-13 18:46:30 +00:00
Darshan Chaudhary
70fcbbf6ba refactor tests to remove duplicate code (#2602)
Signed-off-by: darshanime <deathbullet@gmail.com>
2019-02-23 09:02:58 -08:00
Xiao An
05c0f7161b Fix some typos in documents (#2592)
Signed-off-by: Xiao An <hac@zju.edu.cn>
2019-02-21 07:15:17 +00:00
Miek Gieben
9c16ed1d14
Default to upstream to self (#2436)
* Default to upstream to self

This is a backwards incompatible change.

This is a massive (cleanup) PR where we default to resolving external
names by the coredns process itself, instead of directly forwarding them
to some upstream.

This ignores any arguments `upstream` may have had and makes it depend
on proxy/forward configuration in the Corefile. This allows resolved
upstream names to be cached and we have better healthchecking of the
upstreams. It also means there is only one way to resolve names, by
either using the proxy or forward plugin.

The proxy/forward lookup.go functions have been removed. This also
lessen the dependency on proxy, meaning deprecating proxy will become
easier. Some tests have been removed as well, or moved to the top-level
test directory as they now require a full coredns process instead of
just the plugin.

For the etcd plugin, the entire StubZone resolving is *dropped*! This
was a hacky (but working) solution to say the least. If someone cares
deeply it can be brought back (maybe)?

The pkg/upstream is now very small and almost does nothing. Also the
New() function was changed to return a pointer to upstream.Upstream. It
also returns only one parameter, so any stragglers using it will
encounter a compile error.

All documentation has been adapted. This affected the following plugins:
* etcd
* file
* auto
* secondary
* federation
* template
* route53

A followup PR will make any upstream directives with arguments an error,
right now they are ignored.

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

* Fix etcd build - probably still fails unit test

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

* Slightly smarter lookup check in upstream

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

* Compilez

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-13 16:54:49 +00:00
Isolus
7642995558 disable ra flag for several plugins (#2408)
* disable ra flag for several plugins

* removed unnecessary assignment

* removed more unnecessary assignments
2018-12-30 17:05:08 +01:00
Jiacheng Xu
fc96c64263 Add the missed braces. (#2330) 2018-11-21 07:44:17 -08:00
Yong Tang
bb0b60ec81 Update README.md in route53 plugin (#2299)
Update README.md in route53 plugin, as credentials_file is
not supported.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-11-13 22:44:47 +00:00
Jiacheng Xu
165b4f86a3 plugin/route53: make the upstream address in route53 plugin optional. (#2263)
* Make the upstream in route53 plugin optional.

Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>

* Add 2 tests for upstream in route53.

Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>

* Change the readme.

Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>
2018-11-02 21:07:50 +00:00
Can Yucel
8432f14207 plugin/route53: add split zone support (#2160)
Automatically submitted.
2018-10-10 17:55:54 +00:00
Can Yucel
8148408301 plugins/route53: add AWS credentials file support (#2118)
Automatically submitted.
2018-09-25 22:57:16 +00:00
Can Yucel
8d4378d712 plugin/route53: add fallthrough (#2132)
Automatically submitted.
2018-09-25 18:41:05 +00:00
Can Yucel
b3d69f1c7f plugin/route53: fix multiple route 53 zones issue (#2117) 2018-09-22 13:26:17 +01:00
dilyevsky
153bd5f767
[plugin/route53]: Support batch mode operation. (#2050)
* [plugin/route53]: Support batch mode operation.

Cache all Route53 records internally using `ListResourceRecordPagesWithContext`
and serve them from memory.

Bonus features:

  * Support additional r53 record types (`CNAME`, `SOA`, etc)
  * Support `upstream` option (#2099 filed to support argument optionality)

Signed-off-by: Dmitry Ilyevskiy <dmitry.ilyevskiy@getcruise.com>
Signed-off-by: Dmitry Ilyevskiy <ilyevsky@gmail.com>
2018-09-17 11:19:07 -07:00
dilyevsky
063999551d
Add @dilyevsky to reviewers. (#2094)
* Add @dilyevsky to reviewers.

Per @miekg suggestion on https://github.com/coredns/coredns/pull/2050#pullrequestreview-149538954
adding myself to OWNERS file.

* Also add me into plugin/route53-specific reviewers/approvers.
2018-09-13 15:22:57 -07:00
Miek Gieben
ba1efee4f1
Default to scrubbing replies in the server (#2012)
Every plugin needs to deal with EDNS0 and should call Scrub to make a
message fit the client's buffer. Move this functionality into the server
and wrapping the ResponseWriter into a ScrubWriter that handles these
bits for us. Result:

Less code and faster, because multiple chained plugins could all be
calling scrub and SizeAndDo - now there is just one place.

Most tests in file/* and dnssec/* needed adjusting because in those unit
tests you don't see OPT RRs anymore. The DNSSEC signer was also looking
at the returned OPT RR to see if it needed to sign - as those are now
added by the server (and thus later), this needed to change slightly.

Scrub itself still exist (for backward compat reasons), but has been
made a noop. Scrub has been renamed to scrub as it should not be used by
external plugins.

Fixes: #2010

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-29 12:26:22 +01:00
Miek Gieben
f3134da45e
Clean up tests logging (#1979)
* Clean up tests logging

This cleans up the travis logs so you can see the failures better.

Older tests in tests/ would call log.SetOutput(ioutil.Discard) in
a haphazard way. This add log.Discard and put an `init` function in each
package's dir (no way to do this globally). The cleanup in tests/ is
clear.

All plugins also got this init function to have some uniformity and kill
any (future) logging there in the tests as well.

There is a one-off in pkg/healthcheck because that does log.

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

* bring back original log_test.go

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

* suppress logging here as well

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-19 16:23:06 +01:00