Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddytls: Don't decode HMAC
https://caddy.community/t/trouble-with-external-account-hmac/8600?u=matt
Matthew Holt committed
Jun 11, 2020 at 15:33 UTC
6d03fb48f9189d286733913f189117d3cced3df5
3 files changed
+7
-12
go.mod
+1
-1
@@ -6,7 +6,7 @@ require (
6
github.com/Masterminds/sprig/v3 v3.1.0
7
github.com/alecthomas/chroma v0.7.4-0.20200517063913-500529fd43c1
8
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a
9
- github.com/caddyserver/certmagic v0.11.1
9
+ github.com/caddyserver/certmagic v0.11.2-0.20200611213056-77f91b9bbeea
10
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
11
github.com/go-acme/lego/v3 v3.7.0
12
github.com/go-chi/chi v4.1.2+incompatible
go.sum
+2
-2
@@ -116,8 +116,8 @@ github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTK
116
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
117
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
118
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
119
-github.com/caddyserver/certmagic v0.11.1 h1:rVbT7DIBH3tv2IQHsIyjFXUpCgrMb5KwganVbnJYsrY=
120
-github.com/caddyserver/certmagic v0.11.1/go.mod h1:fqY1IZk5iqhsj5FU3Vw20Sjq66tEKaanTFYNZ74soMY=
119
+github.com/caddyserver/certmagic v0.11.2-0.20200611213056-77f91b9bbeea h1:JTDqzB3+xUJrUoDkA5iHOnuvy4K/s8ibcZV1YpPYfSI=
120
+github.com/caddyserver/certmagic v0.11.2-0.20200611213056-77f91b9bbeea/go.mod h1:fqY1IZk5iqhsj5FU3Vw20Sjq66tEKaanTFYNZ74soMY=
121
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
122
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
123
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
modules/caddytls/acmeissuer.go
+4
-9
@@ -17,7 +17,6 @@ package caddytls
17
import (
18
"context"
19
"crypto/x509"
20
- "encoding/base64"
20
"fmt"
21
"io/ioutil"
22
"net/url"
@@ -141,16 +140,12 @@ func (m *ACMEIssuer) makeIssuerTemplate() (certmagic.ACMEManager, error) {
140
}
141
142
if m.ExternalAccount != nil {
144
- hmac, err := base64.StdEncoding.DecodeString(m.ExternalAccount.EncodedHMAC)
145
- if err != nil {
146
- return template, err
147
- }
148
- if m.ExternalAccount.KeyID == "" || len(hmac) == 0 {
143
+ if m.ExternalAccount.KeyID == "" || m.ExternalAccount.HMAC == "" {
144
return template, fmt.Errorf("when an external account binding is specified, both key ID and HMAC are required")
145
}
146
template.ExternalAccount = &certmagic.ExternalAccountBinding{
147
KeyID: m.ExternalAccount.KeyID,
153
- HMAC: hmac,
148
+ HMAC: m.ExternalAccount.HMAC,
149
}
150
}
151
@@ -238,8 +233,8 @@ type ExternalAccountBinding struct {
233
// The key identifier.
234
KeyID string `json:"key_id,omitempty"`
235
241
- // The base64-encoded HMAC.
242
- EncodedHMAC string `json:"hmac,omitempty"`
236
+ // The HMAC.
237
+ HMAC string `json:"hmac,omitempty"`
238
}
239
240
// Interface guards