我有一个运行结构的 LDAP 服务器:
dc=example,dc=ldap
dc=organisations
o=orga1 (objectClasses top/organisation/dcObject)
cn=ADMINS (objectClasses top/groupOfNames)
cn=USER
o=orga2
cn=ADMIN
cn=USER
cn=users (objectClasses top/organisation/dcObject)
cn=user1 (objectClasses top/person)
cn=user2
现在我想添加一些规则,只有组织组中的用户才能看到组织。
硬编码方法很容易实现:
olcAccess: {1}to dn.subtree="o=orga1,dc=organizations,dc=example,dc=ldap"
by group.exact="cn=ADMINS,o=orga1,dc=organizations,dc=example,dc=ldap" write
by group.exact="cn=USER,o=orga1,dc=organizations,dc=example,dc=ldap" read
by * none
(重要的是在'by'前面写两个空格[这对我来说是很长一段时间的问题])
但是我不想为每个新组织实施这些规则,所以我尝试用一些正则表达式来实施规则。但我失败得很惨:
olcAccess: {1}to dn.regex="^o(.+),dc=organizations,dc=example,dc=ldap$"
attrs=children
by group.exact="cn=ADMINS,o=[$1],dc=organizations,dc=example,dc=ldap$" write
by group.exact="cn=USER,o=[$1],dc=organizations,dc=example,dc=ldap$" read
by * none
这条规则没有任何影响。那么有人有什么想法来解决我的问题吗?
还是不能像我一样对成员进行分组?
再次感谢