首页 > 解决方案 > OpenLDAP 编辑 userPassword 属性 ACL

问题描述

我尝试创建可以读取其他用户密码的用户。我尝试编辑 openLDAP 中已经存在的 ACL,所以我写道:

dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {1}to attrs=userPassword 
 by self write 
 by anonymous auth 
 by dn="cn=admin,dc=playground,dc=test,dc=local" write 
 by dn="cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local" read 
 by * none

我这边对上面 olcAccess ACL 的唯一修改是:
by dn="cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local" 阅读

在我这样做之后(通过 ldapmodify)我失去了以 usermanager 身份浏览 ldap 树的能力,但我可以登录,例如:
ldapsearch -x -D "cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local" -W -LLL
返回:No such object (32)
ldapwhoami -x -D "cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local" -W -LLL
返回:dn:cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local

问题是:如何编写此 ACL 以授予用户usermanager读取其他用户密码的权限?

标签: ldapaclopenldap

解决方案


解决了:

dn: olcDatabase={1}mdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {1}to attrs=userPassword 
 by self write 
 by anonymous auth 
 by dn="cn=admin,dc=playground,dc=test,dc=local" write  
 by dn="cn=usermanager,ou=cloud,o=customer1,dc=playground,dc=test,dc=local" read  
 by * none 

如果有人想使用它,请手动编写而不是复制粘贴,因为 ldifs 对空格和行尾非常敏感。


推荐阅读