ProxySQL recently released version 2.6.0, and going through the release notes, I focused on the following:

Added support for caching_sha2_password!

This is great news for the community! The caching_sha2_password authentication method for frontend connections is now available. This has been a long-awaited feature …

Why?

Because in MySQL 8, caching_sha2_password has been the default authentication method. Starting from MySQL 8.0.34, mysql_native_password is marked as deprecated. It still exists in MySQL 8.2 but could easily be removed at any time.

Since MySQL 5.7 has gone End Of Life, many users have already upgraded to MySQL 8. But for those using ProxySQL, ProxySQL’s lack of support for frontend user’s authentication using caching_sha2_password had been a major concern/blocker.

For some of them, this is a concern because mysql_native_password is deprecated, so they can’t rely on this anymore.

For some others, this is a concern for security reasons, as the only workaround until recently was to either keep using mysql_native_password or keep passwords unencrypted in ProxySQL.

There have been many discussions around that:

So it’s finally great to see that the new release contains caching_sha2_password support for frontend connections.

I was happy to set up a testing environment and try this out. For the purposes of this blog post, I’ve created a single async replication running Percona Server for MySQL 8. I won’t focus on the deployment details as there are many different ways to create such a replication topology.

As a next step, I installed ProxySQL 2.6.0 on an Ubuntu 22.04.4 host.

I’ve logged in to ProxySQL’s admin interface and switched mysql-default_authentication_plugin to caching_sha2_password

At the end, the tricky part of migrating the password hashes from MySQL to ProxySQL took place using this:

* HEX() makes copying and pasting easier than dealing with special characters 

In MySQL

In ProxySQL

I was finally able to connect to ProxySQL frontend:

Please note that there are some limitations or unsupported scenarios that you should be aware of.

One example involves the Auth Switch functionality. When a client requests authentication with a method different than the one specified by  mysql-default_authentication_plugin  , authentication will fail. Clients should normally identify the required authentication method during the initial handshake packet.

Scenario one

  • mysql-default_authentication_plugin and hashed password in mysql_users are both caching_sha2_password
  • Client requested authentication using something else other than caching_sha2_password

In the scenario above, ProxySQL will be required to perform an Auth Switch and later use caching_sha2_password authentication. This is currently unsupported.

Scenario two

  • User password is hashed using caching_sha2_password and client requested authentication using caching_sha2_password
  • mysql-default_authentication_plugin is set to something different than caching_sha2_password

In this scenario, ProxySQL authentication will fail as an Auth Switch will be performed but ProxySQL has no access to the clear text password.

Further details can be found here.

Introducing support for  caching_sha2_password authentication is a major change. There are many variants of client software and libraries, so I’d strongly recommend heavily testing that feature before pushing any change to your production environment.  

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments