无法查询 LDAP 副本

无法查询 LDAP 副本

我正在尝试设置具有副本的 LDAP 服务器,但遇到了一些问题。我有 2 个服务器 - ldap1.example.com(主服务器)和 ldap2.example.com(副本服务器)。运行搜索查询,例如 ldapsearch -D "cn=reader,dc=example,dc=com" -w -h ldap1.example.com -b "dc=example,dc=com "uid=testuser"

按预期返回数据。但是,运行相同的查询时,-h ldap2.example.com结果却

# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope subtree
# filter: uid=testuser
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1

尽管复制确实有效,但因为slapcat在副本上运行会返回所有数据。

我的syncrepl.ldif:

dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcSyncRepl
olcSyncrepl: rid=1
    provider=ldap://ldap1.example.com
    type=refreshAndPersist
    retry="30 10 600 10"
    interval=00:00:05:00
    searchbase=dc=example,dc=com
    scope=sub
    schemachecking=on
    binddn="cn=admin,dc=example,dc=com"
    credentials="supersecretpassword"
    starttls=yes
    tls_reqcert=allow

答案1

您的 ACL 不允许您绑定读取访问权限的 DN。

现在:

olcAccess: {0}to attrs=userPassword,shadowLastChange by self write
 by dn="cn=admin,dc=example,dc=com" write
 by anonymous auth
 by * none
olcAccess: {1}to *
 by self write
 by dn="cn=admin,dc=example,dc=com" write
 by * none

建议:

olcAccess: {0}to attrs=userPassword,shadowLastChange by self write
 by dn="cn=admin,dc=example,dc=com" write
 by anonymous auth
 by * none
olcAccess: {1}to *
 by self write
 by dn="cn=admin,dc=example,dc=com" write
 by users read
 by * none

相关内容