-
-
Notifications
You must be signed in to change notification settings - Fork 283
Writing DNS Providers
In CertMagic terms, DNS providers are small libraries that facilitate the ACME DNS challenge.
They simply need to implement the certmagic.ACMEDNSProvider
interface, which is:
// ACMEDNSProvider defines the set of operations required for
// ACME challenges. A DNS provider must be able to append and
// delete records in order to solve ACME challenges. Find one
// you can use at https://github.com/libdns. If your provider
// isn't implemented yet, feel free to contribute!
type ACMEDNSProvider interface {
libdns.RecordAppender
libdns.RecordDeleter
}
In other words, they need only implement the libdns
interfaces. Specifically, they need to be able to append and delete DNS records.
(Currently, libdns
defines 4 interfaces, but CertMagic only uses 2. If you are implementing a provider, you might as well implement all 4, since once you've implemented 2, adding the other two often is very easy, and is helpful to users in a variety of other applications.)
The libdns repository has instructions for implementing new providers.
That's it! Once those two methods are implemented, you can use them with the certmagic.DNS01Solver
type which is an acmez.Solver
, thus allowing you to fulfill the DNS challenge with your provider.