xpf

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 12 Imported by: 0

README

Build Status codecov GitHub version GitHub issues GitHub pull requests Go Report Card

CoreDNS XPF

This coredns plugin appends an XPF record to the DNS request, containing the Source & Destination Address & Port. This aims to allow you to use CoreDNS as a DNS proxy, while still passing client information through for audit/analysis purposes.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites
  • Go 1.12 or later
  • Go modules should be enabled
Installing
  1. First clone the CoreDNS repository CoreDNS
  2. Add xpf:github.com/tomsanbear/xpf to the plugins.cfg file within the repo (IMPORTANT NOTE: this must appear before any other resolving plugin you may be using. See below for more details)
  3. Build the binary with 'make', or if you are building on OSX and want to target a linux docker container 'GOOS=linux make'

Plugin Note: Due to the way the server chains plugins, you need to ensure that any plugin that comes after this one, in the plugin.cfg, does not care about the record being there. See the plugins.cfg file comments for more detail.

Corefile Configuration

Example usage within a Corefile:

.:53 {
    xpf {
        rr_type 65422
    }
    forward . 8.8.8.8
}

Note: Do consider the security risks of forwarding this record to the upstream server. You (should) only be doing this for internal resolvers

Running the tests

Test coverage is still a little lacking, but I'm looking to get the full thing tested, with performance metrics as well in the future.

Just run go test ./... for the main suite, and

Code Style Tests

Enforcing style with the golangci-lint tool

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Documentation

Index

Constants

View Source
const DefaultTypeXPF uint16 = 65422

DefaultTypeXPF uses the default rrtype used in wireshark

View Source
const PluginName string = "xpf"

PluginName is the name of our plugin

Variables

This section is empty.

Functions

func NewXPFPrivateRR

func NewXPFPrivateRR() dns.PrivateRdata

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error type for the xpf plugin

func (*Error) Error

func (e *Error) Error() string

type XPF

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

XPF type captures anything needed to append the XPF record to our queries

func New

func New() (*XPF, error)

New creates a new instance of the XPF type

func (*XPF) Name

func (xpf *XPF) Name() string

Name is the name of the plugin

func (*XPF) OnShutdown

func (xpf *XPF) OnShutdown() (err error)

OnShutdown handles any plugin specific startup logic

func (*XPF) OnStartup

func (xpf *XPF) OnStartup() (err error)

OnStartup handles any plugin specific startup logic

func (*XPF) ServeDNS

func (xpf *XPF) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (rc int, err error)

ServeDNS is the handler provided by the CaddyServer we are implementing

type XPFPrivateRR

type XPFPrivateRR struct {
	IPVersion   uint8
	Protocol    uint8
	SrcAddress  net.IP
	DestAddress net.IP
	SrcPort     uint16
	DestPort    uint16
}

XPFPrivateRR type captures the data used to create the XPF record, in the form of a Private RR in CoreDNS

func (*XPFPrivateRR) Copy

func (rr *XPFPrivateRR) Copy(dest dns.PrivateRdata) error

Copy the existing RR to a new RR

func (*XPFPrivateRR) Len

func (rr *XPFPrivateRR) Len() int

func (*XPFPrivateRR) Pack

func (rr *XPFPrivateRR) Pack(msg []byte) (off int, err error)

func (*XPFPrivateRR) Parse

func (rr *XPFPrivateRR) Parse(txt []string) (err error)

func (*XPFPrivateRR) String

func (rr *XPFPrivateRR) String() string

func (*XPFPrivateRR) Unpack

func (rr *XPFPrivateRR) Unpack(msg []byte) (off int, err error)

Jump to

Keyboard shortcuts

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