Overview
RDSWeb Custom handles authentication and application access for your Remote Desktop Services infrastructure. Proper security configuration is critical to protect your environment. This guide covers:- JWT token security
- HTTPS/TLS configuration
- CORS policies
- Active Directory service account security
- Network security
JWT Authentication
Secret Configuration
The JWT secret is used to sign authentication tokens. Configure a strong secret in.env:
Generating a Secure Secret
Use one of these methods:Token Expiration
Configure token lifetime based on your security requirements:| Environment | Recommended Expiration |
|---|---|
| Development | 12h |
| Production (internal) | 8h |
| Production (public) | 1h |
| High-security | 30m |
Token Storage
The application uses HTTP-only cookies for token storage:Why HTTP-only cookies?
Why HTTP-only cookies?
HTTPS/TLS Configuration
Reverse Proxy with TLS
The recommended deployment uses a reverse proxy (IIS, Nginx, or Apache) to handle TLS:- IIS
- Nginx
Certificate Requirements
- Use certificates from a trusted CA (not self-signed)
- Ensure the certificate covers the hostname users access
- Set certificate expiration monitoring
- Use at least 2048-bit RSA or 256-bit ECC keys
CORS Configuration
The backend restricts Cross-Origin Resource Sharing to trusted origins (seebackend/src/index.js:19-26):
Production CORS Configuration
Update theorigin array for production:
.env configuration:
Security Headers (Helmet)
The application uses Helmet for security headers (seebackend/src/index.js:16):
Strict-Transport-Security- Enforces HTTPSX-Content-Type-Options: nosniff- Prevents MIME type sniffingX-Frame-Options: SAMEORIGIN- Prevents clickjackingX-XSS-Protection: 1; mode=block- Enables XSS filter- Removes
X-Powered-Byheader
Custom Helmet Configuration
For advanced scenarios, customize Helmet:Active Directory Service Account
Principle of Least Privilege
The AD service account should have minimal permissions:Recommended Permissions
Recommended Permissions
- Group: Domain Users (default)
- Read Permissions: Yes (default for domain users)
- Write Permissions: No
- Admin Groups: No (not Domain Admins, not Schema Admins)
- Delegation: None
- Logon Rights: Deny interactive logon
Account Configuration
Password Policy
- Minimum Length: 20 characters
- Complexity: Uppercase, lowercase, numbers, symbols
- Rotation: Every 90 days
- Storage: Use a secrets management system (Azure Key Vault, HashiCorp Vault)
- Never: Store in source control or share via email
Monitoring
Enable AD audit logging for the service account:LDAP Security
Use LDAPS (LDAP over TLS)
Enable Certificate Validation
Editbackend/src/services/adService.js:107 to enable certificate validation:
Network Security
Firewall Rules
Restrict access to the backend server:| Port | Protocol | Source | Purpose |
|---|---|---|---|
| 3000 | TCP | Reverse Proxy | Backend API (internal only) |
| 443 | TCP | User Network | HTTPS (reverse proxy) |
| 389 | TCP | Backend Server | LDAP to Domain Controller |
| 636 | TCP | Backend Server | LDAPS to Domain Controller |
| 135, 445, 49152+ | TCP | Backend Server | WMI to RD Connection Broker |
Network Segmentation
Deploy in a segmented architecture:Environment Variables Security
Never Commit .env Files
Add to .gitignore:
Use Secrets Management
For production, use a secrets management system:- Azure Key Vault
- HashiCorp Vault
Logging and Monitoring
Enable Audit Logging
Log security-relevant events:Events to Log
- Authentication attempts (success and failure)
- Application access requests
- Configuration changes
- Service account usage
- Errors and exceptions
Security Checklist
JWT Secret
✅ Generate a secure JWT secret (64+ characters)✅ Store in environment variables or secrets manager✅ Never commit to source control
CORS Configuration
✅ Set specific allowed origins (no wildcards)✅ Update for production domains✅ Enable credentials only for trusted origins
AD Service Account
✅ Create dedicated service account (not a user account)✅ Grant read-only permissions✅ Use strong password (20+ characters)✅ Enable password rotation (90 days)✅ Deny interactive logon
LDAP Security
✅ Use LDAPS (port 636)✅ Enable certificate validation✅ Install CA certificates on Node.js server
Network Security
✅ Configure firewall rules (minimal ports)✅ Segment networks (DMZ, internal)✅ Restrict WMI access to backend server
Monitoring
✅ Enable audit logging✅ Monitor authentication failures✅ Set up alerts for suspicious activity
Compliance Considerations
GDPR / Data Protection
- Log only necessary user data
- Implement data retention policies
- Provide user data export capabilities
- Document data processing activities
Industry Standards
- NIST Cybersecurity Framework: Implement identity and access management controls
- CIS Controls: Follow endpoint and network security guidelines
- ISO 27001: Maintain information security management system
Incident Response
Prepare an incident response plan:- Detection: Monitor logs for suspicious activity
- Containment: Disable compromised service accounts
- Eradication: Rotate JWT secrets, change passwords
- Recovery: Restore from known-good backups
- Lessons Learned: Update security controls
Related Pages
- Active Directory Setup - Configure LDAP authentication
- RD Connection Broker - WMI security considerations
- Simulation Mode - Never use in production