Authentication modes
RisingWave supports two LDAP authentication modes:Simple bind mode
In simple bind mode, RisingWave constructs the user’s Distinguished Name (DN) directly from the username using a prefix and suffix pattern, then attempts to bind to the LDAP server with this DN and the provided password. Use case: When your LDAP directory has a predictable DN structure (e.g., all users follow the patternuid=username,ou=people,dc=example,dc=com).
Search + bind mode
In search + bind mode, RisingWave first performs an LDAP search to find the user’s DN, then attempts to bind using that DN and the provided password. This mode requires an initial bind (either anonymous or with dedicated credentials) to perform the search. Use case: When user DNs are not predictable or users are spread across multiple organizational units.Configuration
LDAP authentication is configured in the RisingWave configuration file by adding HBA entries. Each entry specifies which users should authenticate via LDAP and the LDAP server details.Configuration parameters
Common parameters
| Parameter | Required | Description |
|---|---|---|
ldapserver | Yes | LDAP server hostname or IP address |
ldapport | No | LDAP server port (Default: 389 for ldap, 636 for ldaps) |
ldapscheme | No | Connection scheme:ldaporldaps(Default: ldap) |
ldaptls | No | Enable STARTTLS on ldap:// connections (Default: false) |
ldapurl | Yes | RFC 4516 LDAP URL (alternative to individual parameters) |
Either
ldapserver or ldapurl is required, but not both.Simple bind mode parameters
| Parameter | Required | Description |
|---|---|---|
ldapprefix | No | String to prepend to the username |
ldapsuffix | No | String to append to the username |
Search + bind mode parameters
| Parameter | Required | Description |
|---|---|---|
ldapbasedn | Yes | Base DN for searching users |
ldapsearchattribute | No | Attribute to search for username (default: uid) |
ldapsearchfilter | No | Custom LDAP search filter with$usernameplaceholder |
ldapbinddn | No | DN to bind as for search operations |
ldapbindpasswd | No | Password for bind DN |
Simple bind parameters (
ldapprefix/ldapsuffix) and search+bind-only parameters (ldapsearchfilter/ldapbinddn/ldapsearchattribute) cannot be mixed in the same configuration.TLS/SSL configuration
RisingWave supports encrypted LDAP connections via:- LDAPS (LDAP over SSL): Use
ldapscheme = "ldaps"orldaps://URL scheme - STARTTLS: Use
ldaptls = "true"withldap://connections
TLS environment variables
TLS settings are configured via environment variables and must be set before starting RisingWave:| Environment variable | Description |
|---|---|
LDAPTLS_CACERT | Path to CA certificate file (required for self-signed certificates) |
LDAPTLS_CERT | Path to client certificate file (for mutual TLS) |
LDAPTLS_KEY | Path to client private key file (for mutual TLS) |
LDAPTLS_REQCERT | Certificate verification policy:never,allow,try, ordemand(default: demand) |
Example
LDAPTLS_CACERT is not set, RisingWave uses the system’s native certificate store.
Examples
Simple bind with STARTTLS
- User
johnauthenticates as DN:uid=john,ou=people,dc=example,dc=com - Connection uses STARTTLS encryption
- Requires
LDAPTLS_CACERTenvironment variable if using self-signed certificates
Search + bind with LDAPS
- RisingWave binds as admin to search for users
- Searches for
(uid=username)underou=people,dc=example,dc=com - Uses LDAPS (port 636) for encrypted connection
- Only accepts connections from the
192.168.1.0/24subnet
Simple bind using LDAP URL format
Search + bind using LDAP URL format
- Scheme:
ldap://orldaps:// - Base DN: Specified in the path component
- Attributes: First attribute is used as search attribute
- Filter: Optional custom filter (third query component)
Custom search filter
- Users authenticate using their username prefix (e.g., login as
johnfor email[email protected]) - The
$usernameplaceholder is replaced with the actual username (automatically escaped to prevent LDAP injection) - The filter combines two conditions with AND (
&): matchespersonobjects wheremailattribute equals the constructed email - When user “john” logs in, the filter becomes:
(&(objectClass=person)([email protected]))
- Search by username OR email:
(|(uid=$username)(mail=$username)) - Restrict to specific group:
(&(uid=$username)(memberOf=cn=db-users,ou=groups,dc=example,dc=com)) - Search by common name:
(cn=$username)
Connecting with LDAP credentials
After configuring LDAP authentication:-
Create the user in RisingWave:
-
Users can connect using their LDAP credentials:
- RisingWave validates credentials against LDAP server before granting access.
Users must exist in both the LDAP directory AND be created in RisingWave. The LDAP server only validates credentials, not user existence or permissions in RisingWave.
Security considerations
- Encryption: Always use TLS/SSL (LDAPS or STARTTLS) in production to protect credentials in transit.
- Certificate verification: Use
LDAPTLS_REQCERT="demand"to enforce strict certificate validation. - Bind credentials: Store bind DN passwords securely. Consider using read-only service accounts.
- Injection protection: RisingWave automatically escapes usernames to prevent LDAP injection attacks.
- Network security: Use HBA
addressesfield to restrict LDAP authentication to trusted networks.