Caddy v2 dns rfc-2136 module

Hello,

While looking for a way to use rfc-2136 for DNS challenges I found this topic: Rfc2136 provider for caddy v2 - #2 by francislavoie

Unfortunately, I’m a Go noob, but I still wanted to give it a try and check the state of the current module to see what could be missing to use it.

My first attempt was to build caddy with this module but without much luck:

╭─apanel at dev in ~/workspaces/caddy
╰─○ ~/go/bin/xcaddy build --with github.com/francislavoie/rfc2136 --with github.com/kirsch33/realip 
023/01/16 08:44:33 [INFO] Temporary folder: /tmp/buildenv_2023-01-16-0844.3218045671
2023/01/16 08:44:33 [INFO] Writing main module: /tmp/buildenv_2023-01-16-0844.3218045671/main.go
package main

import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"

        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
        _ "github.com/francislavoie/rfc2136"
        _ "github.com/kirsch33/realip"
)

func main() {
        caddycmd.Main()
}
2023/01/16 08:44:33 [INFO] Initializing Go module
2023/01/16 08:44:33 [INFO] exec (timeout=10s): /usr/bin/go mod init caddy 
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2023/01/16 08:44:33 [INFO] Pinning versions
2023/01/16 08:44:33 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2 
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.6.2
go: added github.com/caddyserver/certmagic v0.17.2
go: added github.com/cespare/xxhash/v2 v2.1.2
go: added github.com/fsnotify/fsnotify v1.5.1
go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: added github.com/golang/mock v1.6.0
go: added github.com/golang/protobuf v1.5.2
go: added github.com/google/uuid v1.3.0
go: added github.com/klauspost/cpuid/v2 v2.1.1
go: added github.com/libdns/libdns v0.2.1
go: added github.com/lucas-clemente/quic-go v0.29.2
go: added github.com/marten-seemann/qpack v0.2.1
go: added github.com/marten-seemann/qtls-go1-18 v0.1.3
go: added github.com/marten-seemann/qtls-go1-19 v0.1.1
go: added github.com/matttproud/golang_protobuf_extensions v1.0.1
go: added github.com/mholt/acmez v1.0.4
go: added github.com/miekg/dns v1.1.50
go: added github.com/nxadm/tail v1.4.8
go: added github.com/onsi/ginkgo v1.16.4
go: added github.com/prometheus/client_golang v1.12.2
go: added github.com/prometheus/client_model v0.2.0
go: added github.com/prometheus/common v0.32.1
go: added github.com/prometheus/procfs v0.7.3
go: added go.uber.org/atomic v1.9.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.23.0
go: added golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
go: added golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
go: added golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
go: added golang.org/x/net v0.0.0-20220812165438-1d4ff48094d1
go: added golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
go: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go: added golang.org/x/tools v0.1.10
go: added golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f
go: added google.golang.org/protobuf v1.28.0
go: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
2023/01/16 08:44:34 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/francislavoie/rfc2136 github.com/caddyserver/caddy/v2 
go: downloading github.com/francislavoie/rfc2136 v0.0.0-20210212120350-4b5f70325898
**go: github.com/francislavoie/rfc2136@v0.0.0-20210212120350-4b5f70325898: parsing go.mod:**
**        module declares its path as: github.com/libdns/rfc2136**
**                but was required as: github.com/francislavoie/rfc2136**
2023/01/16 08:44:39 [FATAL] exit status 1

It’s not starting well for a first attempt. I guess I don’t know the trick to build caddy with a plugin that isn’t in the correct namespace ?

Any hints would be welcome :slight_smile:

Kind regards.

EDIT: I’m not sure if it’s the right category to post such questions

Oh sorry. That plugin is incomplete. I never finished it. I should probably archive the repo. I never registered it as a plugin to Download Caddy because it’s not ready.

1 Like

Hello Francis,

Looking at the post I kinda understood it was WIP and as we need it to interact with our PowerDNS servers I thought it would be worth a try to attempt to finish it.

It could be useful to other people needing a way to interact with any other rfc2136 compliant DNS servers.

My first step in was to check how your module prototype behave actually by compiling it with a custom caddy version.

Obviously xcaddy is not the way to go for building caddy with such a module not being registered ?

It is the way, but the code is literally just incomplete, so it won’t compile.

I was just saying that the Download page can generally be used to know whether a plugin is “complete”. They should get registered there by the developer, since it’s a good way to advertise that the plugin exists and is ready to be used.

I agree. But I don’t actually use an RFC2136 DNS server right now, so I didn’t have motivation to finish it.

Ok, thank you for the info Francis.

In the meantime, a colleague pointed me to this repo:

It is NOT listed in the caddy download page, but I gave it a try and it seems to work adding these settings to Caddyfile:

        acme_dns rfc2136 {
                key_name "internal.dev"
                key_alg "hmac-sha512"
                key "SomeUberSecretTSIGKey=="
                server "x.x.x.x:53"
        }

Reading the code, I don’t understand how it works, maybe most of the code is already in libdns.

Kind regards

1 Like

Yeah, the caddy-dns packages are usually just the config layer/glue for Caddy and the actual functionality is in the libdns package, i.e. GitHub - libdns/rfc2136