mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 22:21:41 +00:00
ipn/ipnlocal: include DNS SAN in cert CSR (#14764)
The CN field is technically deprecated; set the requested name in a DNS SAN extension in addition to maximise compatibility with RFC 8555. Fixes #14762 Change-Id: If5d27f1e7abc519ec86489bf034ac98b2e613043 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
This commit is contained in:
parent
d69c70ee5b
commit
69bc164c62
@ -556,6 +556,7 @@ func (b *LocalBackend) getCertPEM(ctx context.Context, cs certStore, logf logger
|
|||||||
}
|
}
|
||||||
|
|
||||||
logf("requesting cert...")
|
logf("requesting cert...")
|
||||||
|
traceACME(csr)
|
||||||
der, _, err := ac.CreateOrderCert(ctx, order.FinalizeURL, csr, true)
|
der, _, err := ac.CreateOrderCert(ctx, order.FinalizeURL, csr, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("CreateOrder: %v", err)
|
return nil, fmt.Errorf("CreateOrder: %v", err)
|
||||||
@ -578,10 +579,10 @@ func (b *LocalBackend) getCertPEM(ctx context.Context, cs certStore, logf logger
|
|||||||
}
|
}
|
||||||
|
|
||||||
// certRequest generates a CSR for the given common name cn and optional SANs.
|
// certRequest generates a CSR for the given common name cn and optional SANs.
|
||||||
func certRequest(key crypto.Signer, cn string, ext []pkix.Extension, san ...string) ([]byte, error) {
|
func certRequest(key crypto.Signer, name string, ext []pkix.Extension) ([]byte, error) {
|
||||||
req := &x509.CertificateRequest{
|
req := &x509.CertificateRequest{
|
||||||
Subject: pkix.Name{CommonName: cn},
|
Subject: pkix.Name{CommonName: name},
|
||||||
DNSNames: san,
|
DNSNames: []string{name},
|
||||||
ExtraExtensions: ext,
|
ExtraExtensions: ext,
|
||||||
}
|
}
|
||||||
return x509.CreateCertificateRequest(rand.Reader, req, key)
|
return x509.CreateCertificateRequest(rand.Reader, req, key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user