From 8c291298c9241cd2d130f273b25f806687ce5e87 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 2 Feb 2021 23:07:50 -0700 Subject: httpcaddyfile: Add resolvers subdir of tls (close #4008) Allows conveniently setting the resolvers for the DNS challenge using a TLS subdirective, which applies to default issuers, rather than having to explicitly define the issuers and overwrite the defaults. --- caddyconfig/httpcaddyfile/builtins.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'caddyconfig') diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index 4945a81..8a8f3cc 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -316,6 +316,8 @@ func parseTLS(h Helper) ([]ConfigValue, error) { } if acmeIssuer.Challenges == nil { acmeIssuer.Challenges = new(caddytls.ChallengesConfig) + } + if acmeIssuer.Challenges.DNS == nil { acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig) } modID := "dns.providers." + provName @@ -325,6 +327,22 @@ func parseTLS(h Helper) ([]ConfigValue, error) { } acmeIssuer.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, h.warnings) + case "resolvers": + args := h.RemainingArgs() + if len(args) == 0 { + return nil, h.ArgErr() + } + if acmeIssuer == nil { + acmeIssuer = new(caddytls.ACMEIssuer) + } + if acmeIssuer.Challenges == nil { + acmeIssuer.Challenges = new(caddytls.ChallengesConfig) + } + if acmeIssuer.Challenges.DNS == nil { + acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig) + } + acmeIssuer.Challenges.DNS.Resolvers = args + case "ca_root": arg := h.RemainingArgs() if len(arg) != 1 { -- cgit v1.2.3