@marcel91200 / caddy Mirror · read-only / commits / 7846bc1e
Fork 0

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

httpcaddyfile: Adjust iterator when removing AP (fix #3953)

Matthew Holt committed Jan 4, 2021 at 11:25 UTC 7846bc1e06b2de97906cd562d16db4b2aafbd74b
3 files changed +98 -1
caddyconfig/httpcaddyfile/tlsapp.go
+2 -1
@@ -453,7 +453,7 @@ func newBaseAutomationPolicy(options map[string]interface{}, warnings []caddycon
453 // ZeroSSL), the proper wrapper over acmeIssuer will be returned instead.
454 func disambiguateACMEIssuer(acmeIssuer *caddytls.ACMEIssuer) certmagic.Issuer {
455 // as a special case, we integrate with ZeroSSL's ACME endpoint if it looks like an
456 - // implicit ZeroSSL configuration (this requires a wrapper type over ACMEIssuer
456 + // implicit ZeroSSL configuration (this requires a wrapper type over ACMEIssuer
457 // because of the EAB generation; if EAB is provided, we can use plain ACMEIssuer)
458 if strings.Contains(acmeIssuer.CA, "acme.zerossl.com") && acmeIssuer.ExternalAccount == nil {
459 return &caddytls.ZeroSSLIssuer{ACMEIssuer: acmeIssuer}
@@ -518,6 +518,7 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls
518 // '*.com', which might be different (yes we've seen this happen)
519 if automationPolicyShadows(i, aps) >= j {
520 aps = append(aps[:i], aps[i+1:]...)
521 + i--
522 }
523 } else {
524 // avoid repeated subjects
caddytest/integration/caddyfile_adapt/tls_automation_policies_1.txt renamed
caddytest/integration/caddyfile_adapt/tls_automation_policies_2.txt new
+96
@@ -0,0 +1,96 @@
1 +# issue #3953
2 +
3 +{
4 + cert_issuer zerossl api_key
5 +}
6 +
7 +example.com {
8 + tls {
9 + on_demand
10 + }
11 +}
12 +
13 +http://example.net {
14 +}
15 +
16 +:1234 {
17 +}
18 +----------
19 +{
20 + "apps": {
21 + "http": {
22 + "servers": {
23 + "srv0": {
24 + "listen": [
25 + ":1234"
26 + ]
27 + },
28 + "srv1": {
29 + "listen": [
30 + ":443"
31 + ],
32 + "routes": [
33 + {
34 + "match": [
35 + {
36 + "host": [
37 + "example.com"
38 + ]
39 + }
40 + ],
41 + "terminal": true
42 + }
43 + ]
44 + },
45 + "srv2": {
46 + "listen": [
47 + ":80"
48 + ],
49 + "routes": [
50 + {
51 + "match": [
52 + {
53 + "host": [
54 + "example.net"
55 + ]
56 + }
57 + ],
58 + "terminal": true
59 + }
60 + ],
61 + "automatic_https": {
62 + "skip": [
63 + "example.net"
64 + ]
65 + }
66 + }
67 + }
68 + },
69 + "tls": {
70 + "automation": {
71 + "policies": [
72 + {
73 + "subjects": [
74 + "example.com"
75 + ],
76 + "issuers": [
77 + {
78 + "api_key": "api_key",
79 + "module": "zerossl"
80 + }
81 + ],
82 + "on_demand": true
83 + },
84 + {
85 + "issuers": [
86 + {
87 + "api_key": "api_key",
88 + "module": "zerossl"
89 + }
90 + ]
91 + }
92 + ]
93 + }
94 + }
95 + }
96 +}
\ No newline at end of file