Skip to content

Commit 777115c

Browse files
committed
Include the domain in the SAN of the CSR
Allows autocert to work with Pebble (see letsencrypt/pebble#304).
1 parent 513c2a4 commit 777115c

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)