Skip to content

RANGER-5753: LDAP/Active Directory authentication does not validate local Ranger account status - #1174

Open
vyommani wants to merge 2 commits into
apache:masterfrom
vyommani:RANGER-5753
Open

RANGER-5753: LDAP/Active Directory authentication does not validate local Ranger account status#1174
vyommani wants to merge 2 commits into
apache:masterfrom
vyommani:RANGER-5753

Conversation

@vyommani

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

When Ranger Admin is configured for LDAP or Active Directory authentication
(ranger.authentication.method=LDAP or ACTIVE_DIRECTORY), RangerAuthenticationProvider
did not check the local Ranger account's status after a successful directory bind. This meant
a user's local account status could be out of sync with their actual ability to sign in when
directory-based authentication was used, unlike local/JDBC authentication, which already
respects account status via the STATUS column read by the JDBC user-details query.

This change adds a status check, UserMgr#isUserDisabled, and calls it from
RangerAuthenticationProvider#authenticate right after each successful LDAP, LDAP-bind,
AD-bind, AD, PAM, and UNIX authentication branch, before the method returns — so a disabled
local account is rejected consistently across all supported authentication methods.

How was this patch tested?

added new unit tests.

Comment thread security-admin/src/main/java/org/apache/ranger/biz/UserMgr.java Outdated
return roleList;
}

public boolean isUserDisabled(String loginId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isUserDisabled() method checks if the user status is "not active", which is different from disabled status. I suggest naming the method to isUserActive() and update all its references to handle the return value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@vyommani - I take back this comment. I will update here after further review.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The method implementation checks if user is not active i.e., not explicitly if the user is disabled - note an user can be in one of other statuses like deactivated. So, I suggest:

  • renaming isUserDisabled() to isUserNotActive()
  • renaming checkAccountNotDisabled() to blockNotActiveUser()`

return authentication;
}

private void checkAccountNotDisabled(String userName) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest renaming method checkAccountNotDisabled() to ensureUserIsActive(). Also, update the messages to replace "disabled" with "not active".

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.

3 participants