PowerFlex 4.x Unable to add or remove LDAP group

Summary: After AD removal from PFxM, and Keycloak unable to remove cached LDAP groups.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

Scenario

An initial attempt to add a group results in an error:

Failed to add Remote group 
Failed to find request group 

add remote user

failed to add remote group

 

After populating groups in the keycloak ldap filter, per PowerFlex 4.X - How To Apply LDAP Group Search Filter In PFxM Keycloak Admin Console | Dell US , and sync from PFxM to the LDAP provider, the sso.stdout.log shows that group sync is not working:

2024-09-25T07:10:31.684769872Z stdout F 2024-09-25T07:10:31.684Z  INFO 1 --- [io-8083-exec-10] c.d.s.c.DirectoryServicesController      : Received sync user request
2024-09-25T07:10:31.685080784Z stdout F 2024-09-25T07:10:31.684Z  INFO 1 --- [pool-9-thread-1] c.d.s.managers.DirectoryServiceManager   : starting sync process for ldap groups
2024-09-25T07:10:31.69678586Z stdout F 2024-09-25T07:10:31.696Z  INFO 1 --- [pool-9-thread-1] com.dell.sso.clients.KeycloakClient      : Ldap group sync started
2024-09-25T07:10:31.710659167Z stdout F 2024-09-25T07:10:31.710Z ERROR 1 --- [pool-9-thread-1] com.dell.sso.clients.KeycloakClient      : Failed to sync groups: HTTP 500 Internal Server Error
 
2024-09-25T07:10:31.710959458Z stderr F Exception in thread "pool-9-thread-1" java.lang.RuntimeException: com.dell.sso.exceptions.KeycloakException: Failed to sync groups or sync users

After removing the LDAP provider, the database still shows groups (ex. below shows four groups)

delladmin@mvm1:/>kubectl exec -it -c database -n powerflex $(kubectl get pods -n powerflex -l='postgres-operator.crunchydata.com/role=master, postgres-operator.crunchydata.com/instance-set' | grep Running | cut -d' ' -f1) -- psql -U postgres -d keycloak -c "SELECT COUNT(*) FROM keycloak_group;"
 count
-------
     4
(1 row)

Connectivity to ldap from PFMP should be confirmed with the following command:

kubectl exec -it keycloak-0 -n powerflex -- curl --verbose ldap://

Example:

keycloak

Impact

Unable to add or remove LDAP groups.

Cause

When AD is Removed:

  • The backend initiates the deletion of associated users and groups.
  • This deletion occurs in batches to manage the process efficiently.


When AD is Re-added During Ongoing Deletion:

  • Keycloak begins syncing groups from the newly added AD.
  • If the sync fails for any reason during this process, issues may arise.


If AD is Removed Again During Sync Failure:

  • Residual groups from the failed sync remain visible in the Keycloak UI.


These residual groups are not actively tied to any AD and may require manual cleanup.

 

Resolution

Delete each group individually using the API one at a time.

1) retrieve keycloak credentials..

kubectl get secrets -n powerflex keycloak-admin-credentials -o jsonpath='{.data.username}' | base64 --decode; echo -e
kubectl get secrets -n powerflex keycloak-admin-credentials -o jsonpath='{.data.password}' | base64 --decode; echo -e

2) Get access token (note: substitute 4578ZZyT3f with the password from the above output):

TOKEN=$(curl -X POST https://keycloak-http.powerflex/auth/realms/master/protocol/openid-connect/token -H 'Content-Type: application/x-www-form-urlencoded' -d 'scope=openid&grant_type=password&client_id=admin-cli&username=keycloak&password=4578ZZyT3f' | jq -r '.access_token'); echo $TOKEN

3) Check for groups using api (list 10 groups at a time)

curl -X GET "https://keycloak-http.powerflex/auth/admin/realms/powerflex/groups?first=0&max=10" -H "Authorization: Bearer $TOKEN" | jq

4) Delete groups one at a time (substitute with each id from step 3 above.

curl -X DELETE https://keycloak-http.powerflex/auth/admin/realms/powerflex/groups/"" -H "Authorization: Bearer $TOKEN"

Alternatively, use loop script to delete group_id's one at a time.

for group_id in $(curl -X GET "https://keycloak-http.powerflex/auth/admin/realms/powerflex/groups" -H "Authorization: Bearer $TOKEN" | jq -r '.[].id'); do  curl -X DELETE "https://keycloak-http.powerflex/auth/admin/realms/powerflex/groups/$group_id" -H "Authorization: Bearer $TOKEN"; done

Example 

example

Impacted Versions

PFMP 4.x

Fixed In Version

 Future version of keycloak will support bulk group deletion.

Affected Products

PowerFlex rack, VxFlex Ready Nodes, PowerFlex custom node, PowerFlex appliance R650, PowerFlex appliance R6525, PowerFlex appliance R660, PowerFlex appliance R6625, Powerflex appliance R750, PowerFlex appliance R760, PowerFlex appliance R7625 , PowerFlex appliance R640, PowerFlex appliance R740XD, PowerFlex appliance R7525, PowerFlex appliance R840 ...
Article Properties
Article Number: 000291045
Article Type: Solution
Last Modified: 04 Mar 2025
Version:  1
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.