使用docker compose一键部署 Openldap
使用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: bridge
services:
openldap:
image: osixia/openldap:1.5.0
container_name: openldap
restart: always
environment:
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: true
stdin_open: true
volumes:
- ./openldap/ldap:/var/lib/ldap #openldap数据目录
- ./openldap/slapd.d:/etc/ldap/slapd.d #openldap配置文件
- ./openldap/certs:/container/service/lapd/assets/certs
ports:
- "389:389" #默认监听端口,明文传输
- "636:636" #加密监听端口,加密传输
domainname: "xiaopangpang.asia"
hostname: "openldap"
networks:
- ldap
phpldapadmin:
image: osixia/phpldapadmin:latest
container_name: phpldapadmin
restart: always
privileged: true
environment:
PHPLDAPADMIN_LDAP_HOSTS: openldap
PHPLDAPADMIN_LDAP_PORT: 689
PHPLDAPADMIN_HTTPS: "false"
ports:
- "10180:80"
depends_on:
- openldap
networks:
- ldap
self-service-password:
container_name: self-service-password
image: tiredofit/self-service-password:latest
restart: always
ports:
- "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=true
volumes:
- /etc/localtime:/etc/localtime
- ./openldap/self-service-password/htdocs:/www/ssp
- ./openldap/self-service-password/logs:/www/logs
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
networks:
- ldap
3、查看目录结构
tree /data/openldap/
4、启动服务
docker compose up -d
5、查看服务状态
docker compose ps
6、访问phpldapadmin服务
7、访问self-service-password服务
7、登录phpldapadmin测试