osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.02k stars 973 forks source link

After I created container with my own database, I couldn't connect to the LDAP server using original username. #220

Open condescendent opened 6 years ago

condescendent commented 6 years ago

I exported a lidf file from our existing openldap server for the database with the hope the configuration information is already saved inside this file. However, after I used the following command to make the container, I couldn't connect to the ldap server using the old username and password. The error is credential error. Is there a way to fix it ?

docker run --name=avery-openldap-containernew02 -p 389:389 --volume backup.lidf:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif osixia/openldap:1.2.1 --copy-service

condescendent commented 6 years ago

[root@jasontest jyu]# docker exec avery-openldap-containernew02 ldapsearch -x -H ldap://localhost -b dc=avery,dc=com -D "cn=admin,dc=avery,dc=com" -w config ldap_bind: Invalid credentials (49) [root@jasontest jyu]# docker exec avery-openldap-containernew02 ldapsearch -x -H ldap://localhost -b dc=avery,dc=com -D "cn=admin,dc=avery,dc=com" -w e1NTSEF9em92VGU2c0RKRFFjSkV6Snp2a3psWWU4RCt5dFRoTFI= ldap_bind: Invalid credentials (49) [root@jasontest jyu]# docker exec avery-openldap-containernew02 ldapsearch -x -H ldap://localhost -b dc=avery,dc=com -D "cn=Manager,dc=avery,dc=com" -w e1NTSEF9em92VGU2c0RKRFFjSkV6Snp2a3psWWU4RCt5dFRoTFI= ldap_bind: Invalid credentials (49) [root@jasontest jyu]#

condescendent commented 6 years ago

root@5209a03affb5:/# ls -alth /etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif -rw------- 1 openldap openldap 654 May 22 00:18 /etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif root@5209a03affb5:/# cat /etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif

AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.

CRC32 4791163c

dn: olcDatabase={0}config objectClass: olcDatabaseConfig olcDatabase: {0}config olcAccess: {0}to by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=extern al,cn=auth manage by break olcRootDN: cn=admin,cn=config structuralObjectClass: olcDatabaseConfig entryUUID: 6476f17c-f1a1-1037-84cd-b7682c969050 creatorsName: cn=config createTimestamp: 20180522001827Z olcRootPW:: e1NTSEF9em92VGU2c0RKRFFjSkV6Snp2a3psWWU4RCt5dFRoTFI= entryCSN: 20180522001827.728419Z#000000#000#000000 modifiersName: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth modifyTimestamp: 20180522001827Z root@5209a03affb5:/# LDAPNOINIT=1 ldapsearch -x -W -D 'cn=admin,dc=example,dc=com' -b "" -s base Enter LDAP Password: ldap_bind: Invalid credentials (49) root@5209a03affb5:/# LDAPNOINIT=1 ldapsearch -x -W -D 'cn=admin,dc=example,dc=com' -b "" -s base Enter LDAP Password: ldap_bind: Invalid credentials (49) root@5209a03affb5:/# ldapsearch -x -W -D 'cn=admin,dc=example,dc=com' -b "" -s base -H ldap://localhost Enter LDAP Password: ldap_bind: Invalid credentials (49) root@5209a03affb5:/#