GithubHelp home page GithubHelp logo

coredns-ens's Introduction

coredns-ens

CoreDNS-ENS is a CoreDNS plugin that resolves DNS information over ENS. It has two primary purposes:

  1. A general-purpose DNS resolver for DNS records stored on the Ethereum blockchain
  2. A specialised resolver for IPFS content hashes and gatways

Details of the first feature can be found at http://www.wealdtech.com/articles/ethdns-an-ethereum-backend-for-the-domain-name-system/

The second feature provides a mechanism to map DNS domains to ENS domains by removing the relevant suffix, for example the DNS domain wealdtech.eth.link maps to the ENS domain wealdtech.eth, and returning information for IPFS gateways (if an A or AAAA record is requested) as well as IPFS and content hashes (if a TXT record is requested). The result of this is that IPFS content can be obtained from any web browser by simply

Building

The latest build is always available as a docker repository at wealdtech/coredns-ens. If you want to build a standalone copy of CoreDNS with this plugin enabled run the build-standalone.sh script, which should work on most unix-like systems.

Corefile

The plugin has a number of configuration options. An example annotated Corefile is shown below:

# This section enables DNS lookups for all domains on ENS
. {
  rewrite stop {
    # This rewrites any requests for *.eth.link domains to *.eth internally
    # prior to being processed by the main ENS resolver.
    name regex (.*)\.eth\.link {1}.eth
    answer name (.*)\.eth {1}.eth.link
  }
  ens {
    # connection is the connection to an Ethereum node.  It is *highly*
    # recommended that a local node is used, as remote connections can
    # cause DNS requests to time out.
    # This can be either a path to an IPC socket or a URL to a JSON-RPC
    # endpoint.
    connection /home/ethereum/.ethereum/geth.ipc

    # ethlinknameservers are the names of the nameservers that serve
    # EthLink domains.  This will usually be the name of this server,
    # plus potentially one or more others.
    ethlinknameservers ns1.ethdns.xyz ns2.ethdns.xyz

    # ipfsgatewaya is the address of an ENS-enabled IPFS gateway.
    # This value is returned when a request for an A record of an Ethlink
    # domain is received and the domain has a contenthash record in ENS but
    # no A record.  Multiple values can be supplied, separated by a space,
    # in which case all records will be returned.
    ipfsgatewaya 176.9.154.81

    # ipfsgatewayaaaa is the address of an ENS-enabled IPFS gateway.
    # This value is returned when a request for an AAAA record of an Ethlink
    # domain is received and the domain has a contenthash record in ENS but
    # no A record.  Multiple values can be supplied, separated by a space,
    # in which case all records will be returned.
    ipfsgatewayaaaa 2a01:4f8:160:4069::2
  }

  # This enables DNS forwarding.  It should only be enabled if this DNS server
  # is not exposed to the internet, otherwise it becomes an open DNS server and
  # will be flooded with attack packets.
  forward . 8.8.8.8

  errors
}

It is also possible to run the DNS server over TLS or over HTTPS; details on how to set up certificates the can be found in the CoreDNS documentation.

Running standalone

Running CoreDNS standalone is simply a case of starting the binary. See the CoreDNS documentation for further information.

Running with Docker

Running CoreDNS with Docker requires running the image created in the Building section. A sample command-line might be:

docker run -p 53:53/udp --volume=/home/coredns:/etc/coredns wealdtech/coredns-ens:latest

where /home/coredns is the directory on the server that contains the Corefile and certificates.

coredns-ens's People

Contributors

arachnid avatar dependabot[bot] avatar dportabella avatar mcdee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coredns-ens's Issues

Integrate with "officially" supported Content-Hash fields beyond IPFS/IPNS

Hi,
Thanks for implementing this plugin, I will definetely try to deploy my own CoreDNS server with the ENS plugin. And I also want to add support for more storage protocols.

A full list can be seen here:

https://github.com/ensdomains/content-hash?tab=readme-ov-file#-supported-codec

I (or anyone else who wants to add this) could add support for Swarm and Tor, since the first is written in Go and the second has Go bindings.

Swarm Bee node: https://github.com/ethersphere/bee
Tor Go bindings: https://github.com/ipsn/go-libtor

Not resolving any TLD with a standalone build

 ╰─λ sudo ./coredns
.:53
CoreDNS-1.8.3
linux/amd64, go1.22.2, 4293992bb-dirty
[INFO] 127.0.0.1:39650 - 11317 "AAAA IN v1rtl.eth. udp 27 false 512" NOERROR qr,aa,rd 85 0.00017179s
[INFO] 127.0.0.1:39650 - 54026 "A IN v1rtl.eth. udp 27 false 512" NOERROR qr,aa,rd 85 0.000065235s
[INFO] 127.0.0.1:40940 - 10286 "AAAA IN v1rtl.site. udp 28 false 512" NOERROR qr,aa,rd 88 0.000071876s
[INFO] 127.0.0.1:40940 - 49709 "A IN v1rtl.site. udp 28 false 512" NOERROR qr,aa,rd 88 0.000042376s

I was trying to query both .eth and regular DNS TLDs, both seem to fail.

I've stopped systemd-resolved because it was also running on :53 and I've put nameserver 127.0.0.1 to /etc/resolv.conf

I'm on Linux 6.9.4, Garuda Linux

build-standalone.sh broken, error on build

On a clean checkout of this repo, running build-standalone.sh does not work.
build log:

Cloning coredns repo...
Cloning into 'coredns'...
remote: Enumerating objects: 60748, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 60748 (delta 44), reused 32 (delta 21), pack-reused 60674
Receiving objects: 100% (60748/60748), 97.17 MiB | 1.75 MiB/s, done.
Resolving deltas: 100% (33612/33612), done.
Note: switching to 'v1.8.3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 4293992b Up release to 1.8.3 (#4486)
Patching plugin config...
1264
rewrite:rewrite
1301
Patching go modules...
1689
)
	k8s.io/klog v1.0.0
1780
go: downloading github.com/coredns/caddy v1.1.0
go: downloading github.com/miekg/dns v1.1.38
go: downloading github.com/ethereum/go-ethereum v1.10.4
go: downloading github.com/wealdtech/go-ens/v3 v3.5.0
go: downloading golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
go: downloading golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
go: downloading github.com/ipfs/go-cid v0.0.7
go: downloading github.com/wealdtech/go-multicodec v1.4.0
go: downloading github.com/btcsuite/btcd v0.22.0-beta
go: downloading github.com/klauspost/cpuid/v2 v2.0.6
go: downloading github.com/google/uuid v1.2.0
go: downloading github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
go: downloading github.com/karalabe/usb v0.0.0-20210518091819-4ea20957c210
go: downloading github.com/peterh/liner v1.2.1
go: downloading github.com/shirou/gopsutil v3.21.5+incompatible
go: downloading github.com/VictoriaMetrics/fastcache v1.6.0
go: downloading github.com/holiman/uint256 v1.2.0
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
go: downloading github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88
go: downloading github.com/jackpal/go-nat-pmp v1.0.2
go: downloading github.com/mattn/go-runewidth v0.0.13
go: downloading github.com/tklauser/go-sysconf v0.3.6
go: downloading github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/go-ole/go-ole v1.2.5
go: downloading github.com/tklauser/numcpus v0.2.2
go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead.
go get: upgraded github.com/golang/protobuf v1.4.3 => v1.5.2
go get: upgraded github.com/gorilla/websocket v1.4.0 => v1.4.2
go get: upgraded github.com/hashicorp/golang-lru v0.5.4 => v0.5.5-0.20210104140557-80c98217689d
go get: upgraded golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad => v0.0.0-20210616213533-5ff15b29337e
go get: upgraded golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e => v0.0.0-20210616094352-59db8d763f22
Building...
+ git describe --dirty --always
CGO_ENABLED=1  go build -v -ldflags="-s -w -X github.com/coredns/coredns/coremain.GitCommit=4293992b-dirty" -o coredns
+ CGO_ENABLED=1
+ go build -v '-ldflags=-s -w -X github.com/coredns/coredns/coremain.GitCommit=4293992b-dirty' -o coredns
/Users/diwu/go/pkg/mod/go.etcd.io/[email protected]/pkg/logutil/zap_journal.go:29:2: missing go.sum entry needed to verify package github.com/coreos/go-systemd/v22/journal (imported by go.etcd.io/etcd/pkg/logutil) is provided by exactly one module; to add:
	go get go.etcd.io/etcd/pkg/[email protected]
/Users/diwu/go/pkg/mod/k8s.io/[email protected]/pkg/util/diff/diff.go:27:2: missing go.sum entry for module providing package github.com/google/go-cmp/cmp (imported by k8s.io/apimachinery/pkg/util/diff); to add:
	go get k8s.io/apimachinery/pkg/util/[email protected]
/Users/diwu/go/pkg/mod/k8s.io/[email protected]/pkg/apis/meta/v1/micro_time_fuzz.go:24:2: missing go.sum entry for module providing package github.com/google/gofuzz (imported by k8s.io/apimachinery/pkg/apis/meta/v1); to add:
	go get k8s.io/apimachinery/pkg/apis/meta/[email protected]
/Users/diwu/go/pkg/mod/golang.org/x/[email protected]/ssh/terminal/terminal.go:14:2: missing go.sum entry for module providing package golang.org/x/term (imported by golang.org/x/crypto/ssh/terminal); to add:
	go get golang.org/x/crypto/ssh/[email protected]
/Users/diwu/go/pkg/mod/k8s.io/[email protected]/util/workqueue/default_rate_limiters.go:24:2: missing go.sum entry for module providing package golang.org/x/time/rate (imported by gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer); to add:
	go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace/[email protected]
make: *** [coredns] Error 1

*.eth.link resolution errors

Hi! Apologies if this isn't the right place for this question, but I recently noticed what may be a bug in *.eth.link domains.

Visiting e.g.tokens.uniswap.eth.link gives a Cloudflare Error 1001 page, whereas running ethereal ens contenthash get --domain=tokens.uniswap.eth correctly returns /ipns/tokens.uniswap.org.

I believe this issue may manifest only for nested ENS names?

IPNS resolution?

Does the roadmap for this project include supporting resolution of IPNS pointers via ENS? Specifically, not just traditional IPNS pointers but also DNSLink-style ones.

The usecase here would be if a user adds a _dnslink TXT record to their domain, enabling ipns/<domain>.<tld> resolution, then they should be able to add this pointer as a field to their <name>.ens name, and *.eth.link should be able to perform the recursive lookup.

DNSLink reply breaks IPFS gateway with go-ens contenthash update

It appears that the content hash update for go-ens, v3.5.0 isn't playing nice with DNSLink replies:

Previous version:
Working: almonit.eth text = "dnslink=/ipfs/QmdDMMNmBwgsxP9KXYq9FMrGkAFkPn273LNye8zbe9PRT2"

v3.5.0:
Not Working: almonit.eth text = "dnslink=ipfs://k2jmtxwveo0jw82y04yk726n8k04aoat5z6edqs6lih5jnmkbcon0cb9"

go-ipfs isn't able to correctly resolve ipfs:// or ipns://, whereas it does work with /ipfs/ and /ipns/.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.