Skip to content

Commit

Permalink
transport: accept connection if matched IP SAN but no DNS match
Browse files Browse the repository at this point in the history
The IP SAN check would always do a DNS SAN check if DNS is given
and the connection's IP is verified. Instead, don't check DNS
entries if there's a matching iP.

Fixes etcd-io#8206
  • Loading branch information
heyitsanthony committed Jul 6, 2017
1 parent 2e76152 commit ab95eb0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/transport/listener_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ func checkCertSAN(ctx context.Context, cert *x509.Certificate, remoteAddr string
return herr
}
if len(cert.IPAddresses) > 0 {
if cerr := cert.VerifyHostname(h); cerr != nil && len(cert.DNSNames) == 0 {
cerr := cert.VerifyHostname(h)
if cerr == nil {
return nil
}
if len(cert.DNSNames) == 0 {
return cerr
}
}
Expand Down

0 comments on commit ab95eb0

Please sign in to comment.