diff options
author | Peter Magnusson <git@kmpm.se> | 2021-06-07 20:25:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 12:25:12 -0600 |
commit | 4c2da188419cf087049a6a3d4d08a859ac94c397 (patch) | |
tree | f057d215ca84716d3ad46bf631a0998874e6d59f | |
parent | f9b54454a19e2b070159ce8d2af76d819658244e (diff) |
caddytls: Add Caddyfile support for `propagation_timeout` (#4178)
* add propagation_timeout to UnmarshalCaddyfile
- Closes #4177
* added caddyfile_adapt test
-rw-r--r-- | caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt | 70 | ||||
-rw-r--r-- | modules/caddytls/acmeissuer.go | 16 |
2 files changed, 86 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt b/caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt new file mode 100644 index 0000000..5d2b643 --- /dev/null +++ b/caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt @@ -0,0 +1,70 @@ +localhost + +respond "hello from localhost" +tls { + issuer acme { + propagation_timeout "10m0s" + } +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":443" + ], + "routes": [ + { + "match": [ + { + "host": [ + "localhost" + ] + } + ], + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "handle": [ + { + "body": "hello from localhost", + "handler": "static_response" + } + ] + } + ] + } + ], + "terminal": true + } + ] + } + } + }, + "tls": { + "automation": { + "policies": [ + { + "subjects": [ + "localhost" + ], + "issuers": [ + { + "challenges": { + "dns": { + "propagation_timeout": 600000000000 + } + }, + "module": "acme" + } + ] + } + ] + } + } + } +}
\ No newline at end of file diff --git a/modules/caddytls/acmeissuer.go b/modules/caddytls/acmeissuer.go index bbcd5d7..6085044 100644 --- a/modules/caddytls/acmeissuer.go +++ b/modules/caddytls/acmeissuer.go @@ -387,6 +387,22 @@ func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { return err } iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil) + case "propagation_timeout": + if !d.NextArg() { + return d.ArgErr() + } + timeoutStr := d.Val() + timeout, err := caddy.ParseDuration(timeoutStr) + if err != nil { + return d.Errf("invalid propagation_timeout duration %s: %v", timeoutStr, err) + } + if iss.Challenges == nil { + iss.Challenges = new(ChallengesConfig) + } + if iss.Challenges.DNS == nil { + iss.Challenges.DNS = new(DNSChallengeConfig) + } + iss.Challenges.DNS.PropagationTimeout = caddy.Duration(timeout) case "resolvers": if iss.Challenges == nil { |