Bug #114856 | Odd errors after starting mysqld with ssl_mode=disabled in my.cnf | ||
---|---|---|---|
Submitted: | 2 May 2024 16:32 | Modified: | 22 May 2024 7:06 |
Reporter: | Mark Callaghan | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Security: Encryption | Severity: | S2 (Serious) |
Version: | 8.4.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[2 May 2024 16:32]
Mark Callaghan
[2 May 2024 16:50]
Mark Callaghan
I then add this to my.cnf: --- [mysqld] mysql_native_password=ON [client] ssl_mode=disabled default_auth=mysql_native_password But that does not change the behavior when I try to connect via TCP via either of: bin/mysql -uroot -ppw -h127.0.0.1 bin/mysql -uroot -ppw -h127.0.0.1 --default-auth=mysql_native_password
[3 May 2024 21:25]
Evan Elias
Hi Mark! Out of curiosity, does adding the --get-server-public-key option consistently fix the non-SSL situation for you? https://dev.mysql.com/doc/refman/8.4/en/connection-options.html#option_general_get-server-... I was having some similar issues yesterday using 8.4.0 client with --ssl-mode=disabled when native auth was disabled, and --get-server-public-key seemed to fix it. If I understand correctly, when using caching_sha2_password, you must have one of the following: a) secure connection, or b) client provides a specific intended server public key (--server-public-key-path), or c) client explicitly requests the server public key (--get-server-public-key) That said, it doesn't explain the caching oddity you're seeing. fwiw I am also seeing some other weird auth randomness in 8.4. I just reported https://bugs.mysql.com/bug.php?id=114876 which could also be a caching problem.
[4 May 2024 19:34]
Mark Callaghan
Evan - I don't know much about caching_sha2_password because with MySQL 8.0 I have been using the following after some changes with 8.0 broke my workflow for 5.6 and 5.7: default_authentication_plugin=mysql_native_password
[22 May 2024 7:06]
MySQL Verification Team
Hello Mark, Thank you for the report and feedback. I was able to reproduce this odd behavior only once in the below sequence and subsequent attempts(12-13 attempts) just works(even same instance, wiped and re-attempted). I'm verifying for now so that Dev's can clarify further on this. ** Connect via TCP -> bin/mysql -u... -p... -h127.0.0.1 And get errors ** Connect via UNIX socket -> bin/mysql -u... -p... And this works ** Connect via TCP -> bin/mysql -u... -p... -h127.0.0.1 And this works regards, Umesh
[25 Oct 2024 7:08]
Harin Vadodaria
Hi Mark! It looks like root account is created using caching_sha2_password and if so, the behaviour is expected. Please refer to: https://dev.mysql.com/doc/refman/8.4/en/caching-sha2-pluggable-authentication.html An account that uses caching_sha2_password requires secure connection on first attempt at connection after account creation (and subsequently after password change, RENAME USER or FLUSH PRIVILEGES). TCP without SSL is not a secure connection and that's why the first connection attempt fails. Socket is considered secure and hence connection succeeds. After first such connection, subsequent connection can operate on simple TCP connection because authentication flow now uses challenge-response based mechanism. That's the reason why subsequent connection using --protocol=TCP succeeds in your repro. In nutshell, - Either use SSL or RSA keys as documented above if account is using caching_sha2_password - OR create an account using mysql_native_password as authentication plugin. See: https://dev.mysql.com/doc/refman/8.4/en/create-user.html#create-user-authentication