Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddytls: Add Caddyfile support for `propagation_timeout` (#4178)
* add propagation_timeout to UnmarshalCaddyfile - Closes #4177 * added caddyfile_adapt test
Peter Magnusson committed
Jun 7, 2021 at 20:25 UTC
4c2da188419cf087049a6a3d4d08a859ac94c397
2 files changed
+86
caddytest/integration/caddyfile_adapt/tls_propagation_timeout.txt
new
+70
@@ -0,0 +1,70 @@
1
+localhost
2
+
3
+respond "hello from localhost"
4
+tls {
5
+ issuer acme {
6
+ propagation_timeout "10m0s"
7
+ }
8
+}
9
+----------
10
+{
11
+ "apps": {
12
+ "http": {
13
+ "servers": {
14
+ "srv0": {
15
+ "listen": [
16
+ ":443"
17
+ ],
18
+ "routes": [
19
+ {
20
+ "match": [
21
+ {
22
+ "host": [
23
+ "localhost"
24
+ ]
25
+ }
26
+ ],
27
+ "handle": [
28
+ {
29
+ "handler": "subroute",
30
+ "routes": [
31
+ {
32
+ "handle": [
33
+ {
34
+ "body": "hello from localhost",
35
+ "handler": "static_response"
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ }
41
+ ],
42
+ "terminal": true
43
+ }
44
+ ]
45
+ }
46
+ }
47
+ },
48
+ "tls": {
49
+ "automation": {
50
+ "policies": [
51
+ {
52
+ "subjects": [
53
+ "localhost"
54
+ ],
55
+ "issuers": [
56
+ {
57
+ "challenges": {
58
+ "dns": {
59
+ "propagation_timeout": 600000000000
60
+ }
61
+ },
62
+ "module": "acme"
63
+ }
64
+ ]
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ }
70
+}
\ No newline at end of file
modules/caddytls/acmeissuer.go
+16
@@ -387,6 +387,22 @@ func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
387
return err
388
}
389
iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil)
390
+ case "propagation_timeout":
391
+ if !d.NextArg() {
392
+ return d.ArgErr()
393
+ }
394
+ timeoutStr := d.Val()
395
+ timeout, err := caddy.ParseDuration(timeoutStr)
396
+ if err != nil {
397
+ return d.Errf("invalid propagation_timeout duration %s: %v", timeoutStr, err)
398
+ }
399
+ if iss.Challenges == nil {
400
+ iss.Challenges = new(ChallengesConfig)
401
+ }
402
+ if iss.Challenges.DNS == nil {
403
+ iss.Challenges.DNS = new(DNSChallengeConfig)
404
+ }
405
+ iss.Challenges.DNS.PropagationTimeout = caddy.Duration(timeout)
406
407
case "resolvers":
408
if iss.Challenges == nil {