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

Allow to connect with arbitrary plugin #2143

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sidorares
Copy link
Owner

@sidorares sidorares commented Jul 20, 2023

WIP

Currently mysql2 driver always tries to connect with mysql_native_password plugin. For the servers supporting PLUGIN_AUTH and configured to use plugins other than mysql_native_password initial connection is usually followed by AUTH_SWITCH_REQUEST packet and additional handshake with another plugin. This PR will allow to use plugins other than mysql_native_password in the initial client hello response. The order of preference on the plugin used during connection is:

  • if the server does not support plugin authorisation and secure auth server capability flag is set - mysql_native_password ( aka auth4.1 )
  • if the server does not support plugin authorisation and secure auth server capability flag is not set- pre auth4.1 token
  • plugin indicated by defaultAuthenticationPlugin config parameter name, if set ( error if the parameter is set but no standard or user provided plugin under this name )
  • plugin returned in auth_plugin_name server hello packet field ( error if plugin not configured )
  • "mysql_native_password" if no defaultAuthenticationPlugin or serverHello.auth_plugin_name

related issues:

@github-actions
Copy link
Contributor

Coverage report

The coverage rate is 89.2977066514253%

The branch rate is 84.63687150837988%

100% of new lines are covered.

…andshake command and calculate it based on selected auth plugin
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

Successfully merging this pull request may close these issues.

None yet

1 participant