From 37e4cdbbe60db486193f1cac65e45c2f1dacf0c9 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Mon, 23 Aug 2021 23:07:44 +0100
Subject: [PATCH] Update only certmagic (#16790)

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: jolheiser <john.olheiser@gmail.com>
---
 go.mod                                        |  2 +-
 go.sum                                        |  4 +--
 .../caddyserver/certmagic/config.go           | 26 ++++++++++++-------
 vendor/modules.txt                            |  2 +-
 4 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/go.mod b/go.mod
index 40f6ade2bd..8048393d96 100644
--- a/go.mod
+++ b/go.mod
@@ -22,7 +22,7 @@ require (
 	github.com/blevesearch/bleve/v2 v2.0.6
 	github.com/boombuler/barcode v1.0.1 // indirect
 	github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
-	github.com/caddyserver/certmagic v0.14.0
+	github.com/caddyserver/certmagic v0.14.1
 	github.com/chi-middleware/proxy v1.1.1
 	github.com/couchbase/go-couchbase v0.0.0-20210224140812-5740cd35f448 // indirect
 	github.com/couchbase/gomemcached v0.1.2 // indirect
diff --git a/go.sum b/go.sum
index 64d44eb34a..6a86f033fe 100644
--- a/go.sum
+++ b/go.sum
@@ -184,8 +184,8 @@ github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
 github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0=
 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
-github.com/caddyserver/certmagic v0.14.0 h1:XW1o32s7smIYEJSc6g+N8YXljpjRo5ZE2zi3CIYTs74=
-github.com/caddyserver/certmagic v0.14.0/go.mod h1:oRQOZmUVKwlpgNidslysHt05osM9uMrJ4YMk+Ot4P4Q=
+github.com/caddyserver/certmagic v0.14.1 h1:8RIFS/LbGne/I7Op56Kkm2annnei7io9VW/IWDttE9U=
+github.com/caddyserver/certmagic v0.14.1/go.mod h1:oRQOZmUVKwlpgNidslysHt05osM9uMrJ4YMk+Ot4P4Q=
 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
 github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
diff --git a/vendor/github.com/caddyserver/certmagic/config.go b/vendor/github.com/caddyserver/certmagic/config.go
index cce969b8bd..d408418f65 100644
--- a/vendor/github.com/caddyserver/certmagic/config.go
+++ b/vendor/github.com/caddyserver/certmagic/config.go
@@ -508,8 +508,10 @@ func (cfg *Config) obtainCert(ctx context.Context, name string, interactive bool
 		var issuedCert *IssuedCertificate
 		var issuerUsed Issuer
 		for i, issuer := range issuers {
-			log.Debug(fmt.Sprintf("trying issuer %d/%d", i+1, len(cfg.Issuers)),
-				zap.String("issuer", issuer.IssuerKey()))
+			if log != nil {
+				log.Debug(fmt.Sprintf("trying issuer %d/%d", i+1, len(cfg.Issuers)),
+					zap.String("issuer", issuer.IssuerKey()))
+			}
 
 			if prechecker, ok := issuer.(PreChecker); ok {
 				err = prechecker.PreCheck(ctx, []string{name}, interactive)
@@ -531,10 +533,12 @@ func (cfg *Config) obtainCert(ctx context.Context, name string, interactive bool
 			if errors.As(err, &problem) {
 				errToLog = problem
 			}
-			log.Error("could not get certificate from issuer",
-				zap.String("identifier", name),
-				zap.String("issuer", issuer.IssuerKey()),
-				zap.Error(errToLog))
+			if log != nil {
+				log.Error("could not get certificate from issuer",
+					zap.String("identifier", name),
+					zap.String("issuer", issuer.IssuerKey()),
+					zap.Error(errToLog))
+			}
 		}
 		if err != nil {
 			// only the error from the last issuer will be returned, but we logged the others
@@ -745,10 +749,12 @@ func (cfg *Config) renewCert(ctx context.Context, name string, force, interactiv
 			if errors.As(err, &problem) {
 				errToLog = problem
 			}
-			log.Error("could not get certificate from issuer",
-				zap.String("identifier", name),
-				zap.String("issuer", issuer.IssuerKey()),
-				zap.Error(errToLog))
+			if log != nil {
+				log.Error("could not get certificate from issuer",
+					zap.String("identifier", name),
+					zap.String("issuer", issuer.IssuerKey()),
+					zap.Error(errToLog))
+			}
 		}
 		if err != nil {
 			// only the error from the last issuer will be returned, but we logged the others
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9b2a96ad53..96fec6a8b9 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -194,7 +194,7 @@ github.com/boombuler/barcode/utils
 # github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
 ## explicit
 github.com/bradfitz/gomemcache/memcache
-# github.com/caddyserver/certmagic v0.14.0
+# github.com/caddyserver/certmagic v0.14.1
 ## explicit
 github.com/caddyserver/certmagic
 # github.com/cespare/xxhash/v2 v2.1.1