Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
tls: Few minor improvements/simplifications
Matthew Holt committed
Mar 23, 2020 at 13:32 UTC
169883868503c809c9ac9c8c1fe93c7deff9cd2e
3 files changed
+8
-5
cmd/commandfuncs.go
+4
@@ -189,6 +189,10 @@ func cmdRun(fl Flags) (int, error) {
189
cleanModVersion := strings.TrimPrefix(goModule.Version, "v")
190
certmagic.UserAgent = "Caddy/" + cleanModVersion
191
192
+ // by using Caddy, user indicates agreement to CA terms
193
+ // (very important, or ACME account creation will fail!)
194
+ certmagic.DefaultACME.Agreed = true
195
+
196
// run the initial config
197
err = caddy.Load(config, true)
198
if err != nil {
modules/caddytls/acmeissuer.go
-1
@@ -116,7 +116,6 @@ func (m *ACMEIssuer) makeIssuerTemplate() certmagic.ACMEManager {
116
template := certmagic.ACMEManager{
117
CA: m.CA,
118
Email: m.Email,
119
- Agreed: true,
119
CertObtainTimeout: time.Duration(m.ACMETimeout),
120
TrustedRoots: m.rootPool,
121
}
modules/caddytls/automation.go
+4
-4
@@ -154,7 +154,7 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
154
}
155
156
// if this automation policy has no Issuer defined, and
157
- // none the subjects do not qualify for a public certificate,
157
+ // none of the subjects qualify for a public certificate,
158
// set the issuer to internal so that these names can all
159
// get certificates; critically, we can only do this if an
160
// issuer is not explictly configured (IssuerRaw, vs. just
@@ -198,7 +198,7 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
198
KeySource: keySource,
199
OnDemand: ond,
200
Storage: storage,
201
- Issuer: ap.Issuer, // if nil, certmagic.New() will set default in returned Config
201
+ Issuer: ap.Issuer, // if nil, certmagic.New() will create one
202
}
203
if rev, ok := ap.Issuer.(certmagic.Revoker); ok {
204
template.Revoker = rev
@@ -210,8 +210,8 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
210
// access to the correct storage and cache so it can solve
211
// ACME challenges -- it's an annoying, inelegant circular
212
// dependency that I don't know how to resolve nicely!)
213
- if configger, ok := ap.Issuer.(ConfigSetter); ok {
214
- configger.SetConfig(ap.magic)
213
+ if annoying, ok := ap.Issuer.(ConfigSetter); ok {
214
+ annoying.SetConfig(ap.magic)
215
}
216
217
return nil