aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-04-26[plugin/forward] Strip local zone from IPV6 nameservers (#6635)Gravatar Manuel Alejandro de Brito Fontes 1-1/+1
Signed-off-by: Alejandro de Brito Fontes <aledbf@gmail.com>
2024-03-11Enable Prometheus native histograms (#6524)Gravatar Ben Kochie 1-5/+6
Add a NativeHistogramBucketFactor parameter to the use of `NewHistogramVec` in order to enable use of Prometheus Native Histograms. This will store automatically computed sparse buckets in CoreDNS. If a compatible Prometeus requests native histograms this data will returned instead of the static buckets. The default factor of 1.05 should provide high quality resolution data. Signed-off-by: SuperQ <superq@gmail.com>
2024-03-06removed the mutex locks with atomic bool (#6525)Gravatar jdamick 1-13/+5
Signed-off-by: Jeffrey Damick <jdamick@amazon.com> Co-authored-by: Jeffrey Damick <jdamick@amazon.com>
2023-12-08plugin/tls: respect the path specified by root plugin (#6138)Gravatar Marius Kimmina 1-1/+31
* plugin/tls: respect the path specified by root plugin Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com> * improve readme Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com> --------- Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>
2023-11-08Use the correct root domain name in the proxy plugin's TestHealthX tests (#6395)Gravatar Tom Thorogood 1-4/+4
When packing the empty domain name, miekg/dns can end up creating corrupt DNS messages. With some planned unpacking changes, this now trips an error condition and causes these tests to fail. Correct this by using the root domain explicitly as this gets correctly encoded on the wire. Signed-off-by: Tom Thorogood <me+github@tomthorogood.net>
2023-09-07Handle UDP responses that overflow with TC bit with test case (#6277)Gravatar Sri Harsha 2-0/+133
Signed-off-by: SriHarshaBS001 <SriHarshaBS009@gmail.com>
2023-08-14Revert "plugin/forward: Continue waiting after receiving malformed responses ↵Gravatar Chris O'Haver 1-12/+2
(#6014)" (#6270) This reverts commit 604a902e2c7e0317aecaa3666124079c75a31573.
2023-08-14Plugin dnstap: add support for "extra" field in payload (#6226)Gravatar Yuheng 2-25/+38
* dnstap: add 'extra' field Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: add setup_test for 'extra' field Signed-off-by: chenyuheng <chenyuheng99@qq.com> * udnstap: update document and test Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: update setup_test for more coverage Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: add TapMessageWithMetadata function to Dnstap Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: adapt dnstap and forward plugins to use TapMessageWithMetadata Signed-off-by: chenyuheng <chenyuheng99@qq.com> * change TapMessageWithMetadata function Signed-off-by: chenyuheng <chenyuheng99@qq.com> * tab inconsistency fix Signed-off-by: chenyuheng <chenyuheng99@qq.com> * fix replacer to support empty state Signed-off-by: chenyuheng <chenyuheng99@qq.com> * add replacer test for empty status parameter Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: update unit test for 'extra' field Signed-off-by: chenyuheng <chenyuheng99@qq.com> * clean up code Signed-off-by: chenyuheng <chenyuheng99@qq.com> * gofmt fix & static analysis fix Signed-off-by: chenyuheng <chenyuheng99@qq.com> * dnstap: refactor Signed-off-by: chenyuheng <chenyuheng99@qq.com> --------- Signed-off-by: chenyuheng <chenyuheng99@qq.com>
2023-08-14fix: remove unnecessary conversion (#6258)Gravatar Zhizhen He 1-2/+2
Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
2023-08-10Fix typos (#6235)Gravatar Zhizhen He 3-5/+6
* Fix typos and add todo to fix spelling of dnsutil.MaximumDefaulTTL Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
2023-07-31[RFC-9250]: Add QUIC server support (#6182)Gravatar João Henri 3-0/+9
Add DNS-over-QUIC server Signed-off-by: jaehnri <joao.henri.cr@gmail.com> Signed-off-by: João Henri <joao.henri.cr@gmail.com>
2023-07-04Fix forward metrics for backwards compatibility (#6178)Gravatar Pat Downey 8-50/+47
2023-06-17test: use `t.TempDir` to create temporary test directory (#6164)Gravatar Eng Zer Jun 1-10/+6
2023-06-09replace reviewdog fully by golangci-lint (#6139)Gravatar Ondřej Benkovský 2-20/+22
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2023-05-26add support unix socket for GRPC (#5943)Gravatar junhwong 4-0/+22
2023-04-29plugin/forward: Continue waiting after receiving malformed responses (#6014)Gravatar Chris O'Haver 1-2/+12
* forward: continue waiting after malformed responses Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * clean up Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * clean up Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * move test to /test/. Add build tag. Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * install libpcap-dev for e2e tests Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * sudo the test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove stray err check Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * disable the test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * use -exec flag to run test binary as root Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * run new test by itself in a new workflow Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix test name Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * only for udp Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove libpcap test workflow action Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove test, since it cant run in ci Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * and remove gopacket package Signed-off-by: Chris O'Haver <cohaver@infoblox.com> --------- Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2023-04-25fix some comments (#6052)Gravatar cui fliter 1-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-16Prevent fail counter of a proxy overflows (#5990)Gravatar Vancl 3-1/+42
Signed-off-by: vanceli <vanceli@tencent.com> Signed-off-by: Vance Li <vncl@YingyingM1.local> Co-authored-by: vanceli <vanceli@tencent.com>
2023-03-24plugin/forward: Allow Proxy to be used outside of forward plugin. (#5951)Gravatar Pat Downey 10-0/+1012
* plugin/forward: Move Proxy into pkg/plugin/proxy, to allow forward.Proxy to be used outside of forward plugin. Signed-off-by: Patrick Downey <patrick.downey@dioadconsulting.com>
2023-03-03DoH: Allow http as the protocol (#5762)Gravatar Sebastian Dahlgren 2-44/+55
This change avoids the hard coding of HTTPS, allowing flexibility in whether HTTP or HTTPS is used. Signed-off-by: Sebastian Dahlgren <sebdah@fb.com>
2022-12-28plugin/timeouts - Allow ability to configure listening server timeouts (#5784)Gravatar Rich 2-0/+77
2022-12-01plugin/edns: remove truncating of question section on bad EDNS version (#5787)Gravatar Ben Kaplan 2-6/+15
* plugin/edns: remove truncating of question section on bad EDNS version EDNS requests of "Unknown Version" removed the query section altogether. Not sure why since this is not require (see [link](https://kb.isc.org/docs/edns-compatibility-dig-queries) This cause issues with DNS solutions that uses this information (initial queried name, type and class) in order to route the response to the right client (e.g. PDNS). The change here is to keep the inital query section as is. Signed-off-by: Ben Kaplan <ben.kaplan@redis.com> * adding tests for edns0 version check Signed-off-by: Ben Kaplan <ben.kaplan@redis.com> * adding tests for non-edns0 version check Signed-off-by: Ben Kaplan <ben.kaplan@redis.com> Signed-off-by: Ben Kaplan <ben.kaplan@redis.com>
2022-09-08plugin/view: Advanced routing interface and new 'view' plugin (#5538)Gravatar Chris O'Haver 3-3/+122
* introduce new interface "dnsserver.Viewer", that allows a plugin implementing it to decide if a query should be routed into its server block. * add new plugin "view", that uses the new interface to enable a user to define expression based conditions that must be met for a query to be routed to its server block. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-19remove trailing empty lines per linter (#5526)Gravatar Chris O'Haver 2-2/+0
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-18core: add log listeners for k8s_event plugin (#5451)Gravatar Shane Xie 3-8/+299
add log listener interface Signed-off-by: xh4n3 <xyn1016@gmail.com>
2022-07-10add golangci-lint linter (#5499)Gravatar Ondřej Benkovský 7-6/+2
2022-04-04Replace io.LimitReader with http.MaxBytesReader (#5241)Gravatar Yong Tang 1-1/+1
Previously we use io.LimitReader to limit the number of bytes from http request. However, there is a subtle difference between io.LimitReader and io.ReadAll as io.LimitReader will return a Reader, not a ReadCloser. As such the behavior will actually be difference in case of error handling (and when to close). This PR changes io.LimitReader to http.MaxBytesReader so that the behavior can be preserved (except the number of bytes). See https://stackoverflow.com/a/52699702 Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-03-18Avoid copy of large value in `range` (#5243)Gravatar Yong Tang 1-2/+2
2022-03-18update all +build statements (#5271)Gravatar Qasim Sarfraz 2-3/+2
* update all +build statements Signed-off-by: MQasimSarfraz <syed.qasim.sarfraz@gmail.com> * remove old +build style Signed-off-by: MQasimSarfraz <syed.qasim.sarfraz@gmail.com>
2022-03-16Update to avoid pseudo-random number (#5225)Gravatar Yong Tang 1-0/+36
* Update to avoid pseudo-random number This PR update the usage of rand so that non-global seed is used. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Add concurrency-safe random source See https://stackoverflow.com/questions/48958886/how-to-create-a-thread-safe-rand-source Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-03-04Add limit to ioutil.ReadAll for request body (#5224)Gravatar Yong Tang 1-1/+1
This PR adds limit to ioutil.ReadAll for DoH request body so that it will not be subject to large requests. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-02-17Harden tls on all places (#5184)Gravatar Yong Tang 1-2/+24
PR 2938 hardens tls though there are other places that uses TLS as well and setTLSDefaults are not invoked in other paths. This PR hardens tls on all places. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-02-14Fix security scans by cleaning up file path (#5185)Gravatar Yong Tang 1-1/+2
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>
2021-12-23Convert HostPortOrFile error to var (#5058)Gravatar Ben Kochie 1-1/+5
Convert "no nameservers found" error on parse.HostPortOrFile() to an exported var for use with `errors.Is()`. Signed-off-by: SuperQ <superq@gmail.com>
2021-10-23plugin/pkg/cache: fix data race (#4932)Gravatar Wu Shuang 1-1/+1
2021-10-13cleanup deprecated package io/ioutil (#4920)Gravatar Zou Nengren 4-8/+6
Signed-off-by: zounengren <zouyee1989@gmail.com>
2021-08-27Update upstream.Lookup method comment to reflect current state (#4832)Gravatar Ondřej Benkovský 1-1/+3
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2021-08-26upstream lookups are done with original EDNS options (#4826)Gravatar Ondřej Benkovský 1-7/+2
* upstream lookups are done with original EDNS options Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com> * fixup! upstream lookups are done with original EDNS options Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2021-08-16Rename reuse port/listen_*.go to better convey build inclusion reason (#4817)Gravatar Chris O'Haver 2-0/+0
* rename files to better convey build inclusion reason Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-08-16Revert "pkg/reuseport: Remove pre-go1.11 impl (#4795)" (#4814)Gravatar Chris O'Haver 2-0/+16
This reverts commit 4a34e8b8979f23a77000ad6580051b06d2e97508.
2021-08-12pkg/reuseport: Remove pre-go1.11 impl (#4795)Gravatar Manuel Rüger 2-16/+0
2021-07-09do not log NOERROR in log plugin when response is not available (#4725)Gravatar Ondřej Benkovský 2-1/+50
Signed-off-by: Ondrej Benkovsky <ondrej.benkovsky@wandera.com>
2021-06-07auto go fmtGravatar coredns[bot] 1-1/+1
Signed-off-by: coredns[bot] <bot@bot.coredns.io>
2021-06-04Fix IPv6 case for CIDR format reverse zones (#4652)Gravatar Chris O'Haver 2-7/+17
* fix ipv6 case for cidr.Class Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add check and test case for invalid ipv6 cidr Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * net package is bad at detecting ipv6/ipv4 Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename Class -> Split Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-27deprecate Normalize and MustNormalize (#4648)Gravatar Chris O'Haver 1-1/+1
* deprecate normalize and mustnormalize Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * elaborate runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * include caller info Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 3-3/+124
Make normalize return multiple "hosts" (= reverse zones) when a non-octet boundary cidr is given. Added pkg/cidr package that holds the cidr calculation routines; felt they didn't really fit dnsutil. This change means the IPNet return parameter isn't needed, the hosts are all correct. The tests that tests this is also removed: TestSplitHostPortReverse The fallout was that zoneAddr _also_ doesn't need the IPNet member, that in turn make it visible that zoneAddr in address.go duplicated a bunch of stuff from register.go; removed/refactored that too. Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the right things, by consuming ZONE arguments; this now expands reverse zones correctly. This is mostly mechanical. Remove the reverse test in plugin/kubernetes which is a copy-paste from a core test (which has since been fixed). Remove MustNormalize as it has no plugin users. This change is not backwards compatible to plugins that have a ZONE argument that they parse in the setup util. All in-tree plugins have been updated. Signed-off-by: Miek Gieben <miek@miek.nl>
2021-04-05plugin/dnssec: use entire RRset as key input (#4537)Gravatar Miek Gieben 2-1/+49
* plugin/dnssec: use entire RRset as key input This uses the entire rrset as input for the hash key; this is to detect differences in the RRset and generate the correct signature. As this would then lead to unbounded growth, we periodically (every 8h) prune the cache of old entries. In theory we could rely on the random eviction, but it seems nicer to do this in a maintannce loop so that we remove the unused ones. This required adding a Walk function to the plugin/pkg/cache. Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin/dnssec/cache.go Co-authored-by: Chris O'Haver <cohaver@infoblox.com> Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
2021-03-21Add cache eviction metrics to the cache plugin (#4411)Gravatar Frank Riley 1-3/+8
Signed-off-by: Frank Riley <fhriley@gmail.com>
2021-03-19metrics: remove RR type (#4534)Gravatar Miek Gieben 1-37/+0
To combat label cardinality explosions remove the type from metrics. This was most severe in the histogram for request duration, remove it there. It's also highlighted difference between grpc and forward code, where forward did use type and grpc didn't; getting rid of all that "fixes" that discrepancy Move monitor.go back into the vars directory and make it private again. Also name it slightly better Fixes: #4507 Signed-off-by: Miek Gieben <miek@miek.nl>
2021-01-28plugin/forward Add rcode and rtype to request_duration_seconds metric (#4391)Gravatar Maxime Ginters 1-0/+37
* plugin/forward Add rcode and rtype to request_duration_seconds metric Signed-off-by: Maxime Ginters <maxime.ginters@shopify.com> * Control the cardinality of query type Signed-off-by: Maxime Ginters <maxime.ginters@shopify.com>