local

package
v0.0.0-...-36c2227 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

local

Name

local - respond to local names.

Description

local will respond with a basic reply to a "local request". Local request are defined to be names in the following zones: localhost, 0.in-addr.arpa, 127.in-addr.arpa and 255.in-addr.arpa and any query asking for localhost.<domain>. When seeing the latter a metric counter is increased and if debug is enabled a debug log is emitted.

With local enabled any query falling under these zones will get a reply. The prevents the query from "escaping" to the internet and putting strain on external infrastructure.

The zones are mostly empty, only localhost. address records (A and AAAA) are defined and a 1.0.0.127.in-addr.arpa. reverse (PTR) record.

Syntax

local

Metrics

If monitoring is enabled (via the prometheus plugin) then the following metric is exported:

  • coredns_local_localhost_requests_total{} - a counter of the number of localhost.<domain> requests DNServer has seen. Note this does not count localhost. queries.

Note that this metric does not have a server label, because it's more interesting to find the client(s) performing these queries than to see which server handled it. You'll need to inspect the debug log to get the client IP address.

Examples

. {
    local
}

Bugs

Only the in-addr.arpa. reverse zone is implemented, ip6.arpa. queries are not intercepted.

See Also

BIND9's configuration in Debian comes with these zones preconfigured. See the debug plugin for enabling debug logging.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LocalhostCount report the number of times we've seen a localhost.<domain> query.
	LocalhostCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "local",
		Name:      "localhost_requests_total",
		Help:      "Counter of localhost.<domain> requests.",
	})
)

Functions

This section is empty.

Types

type Local

type Local struct {
	Next plugin.Handler
}

Local is a plugin that returns standard replies for local queries.

func (Local) Name

func (l Local) Name() string

Name implements the plugin.Handler interface.

func (Local) ServeDNS

func (l Local) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL