| 1 | // Copyright 2015 Matthew Holt and The Caddy Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package caddytlsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ |
| 16 | |
| 17 | import ( |
| 18 | "contextscip-go gomod github.com/golang/go/src go1.25.1 context/" |
| 19 | "crypto/x509scip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/" |
| 20 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/" |
| 21 | "fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/" |
| 22 | "net/httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/" |
| 23 | "net/urlscip-go gomod github.com/golang/go/src go1.25.1 `net/url`/" |
| 24 | "osscip-go gomod github.com/golang/go/src go1.25.1 os/" |
| 25 | "strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/" |
| 26 | "stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/" |
| 27 | "timescip-go gomod github.com/golang/go/src go1.25.1 time/" |
| 28 | |
| 29 | "github.com/caddyserver/certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/" |
| 30 | "github.com/caddyserver/zerosslscip-go gomod github.com/caddyserver/zerossl v0.1.5 `github.com/caddyserver/zerossl`/" |
| 31 | "github.com/mholt/acmez/v3/acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/" |
| 32 | "go.uber.org/zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/" |
| 33 | "go.uber.org/zap/zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/" |
| 34 | |
| 35 | "github.com/caddyserver/caddy/v2scip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/" |
| 36 | "github.com/caddyserver/caddy/v2/caddyconfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig`/" |
| 37 | "github.com/caddyserver/caddy/v2/caddyconfig/caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/" |
| 38 | ) |
| 39 | |
| 40 | func initscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/init().() { |
| 41 | caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.RegisterModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/RegisterModule().(ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#{}) |
| 42 | } |
| 43 | |
| 44 | // ACMEIssuer manages certificates using the ACME protocol (RFC 8555). |
| 45 | type ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer# struct { |
| 46 | // The URL to the CA's ACME directory endpoint. Default: |
| 47 | // https://acme-v02.api.letsencrypt.org/directory |
| 48 | CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA. string `json:"ca,omitempty"` |
| 49 | |
| 50 | // The URL to the test CA's ACME directory endpoint. |
| 51 | // This endpoint is only used during retries if there |
| 52 | // is a failure using the primary CA. Default: |
| 53 | // https://acme-staging-v02.api.letsencrypt.org/directory |
| 54 | TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA. string `json:"test_ca,omitempty"` |
| 55 | |
| 56 | // Your email address, so the CA can contact you if necessary. |
| 57 | // Not required, but strongly recommended to provide one so |
| 58 | // you can be reached if there is a problem. Your email is |
| 59 | // not sent to any Caddy mothership or used for any purpose |
| 60 | // other than ACME transactions. |
| 61 | Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email. string `json:"email,omitempty"` |
| 62 | |
| 63 | // Optionally select an ACME profile to use for certificate |
| 64 | // orders. Must be a profile name offered by the ACME server, |
| 65 | // which are listed at its directory endpoint. |
| 66 | // |
| 67 | // EXPERIMENTAL: Subject to change. |
| 68 | // See https://datatracker.ietf.org/doc/draft-aaron-acme-profiles/ |
| 69 | Profilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Profile. string `json:"profile,omitempty"` |
| 70 | |
| 71 | // If you have an existing account with the ACME server, put |
| 72 | // the private key here in PEM format. The ACME client will |
| 73 | // look up your account information with this key first before |
| 74 | // trying to create a new one. You can use placeholders here, |
| 75 | // for example if you have it in an environment variable. |
| 76 | AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey. string `json:"account_key,omitempty"` |
| 77 | |
| 78 | // If using an ACME CA that requires an external account |
| 79 | // binding, specify the CA-provided credentials here. |
| 80 | ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount. *acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.EABscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB# `json:"external_account,omitempty"` |
| 81 | |
| 82 | // Time to wait before timing out an ACME operation. |
| 83 | // Default: 0 (no timeout) |
| 84 | ACMETimeoutscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ACMETimeout. caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration# `json:"acme_timeout,omitempty"` |
| 85 | |
| 86 | // Configures the various ACME challenge types. |
| 87 | Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. *ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig# `json:"challenges,omitempty"` |
| 88 | |
| 89 | // An array of files of CA certificates to accept when connecting to the |
| 90 | // ACME CA. Generally, you should only use this if the ACME CA endpoint |
| 91 | // is internal or for development/testing purposes. |
| 92 | TrustedRootsPEMFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TrustedRootsPEMFiles. []string `json:"trusted_roots_pem_files,omitempty"` |
| 93 | |
| 94 | // Preferences for selecting alternate certificate chains, if offered |
| 95 | // by the CA. By default, the first offered chain will be selected. |
| 96 | // If configured, the chains may be sorted and the first matching chain |
| 97 | // will be selected. |
| 98 | PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains. *ChainPreferencescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference# `json:"preferred_chains,omitempty"` |
| 99 | |
| 100 | // The validity period to ask the CA to issue a certificate for. |
| 101 | // Default: 0 (CA chooses lifetime). |
| 102 | // This value is used to compute the "notAfter" field of the ACME order; |
| 103 | // therefore the system must have a reasonably synchronized clock. |
| 104 | // NOTE: Not all CAs support this. Check with your CA's ACME |
| 105 | // documentation to see if this is allowed and what values may |
| 106 | // be used. EXPERIMENTAL: Subject to change. |
| 107 | CertificateLifetimescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CertificateLifetime. caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration# `json:"certificate_lifetime,omitempty"` |
| 108 | |
| 109 | // Forward proxy module |
| 110 | NetworkProxyRawscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#NetworkProxyRaw. jsonscip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/.RawMessagescip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/RawMessage# `json:"network_proxy,omitempty" caddy:"namespace=caddy.network_proxy inline_key=from"` |
| 111 | |
| 112 | rootPoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#rootPool. *x509scip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/.CertPoolscip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/CertPool# |
| 113 | loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#logger. *zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Loggerscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger# |
| 114 | |
| 115 | templatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#template. certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer# // set at Provision |
| 116 | magicscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#magic. *certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.Configscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/Config# // set at PreCheck |
| 117 | issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer. *certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer# // set at PreCheck; result of template + magic |
| 118 | } |
| 119 | |
| 120 | // CaddyModule returns the Caddy module information. |
| 121 | func (ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) CaddyModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CaddyModule().() caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ModuleInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo# { |
| 122 | return caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ModuleInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#{ |
| 123 | IDscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#ID.: "tls.issuance.acme", |
| 124 | Newscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#New.: func() caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Modulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Module# { return new(ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) }, |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // Provision sets up iss. |
| 129 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) Provisionscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Provision().(ctx caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Contextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#) error { |
| 130 | iss.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#logger. = ctx.Loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#Logger().() |
| 131 | |
| 132 | repl := caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.NewReplacerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/NewReplacer().() |
| 133 | |
| 134 | // expand email address, if non-empty |
| 135 | if iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email. != "" { |
| 136 | email, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email., true, true) |
| 137 | if err != nil { |
| 138 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding email address '%s': %v", iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email., err) |
| 139 | } |
| 140 | iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email. = email |
| 141 | } |
| 142 | |
| 143 | // expand CA endpoint, if non-empty |
| 144 | if iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA. != "" { |
| 145 | ca, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA., true, true) |
| 146 | if err != nil { |
| 147 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding CA endpoint '%s': %v", iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA., err) |
| 148 | } |
| 149 | iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA. = ca |
| 150 | } |
| 151 | |
| 152 | // expand TestCA endpoint, if non-empty |
| 153 | if iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA. != "" { |
| 154 | testca, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA., true, true) |
| 155 | if err != nil { |
| 156 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding TestCA endpoint '%s': %v", iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA., err) |
| 157 | } |
| 158 | iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA. = testca |
| 159 | } |
| 160 | |
| 161 | // expand EAB credentials, if non-empty |
| 162 | if iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount. != nil { |
| 163 | if iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID. != "" { |
| 164 | keyID, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID., true, true) |
| 165 | if err != nil { |
| 166 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding EAB key ID '%s': %v", iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID., err) |
| 167 | } |
| 168 | iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID. = keyID |
| 169 | } |
| 170 | if iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..MACKeyscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#MACKey. != "" { |
| 171 | macKey, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..MACKeyscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#MACKey., true, true) |
| 172 | if err != nil { |
| 173 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding EAB MAC key (redacted): %v", err) |
| 174 | } |
| 175 | iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..MACKeyscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#MACKey. = macKey |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // expand account key, if non-empty |
| 180 | if iss.AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey. != "" { |
| 181 | accountKey, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey., true, true) |
| 182 | if err != nil { |
| 183 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding account key PEM '%s': %v", iss.AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey., err) |
| 184 | } |
| 185 | iss.AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey. = accountKey |
| 186 | } |
| 187 | |
| 188 | // expand DNS override domain, if non-empty |
| 189 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. != nil && iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. != nil && iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain. != "" { |
| 190 | overrideDomain, err := repl.ReplaceOrErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceOrErr().(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain., true, true) |
| 191 | if err != nil { |
| 192 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("expanding DNS override domain '%s': %v", iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain., err) |
| 193 | } |
| 194 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain. = overrideDomain |
| 195 | } |
| 196 | |
| 197 | // DNS challenge provider, if not already established |
| 198 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. != nil && iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. != nil && iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..solverscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#solver. == nil { |
| 199 | var prov certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.DNSProviderscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSProvider# |
| 200 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..ProviderRawscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#ProviderRaw. != nil { |
| 201 | // a challenge provider has been locally configured - use it |
| 202 | val, err := ctx.LoadModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#LoadModule().(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS., "ProviderRaw") |
| 203 | if err != nil { |
| 204 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("loading DNS provider module: %v", err) |
| 205 | } |
| 206 | prov = val.(certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.DNSProviderscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSProvider#) |
| 207 | } else if tlsAppIface, err := ctx.AppIfConfiguredscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#AppIfConfigured().("tls"); err == nil { |
| 208 | // no locally configured DNS challenge provider, but if there is |
| 209 | // a global DNS module configured with the TLS app, use that |
| 210 | tlsApp := tlsAppIface.(*TLSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLS#) |
| 211 | if tlsApp.dnsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLS#dns. != nil { |
| 212 | prov = tlsApp.dnsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLS#dns..(certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.DNSProviderscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSProvider#) |
| 213 | } |
| 214 | } |
| 215 | if prov == nil { |
| 216 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("DNS challenge enabled, but no DNS provider configured") |
| 217 | } |
| 218 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..solverscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#solver. = &certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.DNS01Solverscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNS01Solver#{ |
| 219 | DNSManagerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNS01Solver#DNSManager.: certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.DNSManagerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#{ |
| 220 | DNSProviderscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#DNSProvider.: prov, |
| 221 | TTLscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#TTL.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..TTLscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#TTL.), |
| 222 | PropagationDelayscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#PropagationDelay.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..PropagationDelayscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#PropagationDelay.), |
| 223 | PropagationTimeoutscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#PropagationTimeout.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..PropagationTimeoutscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#PropagationTimeout.), |
| 224 | Resolversscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#Resolvers.: iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..Resolversscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#Resolvers., |
| 225 | OverrideDomainscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#OverrideDomain.: iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain., |
| 226 | Loggerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/DNSManager#Logger.: iss.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#logger..Namedscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger#Named().("dns_manager"), |
| 227 | }, |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | // add any custom CAs to trust store |
| 232 | if len(iss.TrustedRootsPEMFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TrustedRootsPEMFiles.) > 0 { |
| 233 | iss.rootPoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#rootPool. = x509scip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/.NewCertPoolscip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/NewCertPool().() |
| 234 | for _, pemFile := range iss.TrustedRootsPEMFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TrustedRootsPEMFiles. { |
| 235 | pemData, err := osscip-go gomod github.com/golang/go/src go1.25.1 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.1 os/ReadFile().(pemFile) |
| 236 | if err != nil { |
| 237 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("loading trusted root CA's PEM file: %s: %v", pemFile, err) |
| 238 | } |
| 239 | if !iss.rootPoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#rootPool..AppendCertsFromPEMscip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/CertPool#AppendCertsFromPEM().(pemData) { |
| 240 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("unable to add %s to trust pool: %v", pemFile, err) |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | var err error |
| 246 | iss.templatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#template., err = iss.makeIssuerTemplatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#makeIssuerTemplate().(ctx) |
| 247 | if err != nil { |
| 248 | return err |
| 249 | } |
| 250 | |
| 251 | return nil |
| 252 | } |
| 253 | |
| 254 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) makeIssuerTemplatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#makeIssuerTemplate().(ctx caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Contextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#) (certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#, error) { |
| 255 | template := certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#{ |
| 256 | CAscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#CA.: iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA., |
| 257 | TestCAscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#TestCA.: iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA., |
| 258 | Emailscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#Email.: iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email., |
| 259 | Profilescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#Profile.: iss.Profilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Profile., |
| 260 | AccountKeyPEMscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#AccountKeyPEM.: iss.AccountKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#AccountKey., |
| 261 | CertObtainTimeoutscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#CertObtainTimeout.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(iss.ACMETimeoutscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ACMETimeout.), |
| 262 | TrustedRootsscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#TrustedRoots.: iss.rootPoolscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#rootPool., |
| 263 | ExternalAccountscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#ExternalAccount.: iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount., |
| 264 | NotAfterscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#NotAfter.: timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(iss.CertificateLifetimescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CertificateLifetime.), |
| 265 | Loggerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#Logger.: iss.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#logger., |
| 266 | } |
| 267 | |
| 268 | if len(iss.NetworkProxyRawscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#NetworkProxyRaw.) != 0 { |
| 269 | proxyMod, err := ctx.LoadModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#LoadModule().(iss, "NetworkProxyRaw") |
| 270 | if err != nil { |
| 271 | return template, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("failed to load network_proxy module: %v", err) |
| 272 | } |
| 273 | if m, ok := proxyMod.(caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ProxyFuncProducerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ProxyFuncProducer#); ok { |
| 274 | template.HTTPProxyscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#HTTPProxy. = m.ProxyFuncscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ProxyFuncProducer#ProxyFunc.() |
| 275 | } else { |
| 276 | return template, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("network_proxy module is not `(func(*http.Request) (*url.URL, error))``") |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. != nil { |
| 281 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP. != nil { |
| 282 | template.DisableHTTPChallengescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#DisableHTTPChallenge. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP..Disabledscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#Disabled. |
| 283 | template.AltHTTPPortscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#AltHTTPPort. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP..AlternatePortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#AlternatePort. |
| 284 | } |
| 285 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN. != nil { |
| 286 | template.DisableTLSALPNChallengescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#DisableTLSALPNChallenge. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN..Disabledscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#Disabled. |
| 287 | template.AltTLSALPNPortscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#AltTLSALPNPort. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN..AlternatePortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#AlternatePort. |
| 288 | } |
| 289 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. != nil { |
| 290 | template.DNS01Solverscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#DNS01Solver. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..solverscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#solver. |
| 291 | } |
| 292 | template.ListenHostscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#ListenHost. = iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..BindHostscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#BindHost. |
| 293 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..Distributedscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#Distributed. != nil { |
| 294 | template.DisableDistributedSolversscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#DisableDistributedSolvers. = !*iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..Distributedscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#Distributed. |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | if iss.PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains. != nil { |
| 299 | template.PreferredChainsscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#PreferredChains. = certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ChainPreferencescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ChainPreference#{ |
| 300 | Smallestscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ChainPreference#Smallest.: iss.PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains..Smallestscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#Smallest., |
| 301 | AnyCommonNamescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ChainPreference#AnyCommonName.: iss.PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains..AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName., |
| 302 | RootCommonNamescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ChainPreference#RootCommonName.: iss.PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains..RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName., |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | // ZeroSSL requires EAB, but we can generate that automatically (requires an email address be configured) |
| 307 | if stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.1 strings/HasPrefix().(iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA., "https://acme.zerossl.com/") { |
| 308 | template.NewAccountFuncscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#NewAccountFunc. = func(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, acmeIss *certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.ACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#, acct acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.Accountscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#) (acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.Accountscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#, error) { |
| 309 | if acmeIss.ExternalAccountscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#ExternalAccount. != nil { |
| 310 | return acct, nil |
| 311 | } |
| 312 | var err error |
| 313 | acmeIss.ExternalAccountscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#ExternalAccount., acct, err = iss.generateZeroSSLEABCredentialsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#generateZeroSSLEABCredentials().(ctx, acct) |
| 314 | return acct, err |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | return template, nil |
| 319 | } |
| 320 | |
| 321 | // SetConfig sets the associated certmagic config for this issuer. |
| 322 | // This is required because ACME needs values from the config in |
| 323 | // order to solve the challenges during issuance. This implements |
| 324 | // the ConfigSetter interface. |
| 325 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) SetConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#SetConfig().(cfg *certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.Configscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/Config#) { |
| 326 | iss.magicscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#magic. = cfg |
| 327 | iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer. = certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.NewACMEIssuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/NewACMEIssuer().(cfg, iss.templatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#template.) |
| 328 | } |
| 329 | |
| 330 | // PreCheck implements the certmagic.PreChecker interface. |
| 331 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) PreCheckscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreCheck().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, names []string, interactive bool) error { |
| 332 | return iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer..PreCheckscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#PreCheck().(ctx, names, interactive) |
| 333 | } |
| 334 | |
| 335 | // Issue obtains a certificate for the given csr. |
| 336 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) Issuescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Issue().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, csr *x509scip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/.CertificateRequestscip-go gomod github.com/golang/go/src go1.25.1 `crypto/x509`/CertificateRequest#) (*certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.IssuedCertificatescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/IssuedCertificate#, error) { |
| 337 | return iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer..Issuescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#Issue().(ctx, csr) |
| 338 | } |
| 339 | |
| 340 | // IssuerKey returns the unique issuer key for the configured CA endpoint. |
| 341 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) IssuerKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#IssuerKey().() string { |
| 342 | return iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer..IssuerKeyscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#IssuerKey().() |
| 343 | } |
| 344 | |
| 345 | // Revoke revokes the given certificate. |
| 346 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) Revokescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Revoke().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, cert certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.CertificateResourcescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/CertificateResource#, reason int) error { |
| 347 | return iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer..Revokescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#Revoke().(ctx, cert, reason) |
| 348 | } |
| 349 | |
| 350 | // GetACMEIssuer returns iss. This is useful when other types embed ACMEIssuer, because |
| 351 | // type-asserting them to *ACMEIssuer will fail, but type-asserting them to an interface |
| 352 | // with only this method will succeed, and will still allow the embedded ACMEIssuer |
| 353 | // to be accessed and manipulated. |
| 354 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) GetACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#GetACMEIssuer().() *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer# { return iss } |
| 355 | |
| 356 | // GetRenewalInfo wraps the underlying GetRenewalInfo method and satisfies |
| 357 | // the CertMagic interface for ARI support. |
| 358 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) GetRenewalInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#GetRenewalInfo().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, cert certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.Certificatescip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/Certificate#) (acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.RenewalInfoscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/RenewalInfo#, error) { |
| 359 | return iss.issuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#issuer..GetRenewalInfoscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/ACMEIssuer#GetRenewalInfo().(ctx, cert) |
| 360 | } |
| 361 | |
| 362 | // generateZeroSSLEABCredentials generates ZeroSSL EAB credentials for the primary contact email |
| 363 | // on the issuer. It should only be usedif the CA endpoint is ZeroSSL. An email address is required. |
| 364 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) generateZeroSSLEABCredentialsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#generateZeroSSLEABCredentials().(ctx contextscip-go gomod github.com/golang/go/src go1.25.1 context/.Contextscip-go gomod github.com/golang/go/src go1.25.1 context/Context#, acct acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.Accountscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#) (*acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.EABscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#, acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.Accountscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#, error) { |
| 365 | if stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.1 strings/TrimSpace().(iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email.) == "" { |
| 366 | return nil, acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.Accountscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#{}, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("your email address is required to use ZeroSSL's ACME endpoint") |
| 367 | } |
| 368 | |
| 369 | if len(acct.Contactscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#Contact.) == 0 { |
| 370 | // we borrow the email from config or the default email, so ensure it's saved with the account |
| 371 | acct.Contactscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/Account#Contact. = []string{"mailto:" + iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email.} |
| 372 | } |
| 373 | |
| 374 | endpoint := zerosslscip-go gomod github.com/caddyserver/zerossl v0.1.5 `github.com/caddyserver/zerossl`/.BaseURLscip-go gomod github.com/caddyserver/zerossl v0.1.5 `github.com/caddyserver/zerossl`/BaseURL. + "/acme/eab-credentials-email" |
| 375 | form := urlscip-go gomod github.com/golang/go/src go1.25.1 `net/url`/.Valuesscip-go gomod github.com/golang/go/src go1.25.1 `net/url`/Values#{"email": []string{iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email.}} |
| 376 | body := stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.1 strings/NewReader().(form.Encodescip-go gomod github.com/golang/go/src go1.25.1 `net/url`/Values#Encode().()) |
| 377 | |
| 378 | req, err := httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.NewRequestWithContextscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/NewRequestWithContext().(ctx, httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/MethodPost., endpoint, body) |
| 379 | if err != nil { |
| 380 | return nil, acct, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("forming request: %v", err) |
| 381 | } |
| 382 | req.Headerscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Header#Set().("Content-Type", "application/x-www-form-urlencoded") |
| 383 | req.Headerscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Header#Set().("User-Agent", certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.UserAgentscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/UserAgent.) |
| 384 | |
| 385 | resp, err := httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.DefaultClientscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/DefaultClient..Doscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Client#Do().(req) //nolint:gosec // no SSRF since URL is from trusted config |
| 386 | if err != nil { |
| 387 | return nil, acct, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("performing EAB credentials request: %v", err) |
| 388 | } |
| 389 | defer resp.Bodyscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.25.1 io/Closer#Close().() |
| 390 | |
| 391 | var result struct { |
| 392 | Success bool `json:"success"` |
| 393 | Error struct { |
| 394 | Code int `json:"code"` |
| 395 | Type string `json:"type"` |
| 396 | } `json:"error"` |
| 397 | EABKID string `json:"eab_kid"` |
| 398 | EABHMACKey string `json:"eab_hmac_key"` |
| 399 | } |
| 400 | err = jsonscip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/NewDecoder().(resp.Bodyscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Response#Body.).Decodescip-go gomod github.com/golang/go/src go1.25.1 `encoding/json`/Decoder#Decode().(&result) |
| 401 | if err != nil { |
| 402 | return nil, acct, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("decoding API response: %v", err) |
| 403 | } |
| 404 | if result.Error.Code != 0 { |
| 405 | // do this check first because ZeroSSL's API returns 200 on errors |
| 406 | return nil, acct, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("failed getting EAB credentials: HTTP %d: %s (code %d)", |
| 407 | resp.StatusCodescip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Response#StatusCode., result.Error.Type, result.Error.Code) |
| 408 | } |
| 409 | if resp.StatusCodescip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Response#StatusCode. != httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/StatusOK. { |
| 410 | return nil, acct, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("failed getting EAB credentials: HTTP %d", resp.StatusCodescip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Response#StatusCode.) |
| 411 | } |
| 412 | |
| 413 | if c := iss.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#logger..Checkscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger#Check().(zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/.InfoLevelscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/InfoLevel., "generated EAB credentials"); c != nil { |
| 414 | c.Writescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/CheckedEntry#Write().(zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Stringscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/String().("key_id", result.EABKID)) |
| 415 | } |
| 416 | |
| 417 | return &acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.EABscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#{ |
| 418 | KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID.: result.EABKID, |
| 419 | MACKeyscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#MACKey.: result.EABHMACKey, |
| 420 | }, acct, nil |
| 421 | } |
| 422 | |
| 423 | // UnmarshalCaddyfile deserializes Caddyfile tokens into iss. |
| 424 | // |
| 425 | // ... acme [<directory_url>] { |
| 426 | // dir <directory_url> |
| 427 | // test_dir <test_directory_url> |
| 428 | // email <email> |
| 429 | // profile <profile_name> |
| 430 | // timeout <duration> |
| 431 | // disable_http_challenge |
| 432 | // disable_tlsalpn_challenge |
| 433 | // alt_http_port <port> |
| 434 | // alt_tlsalpn_port <port> |
| 435 | // eab <key_id> <mac_key> |
| 436 | // trusted_roots <pem_files...> |
| 437 | // dns <provider_name> [<options>] |
| 438 | // propagation_delay <duration> |
| 439 | // propagation_timeout <duration> |
| 440 | // resolvers <dns_servers...> |
| 441 | // dns_ttl <duration> |
| 442 | // dns_challenge_override_domain <domain> |
| 443 | // preferred_chains [smallest] { |
| 444 | // root_common_name <common_names...> |
| 445 | // any_common_name <common_names...> |
| 446 | // } |
| 447 | // } |
| 448 | func (iss *ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#) UnmarshalCaddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#UnmarshalCaddyfile().(d *caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/.Dispenserscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#) error { |
| 449 | d.Nextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Next().() // consume issuer name |
| 450 | |
| 451 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 452 | iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA. = d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 453 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 454 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | for d.NextBlockscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextBlock().(0) { |
| 459 | switch d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() { |
| 460 | case "lifetime": |
| 461 | var lifetimeStr string |
| 462 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&lifetimeStr) { |
| 463 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 464 | } |
| 465 | lifetime, err := caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseDurationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseDuration().(lifetimeStr) |
| 466 | if err != nil { |
| 467 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid lifetime %s: %v", lifetimeStr, err) |
| 468 | } |
| 469 | if lifetime < 0 { |
| 470 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("lifetime must be >= 0: %s", lifetime) |
| 471 | } |
| 472 | iss.CertificateLifetimescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CertificateLifetime. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration#(lifetime) |
| 473 | |
| 474 | case "dir": |
| 475 | if iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA. != "" { |
| 476 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("directory is already specified: %s", iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA.) |
| 477 | } |
| 478 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&iss.CAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#CA.) { |
| 479 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 480 | } |
| 481 | |
| 482 | case "test_dir": |
| 483 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&iss.TestCAscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TestCA.) { |
| 484 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 485 | } |
| 486 | |
| 487 | case "email": |
| 488 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&iss.Emailscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Email.) { |
| 489 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 490 | } |
| 491 | |
| 492 | case "profile": |
| 493 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&iss.Profilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Profile.) { |
| 494 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 495 | } |
| 496 | |
| 497 | case "timeout": |
| 498 | var timeoutStr string |
| 499 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&timeoutStr) { |
| 500 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 501 | } |
| 502 | timeout, err := caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseDurationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseDuration().(timeoutStr) |
| 503 | if err != nil { |
| 504 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid timeout duration %s: %v", timeoutStr, err) |
| 505 | } |
| 506 | iss.ACMETimeoutscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ACMETimeout. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration#(timeout) |
| 507 | |
| 508 | case "disable_http_challenge": |
| 509 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 510 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 511 | } |
| 512 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 513 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 514 | } |
| 515 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP. == nil { |
| 516 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP. = new(HTTPChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#) |
| 517 | } |
| 518 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP..Disabledscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#Disabled. = true |
| 519 | |
| 520 | case "disable_tlsalpn_challenge": |
| 521 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 522 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 523 | } |
| 524 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 525 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 526 | } |
| 527 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN. == nil { |
| 528 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN. = new(TLSALPNChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#) |
| 529 | } |
| 530 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN..Disabledscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#Disabled. = true |
| 531 | |
| 532 | case "distributed": |
| 533 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 534 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 535 | } |
| 536 | if d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() != "false" { |
| 537 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("only accepted value is 'false'") |
| 538 | } |
| 539 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 540 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 541 | } |
| 542 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..Distributedscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#Distributed. == nil { |
| 543 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..Distributedscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#Distributed. = new(bool) |
| 544 | } |
| 545 | |
| 546 | case "alt_http_port": |
| 547 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 548 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 549 | } |
| 550 | port, err := strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.1 strconv/Atoi().(d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().()) |
| 551 | if err != nil { |
| 552 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid port %s: %v", d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().(), err) |
| 553 | } |
| 554 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 555 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 556 | } |
| 557 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP. == nil { |
| 558 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP. = new(HTTPChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#) |
| 559 | } |
| 560 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..HTTPscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#HTTP..AlternatePortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/HTTPChallengeConfig#AlternatePort. = port |
| 561 | |
| 562 | case "alt_tlsalpn_port": |
| 563 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 564 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 565 | } |
| 566 | port, err := strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.1 strconv/Atoi().(d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().()) |
| 567 | if err != nil { |
| 568 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid port %s: %v", d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().(), err) |
| 569 | } |
| 570 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 571 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 572 | } |
| 573 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN. == nil { |
| 574 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN. = new(TLSALPNChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#) |
| 575 | } |
| 576 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..TLSALPNscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#TLSALPN..AlternatePortscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/TLSALPNChallengeConfig#AlternatePort. = port |
| 577 | |
| 578 | case "eab": |
| 579 | iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount. = new(acmescip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/.EABscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#) |
| 580 | if !d.AllArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#AllArgs().(&iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..KeyIDscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#KeyID., &iss.ExternalAccountscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#ExternalAccount..MACKeyscip-go gomod github.com/mholt/acmez/v3 v3.1.6 `github.com/mholt/acmez/v3/acme`/EAB#MACKey.) { |
| 581 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 582 | } |
| 583 | |
| 584 | case "trusted_roots": |
| 585 | iss.TrustedRootsPEMFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#TrustedRootsPEMFiles. = d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 586 | |
| 587 | case "dns": |
| 588 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 589 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 590 | } |
| 591 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 592 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 593 | } |
| 594 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 595 | provName := d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 596 | unm, err := caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/.UnmarshalModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/UnmarshalModule().(d, "dns.providers."+provName) |
| 597 | if err != nil { |
| 598 | return err |
| 599 | } |
| 600 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..ProviderRawscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#ProviderRaw. = caddyconfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig`/.JSONModuleObjectscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig`/JSONModuleObject().(unm, "name", provName, nil) |
| 601 | } |
| 602 | |
| 603 | case "propagation_delay": |
| 604 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 605 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 606 | } |
| 607 | delayStr := d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 608 | delay, err := caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseDurationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseDuration().(delayStr) |
| 609 | if err != nil { |
| 610 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid propagation_delay duration %s: %v", delayStr, err) |
| 611 | } |
| 612 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 613 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 614 | } |
| 615 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 616 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 617 | } |
| 618 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..PropagationDelayscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#PropagationDelay. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration#(delay) |
| 619 | |
| 620 | case "propagation_timeout": |
| 621 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 622 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 623 | } |
| 624 | timeoutStr := d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 625 | var timeout timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration# |
| 626 | if timeoutStr == "-1" { |
| 627 | timeout = timescip-go gomod github.com/golang/go/src go1.25.1 time/.Durationscip-go gomod github.com/golang/go/src go1.25.1 time/Duration#(-1) |
| 628 | } else { |
| 629 | var err error |
| 630 | timeout, err = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseDurationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseDuration().(timeoutStr) |
| 631 | if err != nil { |
| 632 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid propagation_timeout duration %s: %v", timeoutStr, err) |
| 633 | } |
| 634 | } |
| 635 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 636 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 637 | } |
| 638 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 639 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 640 | } |
| 641 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..PropagationTimeoutscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#PropagationTimeout. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration#(timeout) |
| 642 | |
| 643 | case "resolvers": |
| 644 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 645 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 646 | } |
| 647 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 648 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 649 | } |
| 650 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..Resolversscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#Resolvers. = d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 651 | if len(iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..Resolversscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#Resolvers.) == 0 { |
| 652 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 653 | } |
| 654 | |
| 655 | case "dns_ttl": |
| 656 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 657 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 658 | } |
| 659 | ttlStr := d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 660 | ttl, err := caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ParseDurationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ParseDuration().(ttlStr) |
| 661 | if err != nil { |
| 662 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("invalid dns_ttl duration %s: %v", ttlStr, err) |
| 663 | } |
| 664 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 665 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 666 | } |
| 667 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 668 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 669 | } |
| 670 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..TTLscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#TTL. = caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Durationscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Duration#(ttl) |
| 671 | |
| 672 | case "dns_challenge_override_domain": |
| 673 | arg := d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 674 | if len(arg) != 1 { |
| 675 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 676 | } |
| 677 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. == nil { |
| 678 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges. = new(ChallengesConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#) |
| 679 | } |
| 680 | if iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. == nil { |
| 681 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS. = new(DNSChallengeConfigscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#) |
| 682 | } |
| 683 | iss.Challengesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#Challenges..DNSscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChallengesConfig#DNS..OverrideDomainscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/DNSChallengeConfig#OverrideDomain. = arg[0] |
| 684 | |
| 685 | case "preferred_chains": |
| 686 | chainPref, err := ParseCaddyfilePreferredChainsOptionsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ParseCaddyfilePreferredChainsOptions().(d) |
| 687 | if err != nil { |
| 688 | return err |
| 689 | } |
| 690 | iss.PreferredChainsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#PreferredChains. = chainPref |
| 691 | |
| 692 | default: |
| 693 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("unrecognized ACME issuer property: %s", d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().()) |
| 694 | } |
| 695 | } |
| 696 | return nil |
| 697 | } |
| 698 | |
| 699 | func ParseCaddyfilePreferredChainsOptionsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ParseCaddyfilePreferredChainsOptions().(d *caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/.Dispenserscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#) (*ChainPreferencescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#, error) { |
| 700 | chainPref := new(ChainPreferencescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#) |
| 701 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 702 | smallestOpt := d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 703 | if smallestOpt == "smallest" { |
| 704 | trueBool := true |
| 705 | chainPref.Smallestscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#Smallest. = &trueBool |
| 706 | if d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { // Only one argument allowed |
| 707 | return nil, d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 708 | } |
| 709 | if d.NextBlockscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextBlock().(d.Nestingscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Nesting().()) { // Don't allow other options when smallest == true |
| 710 | return nil, d.Errscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Err().("No more options are accepted when using the 'smallest' option") |
| 711 | } |
| 712 | } else { // Smallest option should always be 'smallest' or unset |
| 713 | return nil, d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("Invalid argument '%s'", smallestOpt) |
| 714 | } |
| 715 | } |
| 716 | for nesting := d.Nestingscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Nesting().(); d.NextBlockscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextBlock().(nesting); { |
| 717 | switch d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() { |
| 718 | case "root_common_name": |
| 719 | rootCommonNameOpt := d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 720 | chainPref.RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName. = append(chainPref.RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName., rootCommonNameOpt...) |
| 721 | if rootCommonNameOpt == nil { |
| 722 | return nil, d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 723 | } |
| 724 | if chainPref.AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName. != nil { |
| 725 | return nil, d.Errscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Err().("Can't set root_common_name when any_common_name is already set") |
| 726 | } |
| 727 | |
| 728 | case "any_common_name": |
| 729 | anyCommonNameOpt := d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 730 | chainPref.AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName. = append(chainPref.AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName., anyCommonNameOpt...) |
| 731 | if anyCommonNameOpt == nil { |
| 732 | return nil, d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 733 | } |
| 734 | if chainPref.RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName. != nil { |
| 735 | return nil, d.Errscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Err().("Can't set any_common_name when root_common_name is already set") |
| 736 | } |
| 737 | |
| 738 | default: |
| 739 | return nil, d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("Received unrecognized parameter '%s'", d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().()) |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | if chainPref.Smallestscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#Smallest. == nil && chainPref.RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName. == nil && chainPref.AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName. == nil { |
| 744 | return nil, d.Errscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Err().("No options for preferred_chains received") |
| 745 | } |
| 746 | |
| 747 | return chainPref, nil |
| 748 | } |
| 749 | |
| 750 | // ChainPreference describes the client's preferred certificate chain, |
| 751 | // useful if the CA offers alternate chains. The first matching chain |
| 752 | // will be selected. |
| 753 | type ChainPreferencescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference# struct { |
| 754 | // Prefer chains with the fewest number of bytes. |
| 755 | Smallestscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#Smallest. *bool `json:"smallest,omitempty"` |
| 756 | |
| 757 | // Select first chain having a root with one of |
| 758 | // these common names. |
| 759 | RootCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#RootCommonName. []string `json:"root_common_name,omitempty"` |
| 760 | |
| 761 | // Select first chain that has any issuer with one |
| 762 | // of these common names. |
| 763 | AnyCommonNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ChainPreference#AnyCommonName. []string `json:"any_common_name,omitempty"` |
| 764 | } |
| 765 | |
| 766 | // Interface guards |
| 767 | var ( |
| 768 | _ certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.PreCheckerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/PreChecker# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 769 | _ certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.Issuerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/Issuer# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 770 | _ certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.Revokerscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/Revoker# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 771 | _ certmagicscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/.RenewalInfoGetterscip-go gomod github.com/caddyserver/certmagic v0.25.3 `github.com/caddyserver/certmagic`/RenewalInfoGetter# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 772 | _ caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Provisionerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Provisioner# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 773 | _ ConfigSetterscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ConfigSetter# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 774 | _ caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/.Unmarshalerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Unmarshaler# = (*ACMEIssuerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddytls`/ACMEIssuer#)(nil) |
| 775 | ) |