-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
*: support TLS cipher suite whitelist #9801
Conversation
1e1a4d8
to
4ffd31d
Compare
Codecov Report
@@ Coverage Diff @@
## master #9801 +/- ##
==========================================
+ Coverage 69.58% 69.63% +0.04%
==========================================
Files 376 377 +1
Lines 35229 35263 +34
==========================================
+ Hits 24514 24554 +40
+ Misses 8954 8950 -4
+ Partials 1761 1759 -2
Continue to review full report at Codecov.
|
/cc @liggitt |
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.
Looks good to me, just a couple places that could benefit from some branching logic cleanup.
embed/config.go
Outdated
} | ||
return updateCipherSuites(&cfg.ClientTLSInfo, cfg.ClientCipherSuites) | ||
} | ||
if cfg.ClientAutoTLS { |
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.
Since you're already modifying the logic here, could we simplify this method to just have if !cfg.ClientAutoTLS { return nil }
at the top? It would remove this if
on 743 and simplify the check above.
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.
Good point! Will update.
embed/config.go
Outdated
} | ||
return updateCipherSuites(&cfg.PeerTLSInfo, cfg.PeerCipherSuites) | ||
} | ||
if cfg.PeerAutoTLS { |
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.
Similar change here as above, just start with if !cfg.PeerAutoTLS { return nil }
, and remove that check for the rest of the method.
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.
Do you need two flags? Maybe just have one that restricts all endpoint and client uses?
embed/config.go
Outdated
// ClientCipherSuites is a list of supported cipher suites between server and client. | ||
// If empty, Go auto-populates it by default. | ||
// Note that cipher suites are prioritized in the given order. | ||
ClientCipherSuites []string `json:"client-cipher-suites"` |
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 does this have a JSON tag?
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.
We have YAML configuration file format, which uses json tag to read flag values.
As @ericchiang suggested, will be switching to one shared flag both for server and client side. |
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
Signed-off-by: Gyuho Lee <[email protected]>
if err != nil { | ||
return err | ||
} | ||
return updateCipherSuites(&cfg.PeerTLSInfo, cfg.CipherSuites) |
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.
updateCipherSuites fails if called with non-empty ciphers twice, right?
in configurePeerListeners(), we call updateCipherSuites() and then call PeerSelfCert(), which also calls updateCipherSuites(). doesn't that mean we will fail if cfg.PeerAutoTLS and cfg.CipherSuites are both set?
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.
@liggitt transport.SelfCert
initializes cfg.PeerTLSInfo.CipherSuites
as empty, so this should be safe?
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.
@liggitt transport.SelfCert initializes cfg.PeerTLSInfo.CipherSuites as empty, so this should be safe?
ok, didn't trace it past these two methods, was just looking at the config inputs
Fail TLS handshake when client hello is requested with invalid cipher suites.
Succeeds if client requests with matching or empty cipher suites.
Fix #8320.