安装docker、docker-compose

部署OpenLDAP

version: '2'
services:
  openldap:
    image: osixia/openldap:1.5.0  ### 如果有私有仓库可以从自己的私有仓库拉取镜像
    container_name: openldap
    restart: always
    environment:
      LDAP_LOG_LEVEL: "256"
      LDAP_ORGANISATION: "vsoul"   ### 您的组织名称
      LDAP_DOMAIN: "vsoul.cn"    ### 公司域名
      LDAP_BASE_DN: "dc=vsoul,dc=cn"   ### 根据域名组成
      LDAP_ADMIN_PASSWORD: "123456"   ### 密码自己来设置
      LDAP_CONFIG_PASSWORD: "123456"
      LDAP_READONLY_USER: "false"
      #LDAP_READONLY_USER_USERNAME: "readonly"
      #LDAP_READONLY_USER_PASSWORD: "readonly"
      LDAP_RFC2307BIS_SCHEMA: "false"
      LDAP_BACKEND: "mdb"
      #LDAP_TLS: "true"
      #LDAP_TLS_CRT_FILENAME: "zaq.test.pem"
      #LDAP_TLS_KEY_FILENAME: "zaq.test.key"
      #LDAP_TLS_DH_PARAM_FILENAME: "dhparam.pem"
      #LDAP_TLS_CA_CRT_FILENAME: "ca.crt"
      #LDAP_TLS_ENFORCE: "false"
      #LDAP_TLS_CIPHER_SUITE: "SECURE256:-VERS-SSL3.0"
      # LDAP_TLS_VERIFY_CLIENT: "demand"
      LDAP_REPLICATION: "false"
      #LDAP_REPLICATION_CONFIG_SYNCPROV: 'binddn="cn=admin,cn=config" bindmethod=simple credentials="$$LDAP_CONFIG_PASSWORD" searchbase="cn=config" type=refreshAndPersist retry="60 +" timeout=1 starttls=critical'
      #LDAP_REPLICATION_DB_SYNCPROV: 'binddn="cn=admin,$$LDAP_BASE_DN" bindmethod=simple credentials="$$LDAP_ADMIN_PASSWORD" searchbase="$$LDAP_BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="60 +" timeout=1 starttls=critical'
      #LDAP_REPLICATION_HOSTS: "#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']"
      KEEP_EXISTING_CONFIG: "false"
      LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"
      #LDAP_SSL_HELPER_PREFIX: "ldap"
    tty: true
    stdin_open: true
    volumes:
      - /opt/openldap/ldap:/var/lib/ldap
      - /opt/openldap/slapd.d:/etc/ldap/slapd.d
      - /opt/openldap/certs:/container/service/lapd/assets/certs
    ports:
      - "389:389"
      - "636:636"
    # For replication to work correctly, domainname and hostname must be
    # set correctly so that "hostname"."domainname" equates to the
    # fully-qualified domain name for the host.
    domainname: "vsoul.cn"
    hostname: "ldap-server"
  phpldapadmin:
    image: osixia/phpldapadmin:latest
    container_name: phpldapadmin
    restart: always
    environment:
      PHPLDAPADMIN_LDAP_HOSTS: "openldap"   ### 如果部署后登录不进去有可能是这里出了问题,直接换为部署openldap服务的公网IP试试
      PHPLDAPADMIN_HTTPS: "false"
    ports:
      - "50080:80"
    depends_on:
      - openldap
  self-service-password:
    container_name: self-service-password
    image: tiredofit/self-service-password:5.3.3
    restart: always
    ports:
      - "80:80"
    environment:
      - LDAP_SERVER=ldap://openldap:389
      - LDAP_BINDDN=cn=admin,dc=vsoul,dc=cn
      - LDAP_BINDPASS=123456
      - LDAP_BASE_SEARCH=dc=vsoul,dc=cn
      - MAIL_FROM=info@vsoul.cn
      - MAIL_FROM_NAME=LDAP账号自助服务平台
      - SMTP_DEBUG=0
      - SMTP_HOST=smtp.qiye.aliyun.cn
      - SMTP_USER=info@vsoul.cn
      - SMTP_PASS=<邮箱密码>
      - SMTP_PORT=25
      #- SMTP_SECURE_TYPE=ssl
      - SMTP_AUTH_ON=true
      - NOTIFY_ON_CHANGE=true
    volumes:
      - /etc/localtime:/etc/localtime
      - /opt/openldap/self-service-password/htdocs:/www/ssp
      - /opt/openldap/self-service-password/logs:/www/logs
    deploy:
      resources:
        limits:
           memory: 4G
        reservations:
           memory: 512M
docker-compose up -d

访问

http://IP:50080
账号:cn=admin,dc=vsoul,dc=cn
密码:123456

创建账号

自助修改密码

配置好发件邮箱账号

http://IP