1
0
Fork 0
 
 
 
Go to file
Ambrose Chua 418187dc03 Add attachments during release 2020-04-25 23:24:32 +08:00
coredns Add attachments during release 2020-04-25 23:24:32 +08:00
example Improve 2020-04-25 16:32:28 +08:00
.drone.yml Do builds only on tag 2020-04-25 18:16:57 +08:00
.gitignore Add release script 2020-04-25 20:34:35 +08:00
LICENSE Initial commit 2017-08-20 09:36:37 +08:00
README.md Update README.md example link 2020-04-25 19:13:52 +08:00
alias.go Flatten CNAME records beyond first 2019-10-18 15:45:39 +11:00
go.mod Update modules to match CoreDNS v1.6.9 2020-04-22 11:25:48 +10:00
go.sum Improve 2020-04-25 16:32:28 +08:00
setup.go Update moved package name 2019-10-18 09:53:48 +11:00

README.md

alias Build Status

The alias plugin eliminates CNAME records from zone apex by making the subsequent resolved records look like they belong to the zone apex. This behaves similarily to CloudFlare's Zone Flattening.

This plugin works only with plugins that produce A or AAAA records alongside the CNAME record. Examples include auto and file. However, you might need to adjust the order of this plugin to use it with other plugins.

Preferrably, this should not be used in favour of the RFC drafts for the new ANAME records, but the DNS library used by CoreDNS does not support ANAME records yet.

Release builds can be found here

Syntax

alias

Examples

example.com {
	file db.example.com
	alias
}
# This is used to resolve CNAME records by the `file` plugin. Modify accordingly
. {
	forward . 1.1.1.1 1.0.0.1
}

This will transform responses like this:

;; ANSWER SECTION:
example.com.		3600	IN	CNAME	two.example.org.
two.example.org.	3600	IN	CNAME	one.example.net.
one.example.net.	3600	IN	A	127.0.0.1

into

;; ANSWER SECTION:
example.com.		3600	IN	A	127.0.0.1

See example/ for a more extensive example.

Installation

As per CoreDNS docs, there are two ways.

Build with compile-time configuration file

$ git clone https://github.com/coredns/coredns
$ cd coredns
$ vim plugin.cfg
# Add the line alias:github.com/serverwentdown/alias before the file middleware
$ go generate
$ go build
$ ./coredns -plugins | grep alias

Build with external golang source code

$ git clone https://github.com/serverwentdown/alias
$ cd alias/coredns
$ go build
$ ./coredns -plugins | grep alias