-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[2018.3] Fixes to verify_login in mysql module #50551
[2018.3] Fixes to verify_login in mysql module #50551
Conversation
…nd not the host associated with the user. Adding a test to ensure user_exists when the passed host is the MySQL wildcard %.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look at and fixing my issue..
However, I think there is a problem with the approach here for checking if a user exists. The hostname passed into the user_exists call is supposed to be the client host not the server host. Mysql users are specified by client host so "user1@host1" is different from "user1@host2". Using verify_login to check if "user1@host1" exists won't work because the verify method may be running for a host other than where "user1" intends to connect from. I believe this is why the original code was using a query against the INFORMATION_SCHEMA to determine existence.
@doug-stratoscale the |
@garethgreenaway Thanks for the clarification - I looked at the code again ( :) ) and it makes sense. |
@doug-stratoscale No worries! Appreciate the second pair of eyes 😄 |
What does this PR do?
Ensure that verify_login is using the host from the connection_args and not the host associated with the user. Adding a test to ensure user_exists when the passed host is the MySQL wildcard %.
What issues does this PR fix or reference?
#50542
Previous Behavior
When
user_exists
was called with a wildcard hostname,%
, then verify login would fail because it was trying to connect to that as a real hostname.New Behavior
We should ensure we're using the hostname from connection_args when verifying the login.
Tests written?
Yes
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.