使用docker compose一键部署 Openldap
LDAP(轻量级目录访问协议,Lightweight Directory Access Protocol)是一种用于访问分布式目录服务的网络协议,OpenLDAP 是 LDAP 协议的一个开源实现,由 OpenLDAP 项目提供,常用于管理企业内的用户、计算机、网络等资源。
1、创建安装目录
mkdir /data/openldap/ -p && cd /data/openldap
2、创建docker-compose.yml文件
version: '2'networks:ldap:driver: bridgeservices:openldap:image: osixia/openldap:1.5.0container_name: openldaprestart: alwaysenvironment:LDAP_LOG_LEVEL: "256"LDAP_ORGANISATION: "ldap" #组织名称LDAP_DOMAIN: "xiaopangpang.asia" #公司域名LDAP_BASE_DN: "cn=admin,dc=xiaopangpang,dc=asia" # 域名组成LDAP_ADMIN_PASSWORD: "ldap123456" #密码LDAP_CONFIG_PASSWORD: "ldap123456" #密码LDAP_READONLY_USER: "false"LDAP_RFC2307BIS_SCHEMA: "false"LDAP_BACKEND: "mdb"LDAP_REPLICATION: "false"KEEP_EXISTING_CONFIG: "false"LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"tty: truestdin_open: truevolumes:- ./openldap/ldap:/var/lib/ldap #openldap数据目录- ./openldap/slapd.d:/etc/ldap/slapd.d #openldap配置文件- ./openldap/certs:/container/service/lapd/assets/certsports:- "389:389" #默认监听端口,明文传输- "636:636" #加密监听端口,加密传输domainname: "xiaopangpang.asia"hostname: "openldap"networks:- ldapphpldapadmin:image: osixia/phpldapadmin:latestcontainer_name: phpldapadminrestart: alwaysprivileged: trueenvironment:PHPLDAPADMIN_LDAP_HOSTS: openldapPHPLDAPADMIN_LDAP_PORT: 689PHPLDAPADMIN_HTTPS: "false"ports:- "10180:80"depends_on:- openldapnetworks:- ldapself-service-password:container_name: self-service-passwordimage: tiredofit/self-service-password:latestrestart: alwaysports:- "11180:80"environment:- LDAP_SERVER=ldap://openldap:389- LDAP_BINDDN=cn=admin,dc=xiaopangpang,dc=asia- LDAP_BINDPASS=ldap123456- LDAP_BASE_SEARCH=dc=xiaopangpang,dc=asia- MAIL_FROM=ops@openldap.com- MAIL_FROM_NAME=自助密码服务- SMTP_HOST=smtp.163.com- SMTP_DEBUG=0- SMTP_USER=xiaopang@163.com - SMTP_PASS=xiaopangpang- SMTP_PORT=465- SMTP_SECURE_TYPE=ssl- SMTP_AUTH_ON=true- NOTIFY_ON_CHANGE=truevolumes:- /etc/localtime:/etc/localtime- ./openldap/self-service-password/htdocs:/www/ssp- ./openldap/self-service-password/logs:/www/logsdeploy:resources:limits:memory: 1Greservations:memory: 512Mnetworks:- ldap
3、查看目录结构
tree /data/openldap/
4、启动服务
docker compose up -d
5、查看服务状态
docker compose ps
6、访问phpldapadmin服务
7、访问self-service-password服务
7、登录phpldapadmin测试