-
Notifications
You must be signed in to change notification settings - Fork 5.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
server: support check the "CommanName" of tls-cert for status-port(http/grpc) #15137
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15137 +/- ##
===========================================
Coverage 80.2595% 80.2595%
===========================================
Files 503 503
Lines 132388 132388
===========================================
Hits 106254 106254
Misses 17737 17737
Partials 8397 8397 |
server/http_status.go
Outdated
@@ -310,6 +312,32 @@ func (s *Server) setupStatusServerAndRPCServer(addr string, serverMux *http.Serv | |||
} | |||
} | |||
|
|||
func (s *Server) setCNChecker(tlsConfig *tls.Config) *tls.Config { | |||
if tlsConfig != nil && len(s.cfg.Security.ClusterVerifyCN) > 0 { | |||
cns := strings.Split(s.cfg.Security.ClusterVerifyCN, ",") |
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.
It would be great if we could parse these configurations ahead of time. This value is essentially an array of strings. Another method of configuration (API Call or testing interface) would like to actually give an array. Actually, TOML supports arrays as well, so it seems like only the CLI would need to give an unparsed string?
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.
yes, it's better using arrays, we don't need cli or sysvar, changed
func (ts *tidbTestSuite) TestStatusAPIWithTLSCNCheck(c *C) { | ||
c.Skip("need add ca-tidb-test-1.crt to OS") | ||
root := filepath.Join(os.Getenv("GOPATH"), "/src/github.com/pingcap/tidb") | ||
ca := filepath.Join(root, "/tests/cncheckcert/ca-tidb-test-1.crt") |
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.
This test really could not pass on windows :-)
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.
yes, this case also need install ca to operation system for linuxer, so c.Skip
at this time 😞
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.
LGTM
/merge |
/run-all-tests |
@lysu merge failed. |
/rebuild |
cherry pick to release-3.0 in PR #15164 |
Signed-off-by: sre-bot <[email protected]>
cherry pick to release-3.1 in PR #15165 |
What problem does this PR solve?
add CN check for TiDB's http/grpc API
What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release note
This change is