LDAP Authentication Setup
LDAP Authentication integrates RAMP with enterprise directories like Active Directory or OpenLDAP. Users authenticate using their directory credentials, and RAMP can search the directory for users and groups.
Features
Section titled “Features”- Authenticate against LDAP/Active Directory
- Auto-provision users on first login
- Directory search for users and groups
- Support for SSL/TLS (LDAPS)
- Works on Windows, Linux, and Docker
Use Cases
Section titled “Use Cases”- Enterprise directory integration
- Centralized user management
- Active Directory without Windows Auth/IIS
- OpenLDAP environments
Prerequisites
Section titled “Prerequisites”- LDAP server (Active Directory or OpenLDAP)
- LDAP server hostname/IP and port (389 for LDAP, 636 for LDAPS)
- Service account for LDAP bind operations
- Network access from RAMP to LDAP server
Step 1: Gather LDAP Information
Section titled “Step 1: Gather LDAP Information”You’ll need the following information from your LDAP administrator:
| Setting | Example (Active Directory) | Example (OpenLDAP) |
|---|---|---|
| LDAP Server | ldap://dc.contoso.com:389 | ldap://ldap.company.com:389 |
| Search Base | DC=contoso,DC=com | dc=company,dc=com |
| Service Account DN | CN=ramp-service,OU=Service Accounts,DC=contoso,DC=com | cn=ramp-bind,ou=services,dc=company,dc=com |
| Service Account Password | (from AD admin) | (from LDAP admin) |
| User Filter | (&(objectClass=user)(objectCategory=person)) | (objectClass=inetOrgPerson) |
| Group Filter | (objectClass=group) | (objectClass=groupOfNames) |
Step 2: Configure RAMP Backend
Section titled “Step 2: Configure RAMP Backend”Edit appsettings.json:
{ "Authentication": { "Providers": { "LDAP": { "Enabled": true, "Server": "ldap://dc.contoso.com:389", "SearchBase": "DC=contoso,DC=com", "BindDn": "CN=ramp-service,OU=Service Accounts,DC=contoso,DC=com", "BindPassword": "ServiceAccountPassword123!", "UseSsl": false, "UserSearchFilter": "(&(objectClass=user)(objectCategory=person)(sAMAccountName={0}))", "GroupSearchFilter": "(objectClass=group)", "AttributeMappings": { "Username": "sAMAccountName", "Email": "mail", "FirstName": "givenName", "LastName": "sn", "DisplayName": "displayName" }, "EnableDirectorySearch": true, "AutoProvisionUsers": true } } }, "Bootstrap": { "Administrators": [ { "IdentityProvider": "LDAP", "Username": "admin", "Email": "admin@contoso.com" } ] }}Configuration Reference
Section titled “Configuration Reference”| Setting | Required | Description |
|---|---|---|
Enabled | Yes | Set to true to enable LDAP authentication |
Server | Yes | LDAP server URL (format: ldap://host:port or ldaps://host:port) |
SearchBase | Yes | Base DN for all LDAP searches |
BindDn | Yes | Distinguished Name of service account for bind operations |
BindPassword | Yes | Password for service account |
UseSsl | No | Use LDAPS (port 636). Default: false |
UserSearchFilter | Yes | LDAP filter to find users. {0} is replaced with username |
GroupSearchFilter | No | LDAP filter to find groups |
AttributeMappings | Yes | Map LDAP attributes to RAMP user fields |
EnableDirectorySearch | No | Allow searching directory for users/groups. Default: false |
AutoProvisionUsers | No | Create RAMP user on first login. Default: true |
Step 3: Directory-Specific Configuration
Section titled “Step 3: Directory-Specific Configuration”{ "Authentication": { "Providers": { "LDAP": { "Enabled": true, "Server": "ldap://dc.contoso.com:389", "SearchBase": "DC=contoso,DC=com", "BindDn": "CN=ramp-service,OU=Service Accounts,DC=contoso,DC=com", "BindPassword": "ServiceAccountPassword123!", "UseSsl": false, "UserSearchFilter": "(&(objectClass=user)(objectCategory=person)(sAMAccountName={0}))", "GroupSearchFilter": "(objectClass=group)", "AttributeMappings": { "Username": "sAMAccountName", "Email": "mail", "FirstName": "givenName", "LastName": "sn", "DisplayName": "displayName" }, "EnableDirectorySearch": true, "AutoProvisionUsers": true } } }}Service Account Permissions (Active Directory)
Section titled “Service Account Permissions (Active Directory)”The service account needs:
- Read permissions on all user objects
- Read permissions on all group objects
- No special elevated permissions required
Create service account:
# Create service account in Active DirectoryNew-ADUser -Name "ramp-service" ` -SamAccountName "ramp-service" ` -UserPrincipalName "ramp-service@contoso.com" ` -Path "OU=Service Accounts,DC=contoso,DC=com" ` -AccountPassword (ConvertTo-SecureString "ServicePassword123!" -AsPlainText -Force) ` -Enabled $true ` -PasswordNeverExpires $true ` -CannotChangePassword $true{ "Authentication": { "Providers": { "LDAP": { "Enabled": true, "Server": "ldap://ldap.company.com:389", "SearchBase": "dc=company,dc=com", "BindDn": "cn=ramp-bind,ou=services,dc=company,dc=com", "BindPassword": "BindPassword123!", "UseSsl": false, "UserSearchFilter": "(&(objectClass=inetOrgPerson)(uid={0}))", "GroupSearchFilter": "(objectClass=groupOfNames)", "AttributeMappings": { "Username": "uid", "Email": "mail", "FirstName": "givenName", "LastName": "sn", "DisplayName": "cn" }, "EnableDirectorySearch": true, "AutoProvisionUsers": true } } }}Create Service Account (OpenLDAP)
Section titled “Create Service Account (OpenLDAP)”dn: cn=ramp-bind,ou=services,dc=company,dc=comobjectClass: simpleSecurityObjectobjectClass: organizationalRolecn: ramp-binddescription: RAMP LDAP Bind AccountuserPassword: {SSHA}HashedPasswordHereAdd to OpenLDAP:
ldapadd -x -D "cn=admin,dc=company,dc=com" -W -f ramp-bind.ldifStep 4: Enable SSL/TLS (LDAPS) — Recommended
Section titled “Step 4: Enable SSL/TLS (LDAPS) — Recommended”For production, use LDAPS (LDAP over SSL/TLS) on port 636.
Update Configuration
Section titled “Update Configuration”{ "Authentication": { "Providers": { "LDAP": { "Server": "ldaps://dc.contoso.com:636", "UseSsl": true, "SearchBase": "DC=contoso,DC=com", "BindDn": "CN=ramp-service,OU=Service Accounts,DC=contoso,DC=com", "BindPassword": "ServiceAccountPassword123!" } } }}Certificate Requirements
Section titled “Certificate Requirements”- LDAP server must have valid SSL certificate
- Certificate must be trusted by RAMP server
- For self-signed certificates, add to trusted root certificate store
# Copy certificate to trusted certificatessudo cp ldap-ca.crt /usr/local/share/ca-certificates/sudo update-ca-certificates# Import certificate to Trusted RootImport-Certificate -FilePath ldap-ca.crt -CertStoreLocation Cert:\LocalMachine\RootStep 5: Configure Bootstrap Administrator
Section titled “Step 5: Configure Bootstrap Administrator”Add LDAP admin to bootstrap configuration:
{ "Bootstrap": { "Administrators": [ { "IdentityProvider": "LDAP", "Username": "john.doe", "Email": "john.doe@contoso.com" } ] }}Step 6: Test LDAP Configuration
Section titled “Step 6: Test LDAP Configuration”Start RAMP
Section titled “Start RAMP”cd src/RAMP.APIdotnet runCheck Logs
Section titled “Check Logs”Look for LDAP initialization messages:
[INFO] LDAP provider initialized: ldap://dc.contoso.com:389[INFO] LDAP bind successfulTest Login
Section titled “Test Login”- Navigate to RAMP login page
- Enter LDAP username (e.g.,
john.doefor AD,jdoefor OpenLDAP) - Enter LDAP password
- If auto-provision is enabled, user account is created automatically
Directory Search Feature
Section titled “Directory Search Feature”When EnableDirectorySearch is true, administrators can search the LDAP directory when assigning roles.
How It Works
Section titled “How It Works”- Admin navigates to assign roles (Template Roles, Instance Roles, etc.)
- Click “Add User”
- Type username or email
- RAMP queries LDAP and shows matching users
- Select user from dropdown
- User is auto-provisioned if they haven’t logged in yet
Search Performance
Section titled “Search Performance”- Searches are cached for 5 minutes
- Maximum 50 results per search
- Searches both username and email fields
Auto-Provisioning
Section titled “Auto-Provisioning”When AutoProvisionUsers is true:
- User enters LDAP credentials
- RAMP validates credentials against LDAP
- On successful bind, RAMP creates user record with:
- Username from LDAP attribute
- Email from LDAP attribute
- First/Last name from LDAP attributes
- IdentityProvider:
LDAP
- User can now log in to RAMP
Troubleshooting
Section titled “Troubleshooting”Cannot connect to LDAP server
Section titled “Cannot connect to LDAP server”Check 1: Verify network connectivity
# Test LDAP port is accessibletelnet dc.contoso.com 389
# Or with ncnc -zv dc.contoso.com 389Check 2: Verify DNS resolution
nslookup dc.contoso.comCheck 3: Check firewall rules
- Ensure RAMP server can reach LDAP port (389 or 636)
- Check both host firewall and network firewalls
Bind operation failed
Section titled “Bind operation failed”Check 1: Verify BindDn format
- Active Directory:
CN=username,OU=unit,DC=domain,DC=com - OpenLDAP:
cn=username,ou=unit,dc=domain,dc=com
Check 2: Test bind manually
# Active Directoryldapsearch -H ldap://dc.contoso.com -D "CN=ramp-service,OU=Service Accounts,DC=contoso,DC=com" -W -b "DC=contoso,DC=com" "(sAMAccountName=testuser)"
# OpenLDAPldapsearch -H ldap://ldap.company.com -D "cn=ramp-bind,ou=services,dc=company,dc=com" -W -b "dc=company,dc=com" "(uid=testuser)"Check 3: Verify password
- Ensure no special characters are improperly escaped
- Test with simple password first
User authentication fails
Section titled “User authentication fails”Check 1: Verify user exists in LDAP
ldapsearch -H ldap://dc.contoso.com -D "..." -W -b "DC=contoso,DC=com" "(sAMAccountName=username)"Check 2: Verify UserSearchFilter
- Ensure filter syntax is correct
{0}placeholder is replaced with username- Test filter manually with ldapsearch
Check 3: Check account status
- Ensure user account is not disabled in LDAP
- Verify password hasn’t expired
SSL/TLS certificate errors
Section titled “SSL/TLS certificate errors”Check 1: Verify certificate chain
openssl s_client -connect dc.contoso.com:636 -showcertsCheck 2: Check certificate trust
- Ensure CA certificate is in trusted store
- For self-signed certs, import the certificate
Check 3: Disable SSL verification (testing only)
{ "Authentication": { "Providers": { "LDAP": { "UseSsl": true, "IgnoreSslErrors": true } } }}Security Best Practices
Section titled “Security Best Practices”1. Use LDAPS in Production
Section titled “1. Use LDAPS in Production”Always use SSL/TLS (port 636) for production deployments to encrypt credentials in transit.
2. Least Privilege Service Account
Section titled “2. Least Privilege Service Account”- Service account should have read-only permissions
- No admin or write permissions needed
- Restrict to specific OUs if possible
3. Secure Password Storage
Section titled “3. Secure Password Storage”Store BindPassword in Azure Key Vault or User Secrets, not in appsettings.json:
# Developmentdotnet user-secrets set "Authentication:Providers:LDAP:BindPassword" "password"
# Production - Azure Key Vault# Store as: Authentication--Providers--LDAP--BindPassword4. Monitor Failed Logins
Section titled “4. Monitor Failed Logins”- Enable audit logging
- Set up alerts for repeated bind failures
- May indicate brute force or misconfiguration
5. Network Security
Section titled “5. Network Security”- Restrict LDAP access to RAMP server IPs only
- Use firewall rules to block unauthorized access
- Consider using VPN for external access
Advanced Configuration
Section titled “Advanced Configuration”Custom Attribute Mappings
Section titled “Custom Attribute Mappings”Map additional LDAP attributes:
{ "AttributeMappings": { "Username": "sAMAccountName", "Email": "mail", "FirstName": "givenName", "LastName": "sn", "DisplayName": "displayName", "EmployeeId": "employeeNumber", "Department": "department", "Title": "title" }}Group-Based Access Control
Section titled “Group-Based Access Control”To restrict RAMP access to specific AD groups, use a filter that includes memberOf:
{ "UserSearchFilter": "(&(objectClass=user)(memberOf=CN=RAMP Users,OU=Groups,DC=contoso,DC=com)(sAMAccountName={0}))"}Next Steps
Section titled “Next Steps”- Bootstrap Administrators — Auto-assign admin roles for LDAP users
- Email Configuration — Enable email notifications
- Authentication Overview — Compare all authentication providers