【发布时间】:2018-02-14 19:27:12
【问题描述】:
编写一个 Python 脚本,我想知道是否可以在不以明文形式写入密码的情况下绑定到 LDAP 服务器,如下例所示:
import ldap
l = ldap.open("myserver")
username = "cn=Manager, o=mydomain.com"
## I don't want to write the password here in plaintext
password = "secret"
l.simple_bind(username, password)
【问题讨论】:
-
是的,这是可能的,我通常使用 PyCrypto 将凭据加密到文件中。然后我会解密该文件并传递值。
标签: python ldap python-ldap