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

*: new tls configuration for operator #80

Merged
merged 18 commits into from
Sep 15, 2022
Merged

*: new tls configuration for operator #80

merged 18 commits into from
Sep 15, 2022

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Sep 9, 2022

Signed-off-by: xhe xw897002528@gmail.com

What problem does this PR solve?

Issue Number: ref #69, ref #64

Problem Summary: TLS refine

What is changed and how it works:

  1. use cluster-tls for cluster client secret
  2. use server-tls for sql port, HTTP port
  3. use sql-tls to connect TiDB sql port
  4. use peer-tls for peer communication
  5. add skip-ca, auto-certs
  6. also apply these TLS config really, e.g. etcd will listen https if set server-tls, will check TiDB health by https if cluster-tls set
  7. modify config manager to used etcd server instead of etcd client. Because if user pass a CA to server-tls, connect to 2379 may fail
  8. use InsecureSkipVerify for CreateTLSConfigForTest, use DNS serverAddr instead of backendIO.RemoteAddr().String() if possible
  9. fix a bug in newtidb logger that additional fields are not appended correct:
[xxxx] // before
[xxxx] [x1=] [x2=] // fixed

The tidb encoder will append like so:

[xxxxx] additional fields

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
Tested in k8s
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@xhebox xhebox marked this pull request as ready for review September 13, 2022 03:20
@xhebox xhebox changed the title *: new tls configuration for operator[WIP] *: new tls configuration for operator Sep 13, 2022
@xhebox xhebox marked this pull request as draft September 13, 2022 04:20
@xhebox xhebox marked this pull request as ready for review September 13, 2022 07:50
@xhebox xhebox changed the title *: new tls configuration for operator [DNM] *: new tls configuration for operator Sep 13, 2022
@xhebox xhebox marked this pull request as draft September 13, 2022 07:58
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox changed the title [DNM] *: new tls configuration for operator *: new tls configuration for operator Sep 14, 2022
@xhebox xhebox marked this pull request as ready for review September 14, 2022 12:09
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox marked this pull request as draft September 14, 2022 14:16
Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox marked this pull request as ready for review September 14, 2022 16:49
Signed-off-by: xhe <xw897002528@gmail.com>
lib/util/security/tls.go Outdated Show resolved Hide resolved
pkg/manager/config/manager.go Outdated Show resolved Hide resolved
copy(end, key)
for i := len(end) - 1; i >= 0; i-- {
if end[i] < 0xff {
end[i] = end[i] + 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this mean?
If you get the prefix of a string, why not just use string functions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy from etcd server source, in short the next nextLargestKey. It is not related to string or whatever.

pkg/manager/config/manager_test.go Outdated Show resolved Hide resolved
pkg/manager/config/proxy_test.go Outdated Show resolved Hide resolved
pkg/manager/namespace/manager.go Outdated Show resolved Hide resolved
pkg/manager/namespace/manager.go Outdated Show resolved Hide resolved
pkg/proxy/backend/authenticator.go Outdated Show resolved Hide resolved
xhebox and others added 2 commits September 15, 2022 12:25
Co-authored-by: djshow832 <zhangming@pingcap.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@djshow832 djshow832 merged commit d7f1885 into pingcap:main Sep 15, 2022
This was referenced Sep 15, 2022
@xhebox xhebox deleted the tls branch November 2, 2022 08:51
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 7, 2023
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants