ldap oclAccess 似乎不适用于 pwdPolicy

ldap oclAccess does not seem to work with pwdPolicy

我已经在 Ubuntu 14.04 上安装了 ldap 2.4.3。我已经配置了 pwdPolicy 覆盖,它在用户更改 his/her 自己的密码和管理员更改密码时起作用。问题是当管理员更改密码时,策略没有得到遵守。因此,我创建了另一个名为 usermanagement 的帐户并将 dn 添加到 oclAccess。除了 userpassword 之外,我可以使用用户管理帐户修改我尝试过的所有字段。

当 运行 ldappasswd 我得到 Insufficient access (50)

这是我的 olcAccess:

olcAccess: {0}to attrs=userPassword,shadowLastChange by self write by dn="cn=admin,dc=zed,dc=com" write by dn="cn=usermanagement,dc=zed,dc=com" write by anonymous auth by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by self write by dn="cn=admin,dc=zed,dc=com" write by dn="cn=usermanagement,dc=zed,dc=com" write by * read

编辑

我启用了调试然后执行了ldappasswd -H ldap://localhost -x -D "uid=luis,ou=users,dc=zed,dc=com" -W -S "uid=vixian,ou=users,dc=zed,dc=com"。日志显示:

983c0f8 bdb_dn2entry("cn=passworddefault,ou=policies,dc=zed,dc=com")
5983c0f8 => bdb_entry_get: found entry: "cn=passworddefault,ou=policies,dc=zed,dc=com"
5983c0f8 bdb_entry_get: rc=0
5983c0f8 change password must use DELETE followed by ADD/REPLACE
5983c0f8 send_ldap_result: conn=1004 op=1 p=3
5983c0f8 send_ldap_result: err=50 matched="" text="Must supply old password to be changed as well as new one"
5983c0f8 send_ldap_extended: err=50 oid= len=0
5983c0f8 send_ldap_response: msgid=2 tag=120 err=50

然后我尝试使用 ldapmodify 删除用户密码,它成功了,但替换或添加产生了相同的结果权限被拒绝。

我已经按照@ejp 的建议更新了 olcAccess:

olcAccess: {0}to attrs=userPassword,shadowLastChange 
    by group/groupOfUniqueNames/uniqueMember.exact="cn=itinst,ou=groups,dc=zed,dc=com" write 
    by anonymous auth 
    by self write
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * 
    by self write 
    by group/groupOfUniqueNames/uniqueMember.exact="cn=itinst,ou=groups,dc=zed,dc=com" write 
    by users read by anonymous search

The problem is that when admin changes the password the policies are not adhered.

managerDN 更改密码时 'the policies are not adhered'。您不应该将 managerDN 用于 任何事情。 这是服务器运行的帐户,当然它可以做任何事情。您应该在 DIT 中定义一个单独的 admin 帐户 ,并赋予它适当的访问权限,就像我在下面的示例中对整个 ldap admins 组所拥有的那样。

与你的olcAccess没有任何关系。查看文档以了解如何正确执行此操作。我有:

olcAccess {0}to attrs=userPassword
  by dn.base="cn=replicator,dc=verismart,dc=com,c=us" write
  by group/groupOfUniqueNames/uniqueMember.exact="cn=ldap admins,ou=groups,dc=verismartlabs,dc=com" write
  by group/groupOfUniqueNames/uniqueMember.exact="cn=applications,ou=groups,dc=verismartlabs,dc=com" write
  by anonymous auth  by self write
olcAccess {1}to dn.base=""  by * read
olcAccess {2}to *
  by self write
  by dn.base="cn=replicator,dc=verismart,dc=com,c=us" write
  by group/groupOfUniqueNames/uniqueMember.exact="cn=ldap admins,ou=groups,dc=verismartlabs,dc=com" write
  by group/groupOfUniqueNames/uniqueMember.exact="cn=applications,ou=groups,dc=verismartlabs,dc=com" write
  by users read
  by anonymous search

编辑 当您使用 ppolicy 叠加层时:

  1. 您应该使用 -e ppolicy 参数 ldappasswd 以便您可以看到扩展响应(如果有的话)。
  2. 用户还必须使用 ldappasswd-a 选项来指定旧密码,如日志中所建议的,或者 -A 获取它以提示您输入。更改日志显示 change password must use DELETE followed by ADD/REPLACE,这意味着您必须同时提供旧密码和新密码。 ldappasswd 将为旧值发送 DELETE,为新值发送 ADD 或 REPLACE。
  3. 如何让管理员在不知道旧密码的情况下执行此操作是另一个问题,看起来...通过应用程序为我工作,但我从未通过 ldappasswd 完成。也许 -e ppolicy 也是答案。

编辑 2 这是因为您的密码策略中有 pwdSafeModify=TRUE。这个相当无用的设置使得管理员不可能在不知道旧密码的情况下重置密码,如果知道旧密码,则根本不需要管理重置。我把它关掉了,但是我所有的密码都只能通过 Java 代码更改:一个给用户自己,另一个给管理员,所以我可以自己强制执行 pwdSafeModify