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

tidb returns 'Unknown auth plugin' when some old clients didn't set auth plugin in login request #27855

Closed
time-and-fate opened this issue Sep 7, 2021 · 4 comments · Fixed by #27931
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/compatibility

Comments

@time-and-fate
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Use a mysql 5.1 client to connect tidb 5.2

2. What did you expect to see? (Required)

Connect success

3. What did you see instead (Required)

TiDB returns "1105 Unknown auth plugin" error.

4. What is your TiDB version? (Required)

v5.2.0

@time-and-fate time-and-fate added the type/bug The issue is confirmed as a bug. label Sep 7, 2021
@time-and-fate
Copy link
Member Author

/type compatibility

@time-and-fate
Copy link
Member Author

After capturing network traffic, we found that some old clients won't set auth plugin in the login request.
In this case, TiDB will return the "1105 Unknown auth plugin" error but MySQL won't.
This is introduced in #24991.

@dveeden
Copy link
Contributor

dveeden commented Sep 9, 2021

Reproducing this:
TiDB v5.2.0
MySQL Client v5.1.73

Setup:

CREATE USER 'u1'@'%' IDENTIFIED WITH mysql_native_password BY 'abc';
CREATE USER 'u2'@'%' IDENTIFIED WITH caching_sha2_password BY 'abc';

Test:

/home/dvaneeden/opt/mysql/5.1.73/bin/mysql -u u1 -h 127.0.0.1 -P 4000 -pabc -e QUIT
# OK

/home/dvaneeden/opt/mysql/5.1.73/bin/mysql -u u2 -h 127.0.0.1 -P 4000 -pabc -e QUIT
# OK

/home/dvaneeden/opt/mysql/5.1.73/bin/mysql -u u3 -h 127.0.0.1 -P 4000 -pabc -e QUIT
# ERROR 1105 (HY000): Unknown auth plugin

For the tests that didn't give an error this showed up in the logs, and using the connection didn't work:

[2021/09/09 08:26:25.384 +02:00] [WARN] [conn.go:234] ["authSwitchRequest response fail"] [conn=37] [error="[server:8052]invalid sequence 0 != 3"]
[2021/09/09 08:26:25.384 +02:00] [WARN] [conn.go:684] ["failed to check the user authplugin"] [conn=37] [error="[server:8052]invalid sequence 0 != 3"]
[2021/09/09 08:26:28.370 +02:00] [WARN] [conn.go:234] ["authSwitchRequest response fail"] [conn=39] [error="[server:8052]invalid sequence 0 != 3"]
[2021/09/09 08:26:28.370 +02:00] [WARN] [conn.go:684] ["failed to check the user authplugin"] [conn=39] [error="[server:8052]invalid sequence 0 != 3"]
[2021/09/09 08:26:31.248 +02:00] [WARN] [conn.go:234] ["authSwitchRequest response fail"] [conn=41] [error="[server:8052]invalid sequence 0 != 3"]
[2021/09/09 08:26:31.248 +02:00] [WARN] [conn.go:684] ["failed to check the user authplugin"] [conn=41] [error="[server:8052]invalid sequence 0 != 3"]

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants