LDAP 更改用户密码
据我所知,在 PHP 中,我们需要通过 SSL 连接 LDAP 才能更改用户密码。
有没有其他方法,EG,其他语言(JAVA / ASP)来更改LDAP密码而不需要SSL?
更新:
当我尝试修改我的帐户密码时,我收到警告:ldap_mod_replace() [function.ldap-mod-replace]:修改:访问权限不足”
。
如果我尝试更改其他用户密码时,我没有收到错误消息,但密码仍然保留旧密码。
As I know, in PHP, we need to connect LDAP over SSL in order to change the user password.
Is there another way, E.G, other languages (JAVA / ASP) to change the LDAP password without SSL required?
Updates:
I get Warning: ldap_mod_replace() [function.ldap-mod-replace]: Modify: Insufficient access"
when I try to modify my account password.
If I try to change other user passwords, I get no error message, but the password still sticks to the old one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
许多 LDAP 实现确实需要 SSL 或 TLS 才能更改/设置密码。这是 LDAP 服务器设置的要求,而不是用于访问它的语言。更改语言将不允许您覆盖此特定的服务器要求。
我知道在某些情有可原的情况下,您可能无法建立 SSL/TLS 连接,但一般来说,您绝对希望像这样加密密码函数 - 即使服务器不需要它。
编辑:我打赌答案可以在 slapd 日志中找到。还值得查看 ACL:OpenLDAP 软件 2.4 管理员指南,第 8 节:访问控制。
Many LDAP implementations do indeed require SSL or TLS in order to change/set passwords. This is a requirement set by the LDAP server, not the language used to access it. Changing languages will not permit you to override this particular server requirement.
I understand that there are extenuating circumstances where you may not be able to establish a SSL/TLS connection, but in general, you absolutely want to be encrypting password functions like this - even if the server doesn't require it.
Edit: I bet the answer can be founds in the slapd logs. Also worth reviewing the ACLs: OpenLDAP Software 2.4 Administrator's Guide, Section 8. Access Control.
该目录将密码值存储在用户的 userPassword 属性中
入口。根据服务器的访问控制设置,用户可以设置
userPassword 的值符合您指定的密码策略,使用
标准工具,例如 ldapmodify。
The directory stores password values in the userPassword attribute of the user
entry. Depending on the access control settings for the server, users may set the
value of userPassword in accordance with the password policy you specify, using
standard tools, such as ldapmodify for example.
有
ldappasswd
实用程序。例如,如果返回了
referral
,那么您需要尝试该服务器。通常当有一台主服务器和多台只读服务器时。There is the
ldappasswd
utility. e.g.If
referral
is returned, then you need to try that server instead. Usually when there is one master server and multiple read-only servers.您使用的是 OpenLDAP 或 Active Directory?它们都需要安全连接才能让您更改密码。
您无法使用 ldap_mod_replace 通过 PHP 更改 Active Directory 密码,如果您不是管理员,则必须使用 ldap_modify_batch。
看一下:https://msdn.microsoft.com/en-us/ library/cc223248.aspx
如果您使用替换(您不发送旧密码),则只有管理员可以更改密码。但是,如果您使用带有删除(使用旧密码)和添加(使用新密码)的批处理,则用户可以更改他/她自己的密码: http://php.net/ldap-modify-batch
Are you using OpenLDAP or Active Directory? Both of them needs a secure connection to let you change your password.
You can't change your Active Directory password with PHP using ldap_mod_replace, you must use ldap_modify_batch if you are not an administrator.
Take a look: https://msdn.microsoft.com/en-us/library/cc223248.aspx
If you use replace (you doesn't send your old password) only administrators can change passwords. But if you use a batch with a delete (with your old password) and an add (with new one), then a user could change his/her own password: http://php.net/ldap-modify-batch
实际上,您可以在 PHP 中执行此操作,无需使用 PHP
COM
扩展的 SSL / TLS 连接(但是使用COM
意味着您需要为您的应用程序使用 Windows 操作系统)。使用
COM
还可以绕过 AD 服务器的密码策略复杂性要求(不知道为什么)。Actually, you can do this in PHP, without an SSL / TLS connection using PHPs
COM
extension (however usingCOM
means you're required to use a Windows OS for your application).Using
COM
also by-passes your AD server's password policy complexity requirements (not sure why).使用 RootDN 绑定更改用户密码
Changing a User’s Password Using the RootDN Bind