python - 自签名证书的 LDAP 连接问题

标签 python ldap

我使用的代码:

# Create LDAPObject instance
conn = ldap.initialize(url)
conn.protocol_version=ldap.VERSION3

conn.simple_bind_s(binddn,bindpw)
# This raises:
# ldap.SERVER_DOWN: 
    {'info': 'error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 'desc': "Can't contact LDAP server"}

当我使用 ldap://而不是 ldaps://时,它工作正常。

谁能帮我弄清楚这是为什么?

谢谢。 :)

最佳答案

我来这里是为了寻找与此相关的问题的解决方案。此问答没有解决我的确切问题,但其他寻找我的确切问题解决方案的人会发现以下有用的信息:

对于那些使用 SSL/TLS 进行基本传输加密而非身份验证(自签名证书)的用户,您只需关闭对服务器证书的严格检查:

ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)

这大致类似于设置 OpenLDAP 2.1+ 客户端设置:

tls_checkpeer no

关于python - 自签名证书的 LDAP 连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3495739/

相关文章:

spring - 404 Error on/spring_security_login 从 Tomcat 6 迁移到 Tomcat 7 后的 Spring Security 3.2

java - 子错误代码 568 对于 Active Directory 的 Ldap 错误 49 意味着什么

linux - LDAP:slapd 和 openldap

python - Numpy:尝试在数组切片的切片上设置值

Python - wxPython 中的自定义样式

python - 查询错误 - 缺少表的 FROM 子句条目 - SQL

php - 更新 : Apache Chokes on PHP ldap_connect() Call

node.js - 在权限管理方面,Active Directory 是否仍能与 Node.js 模块相媲美?

python - 如何添加一个列表,从子进程传递到父进程,到python中已经存在的列表

python - 在 Atom 中调试 python?