Website • Demo • Documentation • Chat
Loads data from an LDAP server into a database accessible by the primary Atlas metadata ETL.
Use LDAPDatabaseCreationScript.sql to create the required tables.
- Python 3.10+
- uv
- C++ build tools on Windows
- ODBC Driver for SQL Server
uv syncCreate a .env file (or pass the same values as environment variables):
LDAP_HOST=localhost
LDAP_USERNAME=cn=admin,dc=example,dc=org
LDAP_PASSWORD=adminpassword
LDAP_BASE=dc=example,dc=org
LDAP_USE_SSL=False
LDAP_USE_TLS=False
AD_DOMAIN=EXAMPLEHEALTH
LDAP_GROUP_SEARCH=(objectClass=group)
# Optionally limit results to DNs that contain an OU (comma-separated).
LDAP_GROUP_OU=Email Distribution Groups,Room & Shared Mailboxes,Access & Permissions
LDAP_GROUP_USERNAME=sAMAccountName
LDAP_GROUP_DISPLAYNAME=displayName
LDAP_GROUP_EMAIL=mail,email
LDAP_USER_SEARCH=(&(objectClass=person)(sAMAccountName=*))
LDAP_USER_EMPLOYEEID=employeeID
LDAP_USER_ACCOUNTNAME=sAMAccountName
LDAP_USER_DISPLAYNAME=displayName
LDAP_USER_FULLNAME=cn,name
LDAP_USER_FIRSTNAME=givenName
LDAP_USER_LASTNAME=sn
LDAP_USER_DEPARTMENT=department
LDAP_USER_TITLE=title,description
LDAP_USER_PHONE=ipPhone,telephoneNumber
LDAP_USER_EMAIL=mail,proxyAddresses,userPrincipalName
LDAP_USER_PHOTO=thumbnailPhoto,profilePhoto
DATABASE=DRIVER={ODBC Driver 17 for SQL Server};SERVER=atlas;DATABASE=LDAP;UID=datagov;PWD=123uv run python ldap.pyActive Directory Explorer is useful for browsing LDAP to find bases and DCs.
- Start an LDAP server:
docker run -p 389:1389 bitnami/openldap:latest- Set test env vars:
LDAP_HOST=ldap://localhost:389
LDAP_USERNAME=cn=admin,dc=example,dc=org
LDAP_PASSWORD=adminpassword
DATABASE=>> your test db connection
AD_DOMAIN=
LDAP_BASE=dc=example,dc=org
LDAP_USER_SEARCH=(objectClass=inetOrgPerson)
LDAP_GROUP_SEARCH=(objectClass=groupOfNames)
LDAP_USE_SSL=false
LDAP_USE_TLS=false- Run tests:
uv sync --group dev
uv run pytest tests.py