tls_mode field.
Available TLS Modes
Loom supports four TLS modes:- Auto - Automatically detect the best available encryption
- LDAPS - TLS on connect (port 636)
- StartTLS - TLS upgrade on plain LDAP (port 389)
- None - Plaintext, no encryption
Auto Mode
Theauto mode attempts to establish the most secure connection possible by trying methods in order:
- LDAPS on port 636 (or user-specified port)
- StartTLS on port 389 (or user-specified port)
- Plaintext as a last resort
Behavior
- If
port = 389(default), loom tries LDAPS on port 636 first - If a custom port is specified, loom tries LDAPS on that port
- If LDAPS fails, loom attempts StartTLS on the configured port
- If StartTLS fails, loom falls back to plaintext (logs a warning)
Use Cases
- Unknown or mixed-mode server configurations
- Development and testing environments
- Automatic migration from plaintext to encrypted connections
Auto mode is the recommended default for most use cases. It maximizes security while maintaining compatibility.
LDAPS Mode
Theldaps mode establishes TLS before any LDAP protocol communication (commonly called “LDAP over SSL”). This is the most common secure LDAP setup.
Standard Ports
- 636 - Standard LDAPS port
- 3269 - Active Directory Global Catalog LDAPS
Connection Process
- TCP connection to server:port
- TLS handshake
- Certificate verification
- LDAP bind and operations over encrypted channel
Use Cases
- Production LDAP servers with TLS configured
- Active Directory domains
- Servers that require encryption from the start
- When you need explicit encryption validation
Requirements
- Server must be configured to accept LDAPS connections
- Valid TLS certificate (or trusted manually)
- Firewall must allow traffic on LDAPS port
StartTLS Mode
Thestarttls mode starts with a plaintext LDAP connection on port 389, then upgrades to TLS using the LDAP StartTLS extended operation (RFC 4511).
Connection Process
- TCP connection to server:port
- Plaintext LDAP session established
- Client sends StartTLS extended operation
- TLS handshake
- Certificate verification
- Remaining LDAP operations over encrypted channel
Use Cases
- Servers configured for StartTLS (common with OpenLDAP)
- Environments where port 636 is blocked
- Legacy systems that support StartTLS but not LDAPS
Requirements
- Server must support the StartTLS extended operation
- Valid TLS certificate (or trusted via certificate trust dialog)
- Firewall must allow traffic on LDAP port (typically 389)
None Mode
Thenone mode establishes a plaintext LDAP connection with no encryption.
Use Cases
- Local development servers (localhost)
- Testing in isolated environments
- Legacy servers without TLS support
- Debugging protocol issues
Certificate Verification
When using LDAPS or StartTLS, loom verifies server certificates using:- System certificate store (webpki + native root certificates)
- Custom trust store (certificates you’ve explicitly trusted)
Certificate Trust Flow
- Server presents certificate during TLS handshake
- Loom checks system trust store (OS root certificates)
- If verification fails, loom captures certificate details
- User is prompted with certificate information and fingerprint
- User can choose:
- Trust Once (this session only)
- Trust Always (saved to
[[trusted_certificates]]in config) - Reject (abort connection)
Trusted Certificates
Permanently trusted certificates are stored inconfig.toml:
Certificate Details
The trust dialog displays:- Subject - Certificate CN and DN
- Issuer - Certificate authority
- Valid from/to - Certificate validity period
- SHA-256 fingerprint - Unique certificate identifier
TLS Configuration
Protocol Versions
Loom uses the rustls library and supports:- TLS 1.2
- TLS 1.3
Cipher Suites
Loom uses modern, secure cipher suites provided by rustls. Weak ciphers (RC4, DES, MD5-based) are not supported.Server Name Indication (SNI)
Loom sends the server hostname via SNI during the TLS handshake. This is required for servers hosting multiple domains on a single IP address.Troubleshooting
Connection fails with “certificate verify failed”
Cause: Server certificate is not trusted by the system certificate store. Solution:- Verify certificate details in the trust dialog
- Choose “Trust Once” or “Trust Always” if the certificate is legitimate
- Install the CA certificate in your system trust store
- Use a properly signed certificate on the server
Connection fails with “connection refused” on port 636
Cause: Server is not listening on LDAPS port or firewall blocks it. Solution:- Verify server LDAPS configuration
- Check firewall rules:
telnet ldap.example.com 636 - Try
tls_mode = "starttls"instead - Use
tls_mode = "auto"to let loom detect the correct method
StartTLS fails with “extended operation not supported”
Cause: Server does not support StartTLS. Solution:- Use
tls_mode = "ldaps"on port 636 - Configure StartTLS on the LDAP server
- Use
tls_mode = "auto"to try LDAPS automatically
Certificate shows wrong hostname
Cause: Certificate CN/SAN does not match the hostname you’re connecting to. Solution:- Use the correct hostname in the
hostfield - Generate a certificate with the correct CN/SAN
- For testing, trust the certificate (verify fingerprint first)
Connection fails with “connection timed out”
Cause: Network routing issue or firewall blocking. Solution:- Check network connectivity:
ping ldap.example.com - Verify port is reachable:
nc -zv ldap.example.com 636 - Increase
timeout_secsin connection profile - Check server logs for connection attempts
Best Practices
- Always use encryption in production (
auto,ldaps, orstarttls) - Use LDAPS over StartTLS when both are available (fewer attack vectors)
- Verify certificate fingerprints before trusting self-signed certificates
- Use proper CA-signed certificates on production servers
- Monitor certificate expiration and renew before expiry
- Use
tls_mode = "auto"for maximum compatibility and security - Set
read_only = trueon plaintext connections to prevent accidental writes
Server Configuration Examples
OpenLDAP with StartTLS
OpenLDAP with LDAPS
Add port 636 to systemd service:Active Directory
Active Directory automatically listens on:- Port 636 (LDAPS)
- Port 3269 (Global Catalog LDAPS)
- Certificate MMC snap-in on the domain controller
- Auto-enrollment from an enterprise CA