-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: fix TLS cases #128
*: fix TLS cases #128
Conversation
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@@ -124,7 +126,12 @@ func (ci *certInfo) customizeTLSConfig(tlsConfig *tls.Config) *tls.Config { | |||
} | |||
} else { | |||
tlsConfig.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { | |||
return ci.getCertificate(), nil | |||
cert := ci.getCertificate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not return the emptyCert
in the getCertificate
? It will also work when ci.isServer==true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetCertificate
and GetClientCertificate
has different requirements. I mean GetCertificate
should return nil. Moreover, on server-side tls config, it is promised to be nil if certs are nil.
@@ -124,7 +126,12 @@ func (ci *certInfo) customizeTLSConfig(tlsConfig *tls.Config) *tls.Config { | |||
} | |||
} else { | |||
tlsConfig.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { | |||
return ci.getCertificate(), nil | |||
cert := ci.getCertificate() | |||
if cert == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is cert == nil
? If the tlsConfig is nil, it won't come here. If the tlsConfig is not nil, can cert
be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A tls config with only CA, or even without CA insecureSkipVerify
. This is client only behavior.
Signed-off-by: xhe xw897002528@gmail.com
What problem does this PR solve?
Issue Number: close None
Problem Summary: If server enables TLS, but we don't have certs to complete TLS handshake, there is a panic.
What is changed and how it works:
backendTLSConfig
GetClientCertificate
Check List
Tests
Notable changes
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.