The news that the latest MySQL 8.0.4 RC (release candidate) is available is indeed exciting. Unfortunately for users of the auth_socket plugin, dangers lie in wait!
Back in November 2015, I reported Failure of auth_socket authentication with sha256_password as default. This prevents users that identify with the auth_socket plugin from logging in after SHA256 authentication has been made the default authentication method. With the news that in MySQL 8.0.4 RC the default_authentication_plugin is changed to caching_sha2_password, I was keen to find out if they addressed this bug.
The source code for the test was downloaded from dev.mysql.com and compiled using the release options. A few options were disabled to reduce build time, as well as setting the path prefixes and ensuring that we use my local OpenSSL libraries:
|
1 |
version="$(basename $(pwd))";<br>prefix="/home/ceri/opt/mysql/${version}";<br><br>cmake . -DBUILD_CONFIG=mysql_release <br> -DCMAKE_INSTALL_PREFIX:PATH="${prefix}" <br> -DMYSQL_DATADIR:PATH="${prefix}/data" <br> -DWITH_SSL:STRING=system <br> -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF <br> -DWITH_EMBEDDED_SERVER:BOOL=OFF <br> -DWITH_EXTRA_CHARSETS:STRING="" <br> -DWITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF <br> -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF <br> -DWITH_BOOST="./$(find boost/ -maxdepth 1 -type d -not -name boost)" |
After completing the build and build tests, MySQL Sandbox was used to create a test instance using the low_level_make_sandbox command for some extra control. Afterward, it is necessary to restore the default_authentication_plugin because it changed to mysql_native_password during the installation process:
|
1 |
$ low_level_make_sandbox -d mysql-8.0.4-rc --datadir_from=script <br> -b ~/opt/mysql/mysql-8.0.4-rc -i 8.0 -P 20804<br><br>$ sed -Ei 's/^(default_authentication_plugin=mysql_native_password)/#1/' my.sandbox.cnf |
After starting the instance, I then created the quick test case. This installs the auth_socket plugin and creates a user that will use it to identify themselves:
|
1 |
mysql [localhost] {root} ((none)) > show global variables like 'default_authentication_plugin';<br>+-------------------------------+-----------------------+<br>| Variable_name | Value |<br>+-------------------------------+-----------------------+<br>| default_authentication_plugin | caching_sha2_password |<br>+-------------------------------+-----------------------+<br>1 row in set (0.00 sec)<br><br>mysql [localhost] {root} ((none)) > install plugin auth_socket soname 'auth_socket.so';<br>Query OK, 0 rows affected (0.02 sec)<br><br>mysql [localhost] {root} ((none)) > create user ceri@localhost identified with auth_socket;<br>Query OK, 0 rows affected (0.04 sec)<br><br>mysql [localhost] {root} ((none)) > grant all on *.* to ceri@localhost;<br>Query OK, 0 rows affected (0.03 sec)<br> |
Sadly, a familiar outcome greeted me when trying to connect via this new user – although interestingly, a new error message!
|
1 |
$ ./use -uceri<br>ERROR 2000 (HY000): Unknown MySQL error<br> |
We can see the expected error message by connecting using a 5.7 client (a handshake error):
|
1 |
$ ~/opt/mysql/mysql_5.7.20/bin/mysql --defaults-file=./my.sandbox.cnf -uceri<br>ERROR 2012 (HY000): Error in server handshake<br> |
While there are lots of great improvements and new features in MySQL 8.0.4 RC, any systems that are using the auth_socket plugin will need to ensure that they force default_authentication_plugin=mysql_native_password – at least for now.