This project provides a containerized OpenLDAP server setup for user directory management and authentication. It includes OpenLDAP (slapd) for handling directory services, SSSD for integrating LDAP authentication, and OpenSSH for remote access.
This repository provides a Dockerized environment that includes:
- OpenLDAP (
slapd) for user directory management - SSSD (System Security Services Daemon) for integrating LDAP authentication
- OpenSSH for remote login access
- LDAP-based authentication for users (
ann,chris,hrits).
- Docker installed on your machine
- Basic knowledge of Docker containers
The Dockerfile is based on the debian:latest image and installs the following packages:
slapd(OpenLDAP)sssdandsssd-ldap(for handling LDAP authentication)openssh-server(to allow SSH connections)- Various utilities (
vim,net-tools, etc.) for convenience
- Setting up the OpenLDAP server on port
389 - Configuring LDAP with the base domain
dc=mieweb,dc=com - Adding a local user
miewith password authentication and root access without a password - Pre-configuring
slapdfor LDAP directory setup - Adding LDAP users using LDIF files
- Configuring and running
SSSDfor LDAP authentication
To build the Docker image, navigate to the directory with your Dockerfile and run the following command:
cd server
docker build -t openldap-server .Start the Docker container with the following command, which binds port 389 to your local machine:
docker run -it -p 389:389 openldap-server bashCheck the status of slapd with:
service slapd statusIf it is not running, start it manually:
service slapd startBefore attempting to SSH into a client using this LDAP server, verify that the user exists in the directory.
ldapsearch -x -H ldap://localhost:389 -b "dc=mieweb,dc=com" "(uid=ann)"Once the client machine is properly configured to use this LDAP server, you can SSH into it using an LDAP user.
ssh ann@client-machine -p 2222
Password: annNote: This will only work on a client that is configured to use this OpenLDAP server for authentication. Running it inside the container or on an unconfigured system will not work.