Overview
RDSWeb Custom uses LDAP to authenticate users against your Active Directory domain. This guide covers the setup of a service account and LDAP configuration.Service Account Requirements
Why a Service Account?
The application uses a two-step authentication process:- Service Account Bind: A read-only service account searches for the user in Active Directory
- User Credential Validation: The actual user credentials are validated with a direct bind
Creating the Service Account
- Open Active Directory Users and Computers
- Create a new user (e.g.,
svc-rdweb) - Set a strong password that never expires
- Add to Domain Users (no elevated permissions needed)
- Grant Read permissions on the directory (default for domain users)
Environment Configuration
Configure these settings in your.env file:
Configuration Parameters
LDAP server URL. Use
ldap:// for unencrypted or ldaps:// for TLS.Example: ldap://dc01.contoso.localBase Distinguished Name for LDAP searches.Example:
DC=contoso,DC=localNetBIOS domain name (used for user normalization).Example:
CONTOSOService account username. Supports multiple formats:
[email protected](recommended)CN=svc-rdweb,OU=Services,DC=domain,DC=localDOMAIN\svc-rdweb
Service account password. Store securely and rotate regularly.
LDAP Attributes Retrieved
The service queries these Active Directory attributes:sAMAccountName- UsernamedisplayName- Full namemail- Email addressuserPrincipalName- User principal namememberOf- Group memberships
Username Formats
RDSWeb Custom accepts multiple username formats:| Format | Example | Description |
|---|---|---|
| UPN | [email protected] | User Principal Name |
| Down-level | DOMAIN\user | NetBIOS format |
| Simple | user | Username only (domain from config) |
TLS/SSL Configuration
For production deployments, use LDAPS (LDAP over TLS):Enabling TLS Certificate Validation
Editbackend/src/services/adService.js:
Testing the Connection
Use the health endpoint to verify AD connectivity:Troubleshooting
Error: “No se pudo conectar al servidor de Active Directory”
- Verify the LDAP URL is correct and reachable
- Check firewall rules (port 389 for LDAP, 636 for LDAPS)
- Ensure DNS resolution works for the domain controller
Error: “Credenciales incorrectas”
- Verify the service account credentials in
.env - Check the user exists in Active Directory
- Ensure the user account is not locked or disabled
Error: “Usuario no encontrado en Active Directory”
- Verify
LDAP_BASE_DNis correct - Check the username format matches AD
- Ensure the user is in the correct OU within the base DN
Group-Based Access Control
User group memberships are extracted from thememberOf attribute and included in the JWT token. You can use these groups for:
- Application filtering (future feature)
- Role-based access control
- Audit logging
backend/src/services/adService.js:48-52 for the group extraction logic.
Security Best Practices
Strong Passwords
Use a complex password for the service account (min 20 characters)
Password Rotation
Rotate the service account password every 90 days
Monitor Access
Enable AD audit logging for the service account
Use LDAPS
Always use encrypted LDAPS in production
Related Pages
- Security Best Practices - JWT, CORS, and HTTPS configuration
- RD Connection Broker - Configure application publishing
- Simulation Mode - Test without Active Directory