Storage Interface

(Miek Gieben) #1

Hi, I was wondering to use something like caddytlss Storage interface for use in CoreDNS. One question though how does this suppose to work when your storage itself (think etcd) needs TLS parameters?

(Matt Holt) #2

I’m not familiar with etcd…

The Storage interface is designed to make it possible to swap out Caddy storing TLS certificates on disk and instead be able to use other infrastructure. The original reason it was created was so that certificates could be shared among a cluster of Caddy running in Kubernetes I think.

I haven’t gotten around to making TLS storage a first-class plugin yet as far as the build server goes, but you can already use it by calling caddytls.RegisterStorageProvider.

However, the interface will probably be expanding soon as I want to get it to support more kinds of storage, basically anything inside the .caddy folder, rather than just TLS certificates. For example, the ability to share OCSP staples, etc. So just be aware of that likely upcoming change.

(Miek Gieben) #3

my storage needs to be authenticated, meaning I need to get to the certs somehow, implying I can’t use this?

(Matt Holt) #4

I’m not sure I understand what you mean then. The Storage interface is an interface: you can implement it however you want/need: with or without authentication. Just as long as you have those methods…

(Miek Gieben) #5

Fair enough.

(Matt Holt) #6

The type (presumably a struct) that implements it will have fields, perhaps, to store credentials. Then the methods that implement the interface will use those credentials to do whatever they have to do, like set BasicAuth on an http.Request for web requests, or something. Hope that is helpful!

(again, I expect the interface to change soon – at least added methods, but I might revise existing methods too.)

(Miek Gieben) closed #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.