Commit graph

17 commits

Author SHA1 Message Date
Yong Tang
c6709d930f
Fix security scans by cleaning up file path (#5185)
While performing security scans there were several
issue raised as G304 (CWE-22): Potential file inclusion via variable.
As some files path are taken from user input, it is possible the
filepath passed by user may have unintended effect if not properly formed.
This fix add Clean to remove the security warning and address some
potential issue.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-02-14 11:24:21 -05:00
Sven Nebel
47be274d34
Fix plugin file reload comment (#4665)
Signed-off-by: Sven Nebel <nebel.sven@gmail.com>
2021-06-05 15:06:25 +02:00
Yong Tang
9798dd067f
Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142)
* Implement notifies for transfer plugin (#3972)

* Fix notifies in transfer plugin

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

* Make it compile

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

* Port more plugins

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

* golint

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

* Fix tests

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

* Fix notifies in transfer plugin

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

* Make it compile

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

* Port more plugins

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

* golint

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

* Fix tests

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

* Fix tests

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

* really fix test

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

* Implement ixfr fallback and unify file and auto for transfering

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

* Add transfer tests

copied and modified from #3452

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

* Test correct selection of plugin

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

* add upstream back in

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

* Implement ixfr fallback and unify file and auto for transfering

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

* fix test

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

* properly merge

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

* Remove plugin/kubernetes/setup_transfer_test.go

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

Co-authored-by: Miek Gieben <miek@miek.nl>
2020-09-24 20:30:39 +02:00
Yong Tang
614d08cba2
Revert "Implement notifies for transfer plugin (#3972)" (#3995)
This reverts commit 68f1dd5ddf.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-08 09:00:26 -07:00
Miek Gieben
68f1dd5ddf
Implement notifies for transfer plugin (#3972)
* Fix notifies in transfer plugin

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

* Make it compile

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

* Port more plugins

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

* golint

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

* Fix tests

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

* Fix notifies in transfer plugin

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

* Make it compile

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

* Port more plugins

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

* golint

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

* Fix tests

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

* Fix tests

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

* really fix test

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

* Implement ixfr fallback and unify file and auto for transfering

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

* Add transfer tests

copied and modified from #3452

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

* Test correct selection of plugin

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

* add upstream back in

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

* Implement ixfr fallback and unify file and auto for transfering

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

* fix test

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

* properly merge

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-07-07 12:38:07 -07:00
Miek Gieben
aeb27bdb5b
plugin/file: close reader for reload (#3196)
This reloader didn't close the openened file handle. Add a close. Can't
use `defer` because this is in a endless loop.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-08-26 08:25:02 +00:00
Miek Gieben
fc1e313ca7 plugin/file: unify a serial logging (#3088)
Use %d SOA serial when logging about the SOA serial.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-08-03 02:31:01 -07:00
Miek Gieben
eba020e6a1
plugin/file: simplify locking (#3024)
* plugin/file: simplify locking

Simplify the locking, remove the reloadMu and just piggyback on the
other lock for accessing content, which assumes things can be move
underneath.

Copy the Apex and Zone to new vars to make sure the pointer isn't
updated from under us.

The releadMu isn't need at all, the time.Ticker firing while we're
reading means we will just miss that tick and get it on the next go.

Add rrutil subpackage and put some more generic functions in there, that
are now used from file and the tree package. This removes some
duplication.

Rename additionalProcessing that didn't actually do that to
externalLookup, because that's what being done at some point.

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

* Update plugin/file/lookup.go

Co-Authored-By: Michael Grosser <development@stp-ip.net>
2019-07-23 18:32:44 +00:00
Miek Gieben
18304ce9b7 plugin/file: make non-existent file non-fatal (#2955)
* plugin/file: make non-existent file non-fatal

If the zone file being loaded doesn't exist *and* reload is enabled,
just wait the file to pop up in the normal Reload routine.

If reload is set to 0s; we keep this a fatal error on startup. Aslo fix
the ticker in z.Reload(): remove the per second ticks and just use the
reload interval for the ticker.

Brush up the documentation a bit as well.

Fixes: #2951

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

* Stickler and test compile

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

* Remove there too

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

* Cant README test these because zone files dont exist

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-04 13:56:37 +08:00
JoeWrightss
352a042362 Fix some misspells in comment (#2634)
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>
2019-03-01 10:49:22 +00:00
marqc
552aab723c Configurable zone reload interval in file plugin (#2110)
* Configurable zone reload interval in file plugin

* passing reload config from auto plugin to file plugin. removed noReload property from Zone struct. fixed tests based on short file reload hack
2018-09-29 16:50:49 +01:00
Joey Espinosa
c2780f42c4 Updating filepath in auto plugin if existing zone's file changes location (#1901) (#1910)
Exporting Zone.File to avoid getters and setters

Updating getter and setter for Zone.File to be less racy

Renaming GetFile to File in zone plugin
2018-07-03 11:20:39 +01:00
Miek Gieben
12b2ff9740
Use logging (#1718)
* update docs

* plugins: use plugin specific logging

Hooking up pkg/log also changed NewWithPlugin to just take a string
instead of a plugin.Handler as that is more flexible and for instance
the Root "plugin" doesn't implement it fully.

Same logging from the reload plugin:

.:1043
2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1
2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1,
CoreDNS-1.1.1
linux/amd64, go1.10.1,
2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06
2018/04/22 08:56:54 [INFO] Reloading
2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a
2018/04/22 08:56:54 [INFO] Reloading complete

* update docs

* better doc
2018-04-22 21:40:33 +01:00
Miek Gieben
26d1432ae6
Update all plugins to use plugin/pkg/log (#1694)
* Update all plugins to use plugin/pkg/log

I wish this could have been done with sed. Alas manually changed all
callers to use the new plugin/pkg/log package.

* Error -> Info

* Add docs to debug plugin as well
2018-04-19 07:41:56 +01:00
Miek Gieben
4f3dc207a4
plugin/file: shutdown reload goroutine (#1571)
* plugin/file: shutdown reload goroutine

Shutdown the z.Reload() routine (if started in the first place) on
shutdow and reload.

Fixes #1508

* Must be put in c.OnShutdown()

* up test coverage
2018-02-28 18:19:37 -08:00
Miek Gieben
36c7aa6437 plugin/{file,auto}: drop fsnotify (#1090)
* plugin/{file,auto}: drop fsnotify

Reload every minute. This is more deterministic then fsnotify. Also
other thing cropped up: sharing zone files between zone; there is only
1 fsnotify event and we need to fan out the reload to all zone files.
This is a large rewrite (which could still be done), for now, poll the
zone file on disk.

Give serial no change a special error type so we can check for this.
Improve the logging for reloading:

2017/09/19 07:34:39 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060
2017/09/19 07:34:45 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263059
2017/09/19 07:34:51 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060

Fixes #1013

* typo
2017-09-20 17:28:23 +01:00
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Renamed from middleware/file/reload.go (Browse further)