-
Notifications
You must be signed in to change notification settings - Fork 6.1k
privilege, server: support LDAP authentication (#43582) #43696
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
privilege, server: support LDAP authentication (#43582) #43696
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
|
/retest-required |
Please update the test result |
|
/retest |
4 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/retest |
|
/merge |
|
@bb7133: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
bb7133
left a comment
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
|
LGTM |
|
/merge |
|
@bb7133: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: edf8bf4 |
This is an automated cherry-pick of #43582
What problem does this PR solve?
Issue Number: close #43580
Problem Summary:
Support LDAP authentication in TiDB.
What is changed and how it works?
binding with LDAP server, with simple method or SASL method.This PR has some know issues, and will be fixed in the following PR:
authentication_ldap_{simple,sasl}_max_pool_sizehas no meaning. Maybe we should use a singleauthentication_ldap_{simple,sasl}_pool_sizevariable to replaceinitandmaxpool size, if we don't support auto scaling? I'm not sure whether it's needed actually.Check List
Tests
Here is the guide for manually test:
Manual Test Instruction
Here is a guide to manually test the following functions. To help the reviewer test this function, I have prepared a docker image to setup the LDAP server environment. It will use port
389and3306to setup a LDAP server and a percona server (as reference). You can execute the following commands and don't exit the shell. It's also suggested to use themysqlclient in this docker image, in case that your local mysql client doesn't support LDAP authentication (or don't have related dependencies installed):To test this PR, you'll need to compile the tidb server and execute it. I assume the TiDB server runs with default configuration and listens port 4000.
Then we need to set some basic variables to make LDAP work:
Simple LDAP authentication
yangkeao. The password is123456.Login successfully. It means the simple LDAP authentication method really works!
LDAP SASL authentication (SCRAM-SHA-1/256)
yangkeao. As the LDAP SASL method usesauthentication_ldap_sasl_clientplugin, but notclear_textplugin, so you don't need to enable theclear_textplugin with environment variables:Login successfully. It means the SASL LDAP authentication method really works!
SCRAM-SHA-1). For example:mysql -h 127.0.0.1 -u yangkeao -P 4000 -p123456, you'll get the same result.StartTLS
TiDB also support using TLS connection between tidb-server and LDAP server (NOTE: LDAP over SSL is not supported, like MySQL). The CA certificate locates in
/etc/ssl/certs/example.crtin the container. You can copy it to anywhere the TiDB server can read. For example, I copied it to/tmp/ca.crt:Then configure the TiDB to use StartTLS to connect to the LDAP:
Then you can login the user
yangkeaowith the StartTLS:NOTE: this certificate is signed for
localhostand127.0.0.1. Using it on other host will refuse to login.Release note