更新时间:2023-03-15 GMT+08:00
配置ldap主从
- 开启syncprov模块
cat << EOF > mod_syncprov.ldif dn: cn=module{0},cn=config changetype: modify add: olcModuleLoad olcModuleload: syncprov.la EOF DOCKER_LDAP_ID=`docker ps |grep openldap |awk '{print $1}'` docker cp mod_syncprov.ldif ${DOCKER_LDAP_ID}:/ docker exec ${DOCKER_LDAP_ID} ldapadd -Y EXTERNAL -H ldapi:/// -f /mod_syncprov.ldif
- 生成 syncprov 配置
cat << EOF > syncprov.ldif dn: olcOverlay=syncprov,olcDatabase={1}mdb,cn=config objectClass: olcOverlayConfig objectClass: olcSyncProvConfig olcOverlay: syncprov olcSpCheckpoint: 100 10 olcSpSessionLog: 100 EOF docker cp syncprov.ldif ${DOCKER_LDAP_ID}:/ docker exec ${DOCKER_LDAP_ID} ldapadd -Y EXTERNAL -H ldapi:/// -f /syncprov.ldif
- 开启同步
cat << EOF > syncrepl.ldif dn: olcDatabase={1}mdb,cn=config changetype: modify add: olcSyncRepl olcSyncRepl: rid=002 provider=ldap://openldap-master bindmethod=simple binddn="cn=admin,dc=xxx,dc=xxx" credentials=xxxx searchbase="dc=xxx,dc=xxx" scope=sub schemachecking=on type=refreshAndPersist retry="5 5 600 +" attrs="*,+" EOF DOCKER_LDAP_ID=`docker ps |grep openldap |awk '{print $1}'` docker cp syncrepl.ldif ${DOCKER_LDAP_ID}:/ docker exec ${DOCKER_LDAP_ID} ldapadd -Y EXTERNAL -H ldapi:/// -f /syncrepl.ldif
父主题: 配置LDAP服务