fix(auto/file): return REFUSED when no next plugin is available #7381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Why is this pull request needed and what does it do?
It is standard behaviour of authoritative DNS servers to return REFUSED when responding to a request they are not authoritative for. CoreDNS correctly follows this when responding to queries that don't match any server blocks, however when broader server blocks are present (such as a catch-all), queries not responded to by any plugin are typically responded to with SERVFAIL, as this is defined in
plugin.NextOrFailure()
.By itself, this is not really an issue, however as described in #7346, this causes CoreDNS to return SERVFAIL when resolving out-of-bailiwick CNAME targets, which breaks these CNAMEs.
While it is difficult to map the traditional authoritative/resolver framework onto CoreDNS, for the case of the
auto
andfile
plugins, they fall more on the authoritative side, particularly when they are the last plugin in the chain.Therefore, this PR adds logic to the
auto
andfile
plugins that, when they are the last plugin, they return REFUSED for unrecognised names, instead of SERVFAIL.2. Which issues (if any) are related?
fixes #7346
3. Which documentation changes (if any) need to be made?
None, this corrects the behaviour of the examples already in the
auto
documentation4. Does this introduce a backward incompatible change or deprecation?
No