cmd/derper: in manual cert mode, don't discard error from VerifyHostname

Updates #3701

Change-Id: If8ca5104bd8221c99cc390ca49ee3401aff09b62
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/3709/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent b1b0fd119b
commit b8ad90c2bf

@ -67,8 +67,8 @@ func NewManualCertManager(certdir, hostname string) (certProvider, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("can not load cert: %w", err) return nil, fmt.Errorf("can not load cert: %w", err)
} }
if x509Cert.VerifyHostname(hostname) != nil { if err := x509Cert.VerifyHostname(hostname); err != nil {
return nil, errors.New("refuse to load cert: hostname mismatch with key") return nil, fmt.Errorf("cert invalid for hostname %q: %w", hostname, err)
} }
return &manualCertManager{cert: &cert, hostname: hostname}, nil return &manualCertManager{cert: &cert, hostname: hostname}, nil
} }

Loading…
Cancel
Save