Skip to content

Conversation

@Cai-Yao
Copy link
Contributor

@Cai-Yao Cai-Yao commented Apr 19, 2023

Proposed changes

Issue Number: close #xxx

Problem summary

Handle the case that user forgot the password

Before

root and admin user is allowed to login from 127.0.0.1, in case user forget password

After

add a new FE config skip_auth_check, the default is false.
If true, the auth check will be skipped.so that login to Doris without a password.

Checklist(Required)

  • Does it affect the original behavior
  • Has unit tests been added
  • Has document been added or modified
  • Does it need to update dependencies
  • Is this PR support rollback (If NO, please explain WHY)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions bot added the kind/docs Categorizes issue or PR as related to documentation. label Apr 19, 2023
List<UserIdentity> currentUser) throws AuthenticationException {
if ((remoteUser.equals(ROOT_USER) || remoteUser.equals(ADMIN_USER)) && remoteHost.equals("127.0.0.1")) {
// root and admin user is allowed to login from 127.0.0.1, in case user forget password.
if ((remoteUser.equals(ROOT_USER) || remoteUser.equals(ADMIN_USER)) && Config.skip_auth_check) {
Copy link
Member

Choose a reason for hiding this comment

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

I haven't looked at the calling process, but generally speaking, we recommend constant.equals to prevent NPE.
it's difficult for us to check whether the caller has done the corresponding null value detection.

eg: ROOT_USER.equals(remoteUser)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will modify this.

If you forget your password and cannot log in to Doris, you can add `skip_auth_check` in fe config so that logging to Doris without a password in localhost.

`mysql-client -h 127.0.0.1 -P query_port -uroot`
`skip_auth_check = true`
Copy link
Contributor

Choose a reason for hiding this comment

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

change to skip_localhost_auth_check

@yiguolei
Copy link
Contributor

run buildall

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

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

LGTM

@yiguolei yiguolei merged commit 166bed1 into apache:master Apr 23, 2023
5. Forget passwords

If you forget your password and cannot log in to Doris, you can log in to Doris without a password using the following command on the machine where the Doris FE node is located:
If you forget your password and cannot log in to Doris, you can add `skip_localhost_auth_check` in fe config so that logging to Doris without a password in localhost.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to restart FE? If yes, please add it in doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need restart FE

* If true, auth check will be disabled. The default value is false.
* This is to solve the case that user forgot the password.
*/
@ConfField(mutable = true)
Copy link
Contributor

Choose a reason for hiding this comment

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

The mutable should be false, otherwise user can set it via http api

@Cai-Yao
Copy link
Contributor Author

Cai-Yao commented Apr 24, 2023

#18996 to fix the problem

gnehil pushed a commit to gnehil/doris that referenced this pull request Apr 25, 2023
…sword (apache#18816)

* forbid to login from 127.0.0.1 without password

* add localhost limit

* rename
Reminiscent pushed a commit to Reminiscent/doris that referenced this pull request May 15, 2023
…sword (apache#18816)

* forbid to login from 127.0.0.1 without password

* add localhost limit

* rename
@xiaokang xiaokang mentioned this pull request Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/behavior-changed kind/docs Categorizes issue or PR as related to documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants