【发布时间】:2010-11-01 16:00:54
【问题描述】:
你知道如何在 Windows 上通过 python 创建一个兼容 ldap 的密码(首选 md5crypt)
我曾经在 Linux 中写过类似的东西,但 crypt 模块在 Windows 上不存在
char_set = string.ascii_uppercase + string.digits
salt = ''.join(random.sample(char_set,8))
salt = '$1$' + salt + '$'
pwd = "{CRYPT}" + crypt.crypt(str(old_password),salt)
【问题讨论】:
-
你没有。您配置 OpenLDAP 或任何您的 LDAP 服务器对密码本身进行哈希处理,并且您始终通过 LDAPS 以明文形式提供密码,即基于 SSL 的 LDAP。在存储和比较登录目的时,LDAP 将进行必要的散列。