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

auth: sha256_password plugin with unix transport not working #1245

Closed
santhosh-tekuri opened this issue Aug 5, 2021 · 3 comments
Closed

Comments

@santhosh-tekuri
Copy link
Contributor

I have configured mysql user as below:

CREATE USER 'sha256_user'@'%' IDENTIFIED WITH sha256_password BY 'sha256_secret';

now when i connect to mysql using mysql.sock file, authentication fails. I get following error:

Error 1045: Access denied for user 'sha256_user'@'localhost' (using password: YES)

i debugged driver code, and found that we are sending password in cleartext if it is unix transport. instead if we send encrypted on unix transport it succeeds.

to be precise, if we change auth.go:277
from:

if mc.cfg.tls != nil || mc.cfg.Net == "unix" {

to:

if mc.cfg.tls != nil {

it works.

@santhosh-tekuri
Copy link
Contributor Author

i am using mysql 8.0.26

@methane
Copy link
Member

methane commented Aug 6, 2021

I confirmed.

caching_sha2_password uses cleartext password when the connection is Unix or sharedmemory protocol.
But sha256_password don't.

@santhosh-tekuri
Copy link
Contributor Author

i will send pull request for the same.

@methane methane closed this as completed Aug 24, 2021
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

No branches or pull requests

2 participants