Skip to content

RANGER-5758 : Support for Openldap service for ranger usersync in ran… - #1193

Open
pushkargogte wants to merge 1 commit into
apache:masterfrom
pushkargogte:RANGER-5758-2
Open

RANGER-5758 : Support for Openldap service for ranger usersync in ran…#1193
pushkargogte wants to merge 1 commit into
apache:masterfrom
pushkargogte:RANGER-5758-2

Conversation

@pushkargogte

@pushkargogte pushkargogte commented Aug 26, 2026

Copy link
Copy Markdown

…ger docker

What changes were proposed in this pull request?

This update makes it easier to test LDAP UserSync by bringing a ready-to-use OpenLDAP directory directly into the Apache Ranger Docker environment.

  • New LDAP Container: Added a Docker Compose service using the osixia/openldap image.
  • Schema Configuration: Updated Ranger Admin and UserSync properties to use standard OpenLDAP attributes (like inetOrgPerson, groupOfNames, and uid).
  • Delta Sync Enabled: Turned on SYNC_LDAP_DELTASYNC="true" to accurately simulate how enterprise environments handle updates.
  • Network Ready: Set up the required container networking so Ranger connects to the LDAP directory

How was this patch tested?

I verified this patch locally by running through a full build and deployment cycle:

  1. Successfully compiled Ranger Admin using the mvn clean compile package install command.
  2. Deployed the full Ranger stack (including the new local-ldap container) using docker-compose up -d.
  3. Verified that the Ranger Docker setup successfully synced users and groups from the local LDAP directory.
  4. Confirmed functionality by successfully logging into the Ranger UI as one of the synced LDAP users.

Testing / Setup Instructions: OpenLDAP with Ranger Docker

To verify the OpenLDAP integration with the Ranger Docker setup, please follow these steps:

1. Run the prerequisite setup script
Execute the setup script to configure the required integration settings for the Docker environment.

./ldap_us_setup.sh

2. Clean up existing infrastructure
Tear down any running containers and clear dynamic volumes to ensure a clean state.

docker compose -f docker-compose.ranger.yml -f docker-compose.ranger-usersync.yml -f docker-compose.ranger-tagsync.yml -f docker-compose.ranger-pdp.yml -f docker-compose.ranger-kms.yml -f docker-compose.local-ldap.yml down -v

3. Boot the fresh container environment
Start the entire cluster ecosystem simultaneously in detached mode.

docker compose -f docker-compose.ranger.yml -f docker-compose.ranger-usersync.yml -f docker-compose.ranger-tagsync.yml -f docker-compose.ranger-pdp.yml -f docker-compose.ranger-kms.yml -f docker-compose.local-ldap.yml up -d

4. Inject directory mappings
Wait briefly for the LDAP container to initialize, then load the user/group configurations before UserSync executes its initial lookup.

sleep 10
docker exec -i local-ldap ldapadd -c -x -D "cn=admin,dc=example,dc=com" -w p@ssw0rd < ldapusergroup.ldif

5. Force UserSync discovery
Allow time for the Ranger Admin tables to finish building, then cycle the UserSync container to force discovery of the newly mapped users.

sleep 60
docker restart ranger-usersync

SYNC_LDAP_USER_SEARCH_BASE = ou=People,dc=example,dc=com
SYNC_LDAP_USER_SEARCH_FILTER = (objectClass=inetOrgPerson)

SYNC_LDAP_GROUP_SEARCH_BASE = ou=People,dc=example,dc=com

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.

That property does not exist. The correct install property is SYNC_GROUP_SEARCH_BASE; check ranger-usersync-install.properties and installprop2xml.properties


SYNC_USERNAME_CASE_CONVERSION = lower
SYNC_GROUPNAME_CASE_CONVERSION = lower
LGSYNC_LDAP_LARGEGROUPSYNC_ENABLED = true

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.

Both the script and doc set this, but it is not mapped in unixauthservice/scripts/templates/installprop2xml.properties. It will not reach ranger-ugsync-site.xml during setup. The runtime key is ranger.usersync.ldap.largegroupsync.

Fix: Add the mapping, or remove the setting from script and doc.


### 4.B Ranger Admin Native Properties

File: `ranger/dev-support/scripts/admin/ranger-admin-install-postgres.properties`

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.

Correct path:

dev-support/ranger-docker/scripts/admin/...


### 4.C Ranger UserSync Native Properties

File: `ranger/dev-support/scripts/usersync/ranger-usersync-install.properties`

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.

Correct paths:

dev-support/ranger-docker/scripts/usersync/...

@@ -0,0 +1,206 @@
# Containerized Apache Ranger & OpenLDAP Native Integration

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.

Not linked from README.md
The LDAP guide is orphaned. A one-line pointer under “Run Ranger Services” would help discovery.

image: osixia/phpldapadmin:0.9.0
container_name: local-ldap-admin
ports:
- "8080:80"

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.

phpLDAPadmin on 8080 conflicts with Trino in the full stack. Worth noting in the doc or using another host port (e.g. 8089).

@@ -0,0 +1,216 @@
#!/bin/bash

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.

Add license header

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.

2 participants