-
Notifications
You must be signed in to change notification settings - Fork 338
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
feat: mysql and pg server support tls #641
Conversation
@sunng87 @MichaelScofield Lack of testing for now. Can I add integration test which use |
Codecov Report
@@ Coverage Diff @@
## develop #641 +/- ##
===========================================
+ Coverage 86.32% 86.38% +0.05%
===========================================
Files 406 407 +1
Lines 51351 51524 +173
===========================================
+ Hits 44330 44508 +178
+ Misses 7021 7016 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
More on mysql and postgres ssl configuration: |
@SSebo Is ssl supported in those client libraries we are using for testing? Using |
for |
@sunng87 I found there is no way to force pgwire to reject connect if TlsAcceptor is supplied but client want to connect normally. This is used for |
@SSebo perhaps we can reject the client by checking its ssl state in startup handler. When the client sends its |
@SSebo I confirmed postgres enforces this check when handling This is how postgresql receives startup message and responds plain text connection when ssl is enforced.
|
@sunng87 Since we should handle the plain client connect to secure required server as the real server, how about we put the logic in |
@SSebo I realized that In real world, this ssl policy is a little complex,it involves tuple of host, user and database to decide if ssl is to be enforced. It's better to be implemented where these three entities are defined and provided. So the problem is we need to customize mysql connection handshake (or startup) process. We have another issue #600 can be related to this as well. But for now I think it's ok to simply drop the plain connection to move on. We can resolve that in future PR |
@sunng87 mysql and pg both covered by unit test. |
@SSebo Look almost good to me! Please check these two minor comments. @MichaelScofield Please take a look as well. Thank you! |
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.
What a good job! Thanks a lot. I have a few comments, PTAL.
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. Almost done, Good job.
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, ping me if you resolve the remaining comments, and I'll merge this PR, thx!
@SSebo There is also a code format issue, https://github.com/GreptimeTeam/greptimedb/actions/runs/3580016212/jobs/6021767404 |
got it. |
@SSebo Congrats on your first PR! Thanks a lot. |
Congratulations! Thanks for your effort! This is a big step for enabling greptimedb in shared environment. |
* feat: mysql and pg server support tls * chore: replace opensrv-mysql to original * chore: TlsOption is required but supply default value * feat: mysql server support force tls * chore: move TlsOption to servers * test: mysql server disable / prefer / required tls mode * test: pg server disable / prefer / required tls mode * chore: add doc and remove no used code * chore: add TODO and restore cargo linker config
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
add tls support for mysql and pg
Please explain IN DETAIL what the changes are in this PR and why they are needed:
TlsOption
to save cert and key path, can also generaterustls::ServerConfig
opensrv_mysql
pgwire
Checklist
Refer to a related PR or issue link (optional)
#515