If you are looking to set up an LDAP server and need an easy way to manage it, installing OpenLDAP with phpLDAPadmin using Docker can make your life a lot easier.
LDAP or Lightweight Directory Access Protocol is a protocol that allows users to access and maintain directory information services over the internet. It's used by many organizations for authentication, authorization, and other tasks.
1-Install Docker on your machine if you haven't already. You can download Docker from their website.
2-Create a new directory on your machine where you want to store the configuration files for your LDAP server.
3-Inside the newly created directory, create a new file called docker-compose.yml.
3-Copy the following code into the docker-compose.yml file.
version: '3.7'
services:
openldap:
image: osixia/openldap:latest
container_name: openldap
hostname: openldap
ports:
- "389:389"
- "636:636"
volumes:
- ./data/certificates:/container/service/slapd/assets/certs
- ./data/slapd/database:/var/lib/ldap
- ./data/slapd/config:/etc/ldap/slapd.d
environment:
- LDAP_ORGANISATION=alibnr
- LDAP_DOMAIN=alibnr.com
- LDAP_ADMIN_USERNAME=admin
- LDAP_ADMIN_PASSWORD=admin_pass
- LDAP_CONFIG_PASSWORD=config_pass
- "LDAP_BASE_DN=dc=alibnr,dc=com"
- LDAP_TLS_CRT_FILENAME=server.crt
- LDAP_TLS_KEY_FILENAME=server.key
- LDAP_TLS_CA_CRT_FILENAME=alibnr.com.ca.crt
- LDAP_READONLY_USER=true
- LDAP_READONLY_USER_USERNAME=user-ro
- LDAP_READONLY_USER_PASSWORD=ro_pass
networks:
- openldap
phpldapadmin:
image: osixia/phpldapadmin:latest
container_name: phpldapadmin
hostname: phpldapadmin
ports:
- "80:80"
environment:
- PHPLDAPADMIN_LDAP_HOSTS=openldap
- PHPLDAPADMIN_HTTPS=false
depends_on:
- openldap
networks:
- openldap
networks:
openldap:
driver: bridge
5-Save the file and run the following command in the terminal inside the directory where you created the docker-compose.yml file.
docker-compose up -d
This will start the OpenLDAP and phpLDAPadmin containers in the background.
6-Once the containers are up and running, you can access the phpLDAPadmin web interface by opening a web browser and entering the following URL.
http://localhost
7-To log in, enter cn=admin,dc=alibnr,dc=com as the username and admin_pass as the password.
8-After logging in, you can start managing your LDAP server using the phpLDAPadmin interface.
That's it! You now have a fully functional and easy-to-manage LDAP server using Docker and phpLDAPadmin.
Top comments (0)