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

Modify the password and privilege checking logic #2372

Merged
merged 3 commits into from
Dec 6, 2019

Conversation

morningman
Copy link
Contributor

Password checking logic

There are some problems with the current password and permission checking logic. For example:
First, we create a user by:
create user cmy@"%" identified by "12345";

And then 'cmy' can login with password '12345' from any hosts.

Second, we create another user by:
create user cmy@"192.168.%" identified by "abcde";

Because "192.168.%" has a higher priority in the permission table than "%". So when "cmy" try
to login in by password "12345" from host "192.168.1.1", it should match the second permission
entry, and will be rejected because of invalid password.
But in current implementation, Doris will continue to check password on first entry, than let it pass. So we should change it.

Permission checking logic

After a user login, it should has a unique identity which is got from permission table. For example,
when "cmy" from host "192.168.1.1" login, it's identity should be cmy@"192.168.%". And Doris
should use this identity to check other permission, not by using the user's real identity, which is
cmy@"192.168.1.1".

Black list
Functionally speaking, Doris only support adding WHITE LIST, which is to allow user to login from
those hosts in the white list. But is some cases, we do need a BLACK LIST function.
Fortunately, by changing the logic described above, we can simulate the effect of the BLACK LIST.

For example, First we add a user by:
create user cmy@'%' identified by '12345';

And now user 'cmy' can login from any hosts. and if we don't want 'cmy' to login from host A, we
can add a new user by:
create user cmy@'A' identified by 'other_passwd';

Because "A" has a higher priority in the permission table than "%". If 'cmy' try to login from A using password '12345', it will be rejected.

ISSUE #2205

@morningman morningman force-pushed the password_match branch 2 times, most recently from 4981206 to 156b8f2 Compare December 5, 2019 03:26
tmp commit

2nd commit

fix ut

change version to 67

fix show bug

fix show bug 2

add doc

fix bug 5

rebase master, change metaversion to 68

modify thrift

fix by review

update version to 69

fix ut
Copy link
Contributor

@imay imay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman merged commit a46bf1a into apache:master Dec 6, 2019
@chaoyli chaoyli mentioned this pull request Feb 10, 2020
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.

2 participants