在OpenLDAP中找不到用户cn = config?

我们在Ubuntu 10.04上运行OpenLDAP。 我可以访问和使用前端cn=admin,dc=ourcompany,dc=com和我的密码。

但是我无法更改存储在cn=config的服务器configuration(如loglevel),因为我似乎没有有效的用户/密码的后端?

一些例子:

 # ldapsearch SASL/DIGEST-MD5 authentication started Please enter your password: ldap_sasl_interactive_bind_s: Invalid credentials (49) additional info: SASL(-13): user not found: no secret in database 

要么

 # ldapadd -x -D "cn=admin,cn=config" -W -f "my.ldif"" Enter LDAP Password: ldap_bind: Invalid credentials (49) 

如何为cn=config backend创build一个用户?

Ubuntu默认configuration设置cn = admin,dn = example,dn = com作为root dn作为后端,但需要以root身份进行SASLauthentication才能修改联机configuration。 您可以使用:

 sudo ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config olcAccess 

列出您的configuration的ACL

添加你的ldif文件尝试:

 sudo ldapadd -Q -Y EXTERNAL -H ldapi:/// -f "my.ldif" 

假定LDAP服务器在本地机器上。 如果您希望原始命令能够正常工作,则需要添加cn = admin,cn = config用户,并将其指定为cn = config数据库的rootdn,或者设置一个ACL来授予她访问权限。

我无法使用ldap工具添加rootdn,即使是root用户,我也无法添加/修改cn = config DIT的ACL。 我假设,虽然根授予pipe理员访问权限,添加一个rootDN是不够的。 因此,要为在线configuration添加rootDN,您需要手动编辑configuration。 这是不鼓励的,因为它可以打破slapd。

您需要使用slappasswd生成密码哈希,例如“somesecret”slappasswd可能会生成{SSHA} Hg / mI0rBWab3HCysr55B4Ew7 / QmK0LBa

现在你可以添加RootDN了。 首先停止slapd

 sudo service slapd stop 

接下来使用你select的编辑器编辑/etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif(例如nano)

 sudo nano /etc/ldap/slapd.d/cn\=config/olcDatabase\=\{0\}config.ldif 

然后在行“structuralObjectClass:olcDatabaseConfig”之前添加以下行

 olcRootDN: cn=admin,cn=config olcRootPW: {SSHA}Hg/mI0rBWab3HCysr55B4Ew7/QmK0LBa 

然后重新启动slapd

 sudo service slapd start 

您现在可以通过使用cn = admin,cn = config;的简单绑定来修改cn = config DIT。 不过,我不相信这是一个好主意。 我更喜欢ssh进入服务器并以root身份访问configuration。 然而,有些人认为这样做会破坏在线configuration的全部优点,只要拥有必要的凭据,您就可以在不使用任何LDAP浏览器停止slapd的情况下修改configuration。