Skip to content
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 for components #904

Merged
merged 15 commits into from
Feb 21, 2020
Merged

Conversation

july2993
Copy link
Contributor

@july2993 july2993 commented Feb 17, 2020

What problem does this PR solve?

truely support TLS for components.
before this pr if enable TLS for components

  • tidb will fail to connect to pump
  • no TLS between drainer and pump
  • no enable TLS for tikv client in drainer
  • binlogctl can't work actually
    ...

relate docs (Chinese version)

What is changed and how it works?

  • properly handle things about TLS when enabling TLS
  • enable TLS in the integration tests
  • log pump config at startup time

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)
    enable TLS for all components and check replication works, include tidb/tikv/pd/pump/drainer/binlogctl

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository ???
    having not tried using ansible to deploy.
  • Need to be included in the release note

tests/status/run.sh Show resolved Hide resolved
pump/server.go Outdated
@@ -968,14 +966,21 @@ func (s *Server) waitUntilCommitTSSaved(ctx context.Context, ts int64, checkInte
}
}

func listen(network, addr string) (net.Listener, error) {
func listen(network, addr string, tlsConfig *tls.Config) (listener net.Listener, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we may need to update similar code in both pump and drainer, maybe it's time to extract this to the util package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract by 4762c05

@suzaku
Copy link
Contributor

suzaku commented Feb 18, 2020

rest LGTM

@july2993
Copy link
Contributor Author

@GregoryIan PTAL

@july2993
Copy link
Contributor Author

/run-all-tests @GregoryIan PTAL

@july2993
Copy link
Contributor Author

/run-all-tests

@july2993
Copy link
Contributor Author

/run-all-tests

@july2993
Copy link
Contributor Author

/run-all-tests

@july2993
Copy link
Contributor Author

/run-all-tests

@july2993
Copy link
Contributor Author

/run-all-tests

binlogctl/global.go Outdated Show resolved Hide resolved
switch cfg.Command {
case ctl.GenerateMeta:
err = ctl.GenerateMetaInfo(cfg)
case ctl.QueryPumps:
err = ctl.QueryNodesByKind(cfg.EtcdURLs, node.PumpNode, cfg.ShowOfflineNodes)
err = ctl.QueryNodesByKind(cfg.EtcdURLs, node.PumpNode, cfg.ShowOfflineNodes, cfg.TLS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should initial all clients (like registry, dial Client) together, the reason is to ensure that TLS are processed correctly and uniformly, here implementation is a weird example:

  • we provide TLS config in interface of github.com/pingcap/tidb-binlog/binlogctl, like QueryNodesByKind
  • we do binlogctl.InitHTTPSClient separately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -72,6 +72,8 @@ func (c *Config) ToTiDBSecurityConfig() config.Security {
ClusterSSLKey: c.SSLKey,
}

// The TiKV client(kvstore.New) we use will use this global var as the TLS config.
// TODO avoid such magic implicit change when call this func.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO 👍

suzaku
suzaku previously approved these changes Feb 21, 2020
Copy link
Contributor

@suzaku suzaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

tests/run.sh Outdated
sleep 1
done


# on CI curl's version is too old: curl: (58) unable to load client key: -8178 (SEC_ERROR_BAD_KEY)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove it now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed dfe4e41

Copy link
Collaborator

@IANTHEREAL IANTHEREAL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@july2993
Copy link
Contributor Author

/run-all-tests

@july2993 july2993 merged commit 0bd1881 into pingcap:master Feb 21, 2020
@july2993 july2993 deleted the tls_component_test branch February 21, 2020 06:27
@sre-bot
Copy link

sre-bot commented Feb 21, 2020

cherry pick to release-3.0 failed

july2993 added a commit that referenced this pull request Mar 15, 2020
truely support TLS for components.
before this pr if enable TLS for components

- `tidb` will fail to connect to `pump`
- no TLS between drainer and pump
- no enable TLS for tikv client in `drainer`
- `binlogctl` can't work actually
...

[relate docs](https://pingcap.com/docs/stable/how-to/secure/enable-tls-between-components/) ([Chinese version](https://pingcap.com/docs-cn/stable/how-to/secure/enable-tls-between-components/))
This Commit:
- properly handle things about TLS when enabling TLS
- enable TLS in the integration tests
- log pump config at startup time
IANTHEREAL pushed a commit that referenced this pull request Mar 17, 2020
* support TLS for components (#904)


[relate docs](https://pingcap.com/docs/stable/how-to/secure/enable-tls-between-components/) ([Chinese version](https://pingcap.com/docs-cn/stable/how-to/secure/enable-tls-between-components/))
This Commit:
- properly handle things about TLS when enabling TLS
- enable TLS in the integration tests
- log pump config at startup time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants