Skip to content

Commit 0c34fe9

Browse files
trevordixonFiloSottile
authored andcommitted
acme/autocert: include the domain in the SAN of the CSR
More compliant with the spec and allows autocert to work with Pebble (see letsencrypt/pebble#304). Fixes golang/go#39746. Change-Id: I0f41d5b41800d57eb53055cad248e50573c6070f GitHub-Last-Rev: 777115c GitHub-Pull-Request: #143 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/294389 Reviewed-by: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
1 parent 513c2a4 commit 0c34fe9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

acme/autocert/autocert.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1133,11 +1133,11 @@ func (s *certState) tlscert() (*tls.Certificate, error) {
11331133
}, nil
11341134
}
11351135

1136-
// certRequest generates a CSR for the given common name cn and optional SANs.
1137-
func certRequest(key crypto.Signer, cn string, ext []pkix.Extension, san ...string) ([]byte, error) {
1136+
// certRequest generates a CSR for the given common name.
1137+
func certRequest(key crypto.Signer, name string, ext []pkix.Extension) ([]byte, error) {
11381138
req := &x509.CertificateRequest{
1139-
Subject: pkix.Name{CommonName: cn},
1140-
DNSNames: san,
1139+
Subject: pkix.Name{CommonName: name},
1140+
DNSNames: []string{name},
11411141
ExtraExtensions: ext,
11421142
}
11431143
return x509.CreateCertificateRequest(rand.Reader, req, key)

acme/autocert/autocert_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ func TestCertRequest(t *testing.T) {
10971097
Id: asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1},
10981098
Value: []byte("dummy"),
10991099
}
1100-
b, err := certRequest(key, "example.org", []pkix.Extension{ext}, "san.example.org")
1100+
b, err := certRequest(key, "example.org", []pkix.Extension{ext})
11011101
if err != nil {
11021102
t.Fatalf("certRequest: %v", err)
11031103
}

0 commit comments

Comments
 (0)