coredns-auto-aaaa-and-ptr

module
v0.0.0-...-2a0e2a1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0

README

coredns-auto-aaaa-and-ptr

This is a fork of https://github.com/vlcty/coredns-auto-ipv6-ptr. Added support for AAAA records for the dynamic PTR hostnames.

coredns-auto-ipv6-ptr

Some services require that a RDNS request resolves to a PTR record. With this CoreDNS plugin, you can generate these PTR records on the fly based on the requested IPv6 address. The plugin translates the requested address and appends a suffix. Additionally, you can create a so-called presets file to answer with a "real" record if a specific request is received.

Examples:

  1. 2001:db8:300:b002:5054:ff:fe4b:db44 could be translated to 2001-0db8-0300-b002-5054-00ff-fe4b-db44.mydomain.tld
  2. 2001:db8:300:b002:5054:ff:fe4b:db45 could be translated to myhost.mydomain.tld via the presets file

Presets

Each line in a presets file contains a manual override seperated by a comma. The first part contains the request and the second part contains the value which should be returned. For example:

5.4.b.d.b.4.e.f.f.f.0.0.4.5.0.5.2.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.;myhost.mydomain.tld
6.4.b.d.b.4.e.f.f.f.0.0.4.5.0.5.2.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.;firewall.mydomain.tld

Translation process

Let's say the plugin receives a PTR request for 4.4.b.d.b.4.e.f.f.f.0.0.4.5.0.5.2.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.. If there is a preset found the preset value will be used in the anwer. If there is none the regular translation process starts:

  1. Strip .ip6.arpa.: 4.4.b.d.b.4.e.f.f.f.0.0.4.5.0.5.2.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2
  2. Remove all dots: 44bdb4efff004505200b00308bd01002
  3. Reverse the string: 20010db80300b002505400fffe4bdb44
  4. Add hyphens: 2001-0db8-0300-b002-5054-00ff-fe4b-db44
  5. Append the suffix and return the result: 20010db80300b002505400fffe4bdb44.mydomain.tld

Corefile example

Possible plugin arguments:

Argument Default value Description
suffix The suffix to append when regular translating happens
 presetsfile The absolute path to the presets file
ttl 900 The TTL value the answer should have in seconds

Let's say your provider allocated 2001:db8:300:b000::/56 to you. You sliced two subnets out of it:

  1. 2001:db8:300:b000::/64 => lan.myhost.tld
  2. 2001:db8:300:b001::/64 => servers.myhost.tld

You Corefile would look something like this:

0.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa {
    log
    autoipv6ptr {
        suffix lan.mydomain.tld
    }
}

1.0.0.b.0.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa {
    log
    autoipv6ptr {
        suffix servers.mydomain.tld
        presetsfile /var/lib/coredns/presets.servers.mydomain.tld
        ttl 60
    }
}

The suffix is a mandatory argument. The presetsfile is optional. The presets file is read on plugin startup.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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