Fix bug that root user cannot login without password from 127.0.0.1 (#825)

This commit is contained in:
Mingyu Chen
2019-03-28 10:58:32 +08:00
committed by GitHub
parent 4f3158a74d
commit 8f935c9486
2 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,16 @@ public class UserIdentity implements Writable {
private boolean isDomain;
private boolean isAnalyzed = false;
public static final UserIdentity ROOT;
public static final UserIdentity ADMIN;
static {
ROOT = new UserIdentity(PaloAuth.ROOT_USER, "%");
ROOT.setIsAnalyzed();
ADMIN = new UserIdentity(PaloAuth.ADMIN_USER, "%");
ADMIN.setIsAnalyzed();
}
private UserIdentity() {
}

View File

@ -205,6 +205,11 @@ public class PaloAuth implements Writable {
}
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)) {
currentUser.add(UserIdentity.ROOT);
} else {
currentUser.add(UserIdentity.ADMIN);
}
return true;
}