Fix bug that root user cannot login without password from 127.0.0.1 (#825)
This commit is contained in:
@ -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() {
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user