This document provides a step-by-step guide on setting up OpenLDAP for local testing of ReportPortal. OpenLDAP is an open-source implementation of the Lightweight Directory Access Protocol (LDAP), which allows you to simulate a directory service locally. By using OpenLDAP, you can create and manage user accounts and groups that are essential for testing user authentication and authorization in ReportPortal.
Before proceeding with the setup, ensure that the following prerequisites are met:
- Docker 20.10 or higher
- Docker Compose 1.27.4 or higher
- ReportPortal v5 or higher
To deploy OpenLDAP, execute the following command with Docker Compose:
docker-compose up -d
To integrate OpenLDAP with ReportPortal, follow these steps:
-
Login as
superadmin
to ReportPortal. -
Click on Superadmin icon in the left sidebar.
-
Open Plugins and click on the Installed tab.
-
Select LDAP plugin and fill in the following details:
- Url[^1]:
ldap://openldap:389
- Base DN:
dc=example,dc=com
- Manager DN:
cn=admin,dc=example,dc=com
- Manager password:
mypassword123
- User search filter:
uid={0}
- Password encoder type:
NO
- Email attribute:
mail
- Full name attribute:
cn
- Photo attribute:
photo
- Url[^1]:
-
Add email for the users in OpenLDAP. Use the following LDIF content:
cat <<EOF > /tmp/mod_user.ldif dn: cn=bob,ou=users,dc=example,dc=com changetype: modify replace: mail mail: bob.newemail@example.com dn: cn=alice,ou=users,dc=example,dc=com changetype: modify replace: mail mail: alice.newemail@example.com EOF docker cp /tmp/mod_user.ldif openldap:/tmp/mod_user.ldif
-
Apply the changes:
docker exec openldap ldapmodify -x -D "cn=admin,dc=example,dc=com" -w mypassword123 -H ldap://localhost -f /tmp/mod_user.ldif
-
Exit from Reportportal and Login back with the LDAP user credentials.
[^1] 'openldap' is the name of the OpenLDAP service in the Docker Compose file or VM IP/DNS name where OpenLDAP is running.
To enable password encryption, follwo these steps:
- Get the encrypted password by running the following command:
PBKDF2_PSW=$(docker exec openldap slappasswd -o module-load=/opt/bitnami/openldap/libexec/openldap/pw-pbkdf2.so -h {PBKDF2-SHA256} -s "mypassword")
echo "Your password is: ${PBKDF2_PSW}"
Encription algoritm can be changed by changing the -h
parameter. For example, to use PBKDF2-SHA512
algorithm, replace -h {PBKDF2-SHA256}
with -h {PBKDF2-SHA512}
.
- Modife user password with encrypted password:
cat <<EOF > /tmp/mod_user.ldif
dn: cn=alice,ou=users,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: ${PBKDF2_PSW}
EOF
docker cp /tmp/mod_user.ldif openldap:/tmp/mod_user.ldif
- Apply the changes:
docker exec openldap ldapmodify -x -D "cn=admin,dc=example,dc=com" -w mypassword123 -H ldap://localhost -f /tmp/mod_user.ldif
- Verify the changes:
docker exec openldap ldapwhoami -vvv -D cn=alice,ou=users,dc=example,dc=com -x -w 'mypassword'
Reponces should be like this:
ldap_initialize( <DEFAULT> )
dn:cn=alice,ou=users,dc=example,dc=com
Result: Success (0)