我使用它在docker内部执行ldap服务器:https://github.com/osixia/docker-openldap
我配置了docker-compose环境:
taiga_openldap:
image: osixia/openldap:latest
container_name: taiga_openldap
ports:
- "389:389"
- "636:636"
environment:
LDAP_LOG_LEVEL: 256
LDAP_ORGANISATION: taiga
LDAP_BASE_DN: ou=People,dc=openldap
LDAP_ADMIN_PASSWORD: password
LDAP_DOMAIN: openldap
LDAP_TLS: false
之后,当我执行我的docker-compose服务器并尝试连接到LDAP(信息打印)时:
print('server ' + str(server.__dict__))
print('auto_bind ' + str(auto_bind))
print('client_strategy' + str(SYNC))
print('user'+ str(service_user))
print('password'+ str(service_pass))
print('authentication'+ str(service_auth))
c = Connection(server, auto_bind=auto_bind, client_strategy=SYNC, check_names=True,
user=service_user, password=service_pass, authentication=service_auth)
data = connect_to_ldap_server(server, c, auto_bind, search_filter, password)
我得到了这个结果和错误:
taiga_back | Failed to authenticate against LDAP ldap://openldap:389
taiga_back | server {'ipc': False, 'host': 'openldap', 'port': 389, 'allowed_referral_hosts': [('*', True)], 'ssl': False, 'tls': None, 'name': 'ldap://openldap:389', 'get_info': 'NO_INFO', '_dsa_info': None, '_schema_info': None, 'dit_lock': <unlocked _thread.lock object at 0x7f94d4307300>, 'custom_formatter': None, 'custom_validator': None, '_address_info': [], '_address_info_resolved_time': datetime.datetime(1, 1, 1, 0, 0), 'current_address': None, 'connect_timeout': None, 'mode': 'IP_V6_PREFERRED'}
taiga_back | auto_bind NO_TLS
taiga_back | client_strategySYNC
taiga_back | usercn=admin,dc=openldap
taiga_back | passwordpassword
taiga_back | authenticationSIMPLE
taiga_back | Error: invalid server address
taiga_back | Failed to authenticate against LDAP
^[^[[A^[[Btaiga_openldap | 5e9d8c0f conn=1003 fd=13 ACCEPT from IP=172.30.0.1:53912 (IP=0.0.0.0:389)
taiga_openldap | 5e9d8c0f conn=1003 op=0 BIND dn="cn=admin,dc=openldap" method=128
taiga_openldap | 5e9d8c0f conn=1003 op=0 BIND dn="cn=admin,dc=openldap" mech=SIMPLE ssf=0
taiga_openldap | 5e9d8c0f conn=1003 op=0 RESULT tag=97 err=0 text=
taiga_openldap | 5e9d8c0f conn=1003 op=1 SRCH base="" scope=2 deref=0 filter="(objectClass=*)"
taiga_openldap | 5e9d8c0f conn=1003 op=1 SEARCH RESULT tag=101 err=32 nentries=0 text=
taiga_openldap | 5e9d8c0f conn=1003 op=2 UNBIND
taiga_openldap | 5e9d8c0f conn=1003 fd=13 closedldap://openldap:389
之后,我尝试进入容器并检查是否已定义所有变量:
HOSTNAME=7b7dc1357209
LANGUAGE=en_US:en
PWD=/
LDAP_BASE_DN=ou=People,dc=openldap
HOME=/root
LANG=en_US.UTF-8
LDAP_ORGANISATION=taiga
TERM=xterm
LDAP_DOMAIN=openldap
LDAP_TLS=false
SHLVL=1
LDAP_LOG_LEVEL=256
LC_ALL=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LDAP_ADMIN_PASSWORD=password
_=/usr/bin/env
OLDPWD=/container
我下载了Apache Directory Studio
。
找到了这个[LDAP: error code 32 - No Such Object]
我做到了:
并收到了此消息:
# extended LDIF
#
# LDAPv3
# base <> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# search result
search: 2
result: 32 No such object