You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "eubnara (via GitHub)" <gi...@apache.org> on 2025/01/22 12:00:09 UTC
[PR] RANGER-5110: Update the FQDN of users and groups whenever it changes [ranger]
eubnara opened a new pull request, #516:
URL: https://github.com/apache/ranger/pull/516
## What changes were proposed in this pull request?
If the FQDN of users and groups, usersync doesn't update it properly and if `ranger.usersync.deletes.enabled` is true, those users and groups becomes hidden. It should be handled properly.
## How was this patch tested?
Manual test on private internal Hadoop cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RANGER-5110: Update the FQDN of users and groups whenever it changes [ranger]
Posted by "eubnara (via GitHub)" <gi...@apache.org>.
eubnara commented on code in PR #516:
URL: https://github.com/apache/ranger/pull/516#discussion_r1925202135
##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java:
##########
@@ -1732,15 +1714,26 @@ private void computeDeletedGroups(Map<String, Map<String, String>> sourceGroups)
deletedGroups = new HashMap<>();
+ Set<String> sourceGroupNames = new HashSet<>();
+ for (Map<String, String> attrs : sourceGroups.values()) {
+ sourceGroupNames.add(attrs.get(UgsyncCommonConstants.ORIGINAL_NAME));
+ }
+
// Check if the group from cache exists in the sourceGroups. If not, mark as deleted group.
- for (XGroupInfo groupInfo : groupCache.values()) {
+ for (Map.Entry<String, XGroupInfo> entry : groupCache.entrySet()) {
+ String groupName = entry.getKey();
+ XGroupInfo groupInfo = entry.getValue();
Map<String, String> groupOtherAttrs = groupInfo.getOtherAttrsMap();
String groupDN = groupOtherAttrs != null ? groupOtherAttrs.get(UgsyncCommonConstants.FULL_NAME) : null;
if (StringUtils.isNotEmpty(groupDN) && !sourceGroups.containsKey(groupDN)
&& StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.SYNC_SOURCE), currentSyncSource) &&
StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.LDAP_URL), ldapUrl)) {
- if (ISHIDDEN.equals(groupInfo.getIsVisible())) {
Review Comment:
This is bug introduced by typo. Fix it also in this PR>
##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java:
##########
@@ -1732,15 +1714,26 @@ private void computeDeletedGroups(Map<String, Map<String, String>> sourceGroups)
deletedGroups = new HashMap<>();
+ Set<String> sourceGroupNames = new HashSet<>();
+ for (Map<String, String> attrs : sourceGroups.values()) {
+ sourceGroupNames.add(attrs.get(UgsyncCommonConstants.ORIGINAL_NAME));
+ }
+
// Check if the group from cache exists in the sourceGroups. If not, mark as deleted group.
- for (XGroupInfo groupInfo : groupCache.values()) {
+ for (Map.Entry<String, XGroupInfo> entry : groupCache.entrySet()) {
+ String groupName = entry.getKey();
+ XGroupInfo groupInfo = entry.getValue();
Map<String, String> groupOtherAttrs = groupInfo.getOtherAttrsMap();
String groupDN = groupOtherAttrs != null ? groupOtherAttrs.get(UgsyncCommonConstants.FULL_NAME) : null;
if (StringUtils.isNotEmpty(groupDN) && !sourceGroups.containsKey(groupDN)
&& StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.SYNC_SOURCE), currentSyncSource) &&
StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.LDAP_URL), ldapUrl)) {
- if (ISHIDDEN.equals(groupInfo.getIsVisible())) {
Review Comment:
This is bug introduced by typo. Fix it also in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RANGER-5110: Update the FQDN of users and groups whenever it changes [ranger]
Posted by "eubnara (via GitHub)" <gi...@apache.org>.
eubnara commented on code in PR #516:
URL: https://github.com/apache/ranger/pull/516#discussion_r1925202135
##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java:
##########
@@ -1732,15 +1714,26 @@ private void computeDeletedGroups(Map<String, Map<String, String>> sourceGroups)
deletedGroups = new HashMap<>();
+ Set<String> sourceGroupNames = new HashSet<>();
+ for (Map<String, String> attrs : sourceGroups.values()) {
+ sourceGroupNames.add(attrs.get(UgsyncCommonConstants.ORIGINAL_NAME));
+ }
+
// Check if the group from cache exists in the sourceGroups. If not, mark as deleted group.
- for (XGroupInfo groupInfo : groupCache.values()) {
+ for (Map.Entry<String, XGroupInfo> entry : groupCache.entrySet()) {
+ String groupName = entry.getKey();
+ XGroupInfo groupInfo = entry.getValue();
Map<String, String> groupOtherAttrs = groupInfo.getOtherAttrsMap();
String groupDN = groupOtherAttrs != null ? groupOtherAttrs.get(UgsyncCommonConstants.FULL_NAME) : null;
if (StringUtils.isNotEmpty(groupDN) && !sourceGroups.containsKey(groupDN)
&& StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.SYNC_SOURCE), currentSyncSource) &&
StringUtils.equalsIgnoreCase(groupOtherAttrs.get(UgsyncCommonConstants.LDAP_URL), ldapUrl)) {
- if (ISHIDDEN.equals(groupInfo.getIsVisible())) {
Review Comment:
This is bug introduced by typo.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RANGER-5110: Update the FQDN of users and groups whenever it changes [ranger]
Posted by "spolavarpau1 (via GitHub)" <gi...@apache.org>.
spolavarpau1 commented on code in PR #516:
URL: https://github.com/apache/ranger/pull/516#discussion_r4126289359
##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java:
##########
@@ -294,6 +294,13 @@ public void addOrUpdateUsersGroups(Map<String, Map<String, String>> sourceGroups
if (!isStartupFlag && computeDeletes) {
LOG.info("Computing deleted users/groups");
+ userCache.clear();
Review Comment:
Clearing cache and rebuilding the cache from Ranger Admin is a considerable performance overhead.
##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java:
##########
@@ -747,16 +752,6 @@ private void computeGroupDelta(Map<String, Map<String, String>> sourceGroups) {
noOfModifiedGroups++;
groupNameMap.put(groupDN, groupName);
} else {
- if (MapUtils.isNotEmpty(curGroupAttrs) && !StringUtils.equalsIgnoreCase(groupDN, curGroupDN)) { // skip update
Review Comment:
This will introduce regressions and change in behavior for existing customers when they upgrade. Instead, please take a look at the below PR where a new flag is introduced for updating DN of the user/group
https://github.com/apache/ranger/pull/1162
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RANGER-5110: Update the FQDN of users and groups whenever it changes [ranger]
Posted by "kimsehwan96 (via GitHub)" <gi...@apache.org>.
kimsehwan96 commented on PR #516:
URL: https://github.com/apache/ranger/pull/516#issuecomment-5052795748
+1 . Is there any plan to review and merge this? @mneethiraj
We hit this bug in production (Ranger 2.7.0 + LDAP sync, `deletes.enabled=true`).
A user was moved to another OU, and usersync marked the user as hidden and removed all group memberships.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org