certmagic.Storage changed in 2.5.0-rc1?

Busy looking at a shared certificates for a “cluster” of Caddy, I ran into the above for 2.5.0-rc1 / master today, even though it builds fine using 2.4.6 & 2.5.0-beta.1

for RedisTLS the exact same error: xcaddy build v2.5.0-rc.1 --with github.com/gamalan/caddy-tlsredis 2>&1 | plik

2022/04/18 13:16:03 [INFO] Temporary folder: /tmp/buildenv_2022-04-18-1316.2381718657
2022/04/18 13:16:03 [INFO] Writing main module: /tmp/buildenv_2022-04-18-1316.2381718657/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/gamalan/caddy-tlsredis"
)

func main() {
	caddycmd.Main()
}
2022/04/18 13:16:03 [INFO] Initializing Go module
2022/04/18 13:16:03 [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
2022/04/18 13:16:03 [INFO] Pinning versions
2022/04/18 13:16:03 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.5.0-rc.1 
go get: added github.com/beorn7/perks v1.0.1
go get: added github.com/caddyserver/caddy/v2 v2.5.0-rc.1
go get: added github.com/caddyserver/certmagic v0.16.0
go get: added github.com/cespare/xxhash/v2 v2.1.2
go get: added github.com/cheekybits/genny v1.0.0
go get: added github.com/fsnotify/fsnotify v1.5.1
go get: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go get: added github.com/golang/protobuf v1.5.2
go get: added github.com/google/uuid v1.3.0
go get: added github.com/klauspost/cpuid/v2 v2.0.11
go get: added github.com/libdns/libdns v0.2.1
go get: added github.com/lucas-clemente/quic-go v0.26.0
go get: added github.com/marten-seemann/qpack v0.2.1
go get: added github.com/marten-seemann/qtls-go1-16 v0.1.5
go get: added github.com/marten-seemann/qtls-go1-17 v0.1.1
go get: added github.com/marten-seemann/qtls-go1-18 v0.1.1
go get: added github.com/matttproud/golang_protobuf_extensions v1.0.1
go get: added github.com/mholt/acmez v1.0.2
go get: added github.com/miekg/dns v1.1.46
go get: added github.com/nxadm/tail v1.4.8
go get: added github.com/onsi/ginkgo v1.16.4
go get: added github.com/prometheus/client_golang v1.12.1
go get: added github.com/prometheus/client_model v0.2.0
go get: added github.com/prometheus/common v0.32.1
go get: added github.com/prometheus/procfs v0.7.3
go get: added go.uber.org/atomic v1.7.0
go get: added go.uber.org/multierr v1.6.0
go get: added go.uber.org/zap v1.21.0
go get: added golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2
go get: added golang.org/x/mod v0.4.2
go get: added golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
go get: added golang.org/x/sys v0.0.0-20220209214540-3681064d5158
go get: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go get: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go get: added golang.org/x/tools v0.1.7
go get: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go get: added google.golang.org/protobuf v1.27.1
go get: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
2022/04/18 13:16:05 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/gamalan/caddy-tlsredis github.com/caddyserver/caddy/v2@v2.5.0-rc.1 
go get: added github.com/bsm/redislock v0.7.0
go get: added github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
go get: added github.com/gamalan/caddy-tlsredis v0.2.8
go get: added github.com/go-redis/redis/v8 v8.11.0
2022/04/18 13:16:06 [INFO] exec (timeout=0s): /usr/bin/go get -d -v  
2022/04/18 13:16:08 [INFO] Build environment ready
2022/04/18 13:16:08 [INFO] Building Caddy
2022/04/18 13:16:08 [INFO] exec (timeout=0s): /usr/bin/go mod tidy 
2022/04/18 13:16:09 [INFO] exec (timeout=0s): /usr/bin/go build -o /root/caddy/caddy -ldflags -w -s -trimpath 
# github.com/gamalan/caddy-tlsredis
/root/go/pkg/mod/github.com/gamalan/caddy-tlsredis@v0.2.8/storageredis.go:159:2: cannot use rd (type *RedisStorage) as type certmagic.Storage in return argument:
	*RedisStorage does not implement certmagic.Storage (wrong type for Delete method)
		have Delete(string) error
		want Delete(context.Context, string) error
/root/go/pkg/mod/github.com/gamalan/caddy-tlsredis@v0.2.8/storageredis.go:484:15: undefined: certmagic.ErrNotExist
2022/04/18 13:16:10 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-04-18-1316.2381718657
2022/04/18 13:16:10 [FATAL] exit status 2

Yes, the Storage interface had a breaking change (note that CertMagic is not yet stable 1.0 – but we’re close):

The caddy-tlsredis plugin was updated already and should build fine once a new version is tagged by @gamalan:

In the meantime, you can specify the latest version by using @master after the package name in your xcaddy and go commands.

Also note that the S3 plugin you’re building is not safe in terms of CA rate limits because it does not implement the Lock or Unlock methods properly (they are simply no-ops). And as far as I know, S3 does not support atomic operations (sigh), so I highly recommend not using S3 for a storage backend.

This topic was automatically closed after 30 days. New replies are no longer allowed.