ci/ldap-test/README.md
This directory contains end-to-end tests for LDAP authentication in RisingWave.
Note: These tests are designed to run in CI only. The LDAP server is managed by ci/docker-compose.yml.
These tests verify that RisingWave can authenticate users against an LDAP server using two authentication modes:
ldapprefix and ldapsuffix to construct the DN directlyldapbasedn, ldapsearchattribute, ldapbinddn, and ldapbindpasswd to search for the user first, then bindEach authentication mode is tested with and without client certificates (mutual TLS), and with both legacy parameter format and URL format.
ci/
├── docker-compose.yml # Contains ldap-server service
└── ldap-test/
├── setup-ldap-certs.sh # Script to generate TLS certificates
├── ldif/
│ └── 01-users.ldif # LDAP test users definition
├── certs/ # Generated TLS certificates (gitignored, auto-generated)
└── README.md # This file
src/config/
├── ci-ldap-simple-bind.toml # RisingWave config for simple bind
├── ci-ldap-search-bind.toml # RisingWave config for search+bind
├── ci-ldap-simple-bind-url.toml # RisingWave config for simple bind (URL format)
└── ci-ldap-search-bind-url.toml # RisingWave config for search+bind (URL format)
e2e_test/ldap/
└── ldap_auth.slt # LDAP authentication tests (reused for all scenarios)
ci/scripts/
└── e2e-ldap-test.sh # Test script
One test user is created in LDAP:
testuser1 with password testpass1The user is under the organizational unit: ou=people,dc=example,dc=com
Certificates are generated inside the ldap-server container during startup:
ldap-server entrypoint runs setup-ldap-certs.sh with CERT_DIR=/container/service/slapd/assets/certs./ldap-test/certs/ so test scripts can access themThe test script ci/scripts/e2e-ldap-test.sh performs minimal setup:
ldap-utils for user managementLDAPTLS_CACERT: Path to CA certificateLDAPTLS_REQCERT: Set to "demand" for strict verificationLDAPTLS_CERT / LDAPTLS_KEY: Client certificate (for mutual TLS tests)Each scenario:
e2e_test/ldap/ldap_auth.slt)RisingWave reads LDAP TLS configuration from environment variables:
LDAPTLS_CACERT: Path to CA certificate file (required for self-signed certificates)LDAPTLS_CERT: Path to client certificate file (optional, for mutual TLS)LDAPTLS_KEY: Path to client private key file (optional, for mutual TLS)LDAPTLS_REQCERT: Certificate verification policy (never, allow, try, demand)These environment variables must be set before starting RisingWave:
export LDAPTLS_CACERT="$(pwd)/ci/ldap-test/certs/ca.crt"
export LDAPTLS_REQCERT="demand"
risedev ci-start ci-ldap-simple-bind
If LDAPTLS_CACERT is not set, RisingWave will use the system's native certificate store, which won't include our self-signed CA certificate, causing authentication to fail with invalid peer certificate errors.
Add hostname to /etc/hosts:
sudo bash -c 'echo "127.0.0.1 ldap-server" >> /etc/hosts'
This allows using the ldap-server hostname (matching the certificate CN) both locally and in CI.
# From the repository root
docker-compose -f ci/docker-compose.yml up -d ldap-server
This will:
ldif/01-users.ldifldappasswd -x -H ldap://ldap-server:389 \
-D "cn=admin,dc=example,dc=com" -w "admin123" \
-s "testpass1" "uid=testuser1,ou=people,dc=example,dc=com"
export LDAPTLS_CACERT="$(pwd)/ci/ldap-test/certs/ca.crt"
export LDAPTLS_REQCERT="demand"
# Test with ldapwhoami (may need Homebrew openldap on macOS)
ldapwhoami -x -H ldap://ldap-server:389 -ZZ \
-D "cn=admin,dc=example,dc=com" -w "admin123"
macOS Note: Install OpenLDAP via Homebrew for proper TLS support:
brew install openldap
# Use: /opt/homebrew/opt/openldap/bin/ldapwhoami
The macOS system LDAP client may not work properly with STARTTLS.
docker-compose -f ci/docker-compose.yml down
rm -rf ci/ldap-test/certs/
The setup-ldap-certs.sh script generates:
ca.crt, ca.key): Self-signed root CAserver.crt, server.key):
ldap-serverDNS:ldap-server, DNS:localhost, DNS:ldap.example.com, IP:127.0.0.1, IP:::1client.crt, client.key):
RisingWave Clientdhparam.pem): 2048-bit, reused if already existsAll certificates use RSA 4096-bit keys and SHA256 signatures.