unknownip

package module
v0.0.0-...-9836862 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

unknownip

Name

unknownip - check resolved IP against a list of known IPs

Description

The unknownip plugin checks the IP returned for a A- or AAAA-query against a list of known prefixes and logs a message it is not contained in those.

Syntax

Create a server block per checked domain

foo.com:1053 {
    unknownip 198.18.0.0/24 198.19.42.1/32
    forward . 8.8.8.8
}
bar.net:1053 {
    unknownip 198.19.21.0/24 198.19.22.1/32
    forward . 8.8.8.8
}

Metrics

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

  • coredns_unknownip_request_count_total{server} - query count to the unknownip plugin.
  • coredns_unknownip_unknown_count_total{server} - count of unknown IPs returned.

The server label indicated which server handled the request, see the metrics plugin for details.

Ready

This plugin reports readiness to the ready plugin. It will be immediately ready.

Examples

In this configuration, we forward all queries to 9.9.9.9 and print check if the returned IPs for foo.com and bar.net are included in the given prefixes.

foo.com:1053 {
    unknownip 198.18.0.0/24 198.19.42.1/32
    forward . 9.9.9.9
}
bar.net:1053 {
    unknownip 198.19.21.0/24 198.19.22.1/32
    forward . 9.9.9.9
}
. {
  unknownip 
  forward . 9.9.9.9
  example
}

Also See

See the manual.

Documentation

Overview

Package unknownip is a CoreDNS plugin that logs if the returned IP for a query is not in a predefined list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Unknownip

type Unknownip struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

func (Unknownip) Name

func (e Unknownip) Name() string

Name implements the Handler interface.

func (Unknownip) Ready

func (e Unknownip) Ready() bool

Ready implements the ready.Readiness interface, once this flips to true CoreDNS assumes this plugin is ready for queries; it is not checked again.

func (Unknownip) ServeDNS

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

ServeDNS implements the plugin.Handler interface. This method gets called when unknownip is used in a Server.

Jump to

Keyboard shortcuts

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