我正在将 Ubuntu 14.04 OpenLDAP 服务器升级到 16.04 并遇到障碍。有一个 (localhost) 导入脚本,用于ldapdelete -r -Y EXTERNAL -H ldapi:///...
删除一些 OU,然后用新信息重新填充它们。由于我怀疑是缺少/更改的olcAccess
属性,这失败了。任何人都知道为什么这不起作用?
我已经从脚本中手动运行了一行,结果如下:
# ldapdelete -r -Y EXTERNAL -H ldapi:/// "ou=people,dc=my,dc=org"
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
ldap_delete: Insufficient access (50)
additional info: no write access to parent
我可以使用olcRootDn
成功删除 OU,但这需要将 rootdn 密码放在我不想这样做的地方。
# ldapdelete -x -D "cn=admin,dc=my,dc=org" -W -h ldap1 "ou=people,dc=my,dc=org"
Enter LDAP Password:
# ldapdelete -x -D "cn=admin,dc=my,dc=org" -W -h ldap1 "ou=people,dc=my,dc=org"
Enter LDAP Password:
ldap_delete: No such object (32)
matched DN: dc=my,dc=org
我已经跑去slapcat
查看olcAccess
属性——似乎dn-exact=...
条目应该提供正确的权限,但这一定是不正确的。
dn: olcBackend={0}hdb,cn=config
objectClass: olcBackendConfig
olcBackend: {0}hdb
dn: olcDatabase={-1}frontend,cn=config
objectClass: olcDatabaseConfig
objectClass: olcFrontendConfig
olcDatabase: {-1}frontend
olcAccess: {0}to * by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external
,cn=auth manage by * break
olcAccess: {1}to dn.exact="" by * read
olcAccess: {2}to dn.base="cn=Subschema" by * read
olcSizeLimit: 500
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
olcAccess: {0}to * by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external
,cn=auth manage by * break
dn: olcDatabase={1}hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcDbDirectory: /var/lib/ldap
olcSuffix: dc=my,dc=org
olcAccess: {0}to attrs=userPassword by self write by anonymous auth by * none
olcAccess: {1}to attrs=shadowLastChange by self write by * read
olcAccess: {2}to * by * read
olcLastMod: TRUE
olcRootDN: cn=admin,dc=my,dc=org
olcRootPW: {SSHA}(removed)...
olcDbCheckpoint: 512 30
olcDbConfig: {0}set_cachesize 0 2097152 0
olcDbConfig: {1}set_lk_max_objects 1500
olcDbConfig: {2}set_lk_max_locks 1500
olcDbConfig: {3}set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcDbIndex: cn,uid eq
olcDbIndex: uidNumber,gidNumber eq
olcDbIndex: member,memberUid eq
根据您对{1}hdb数据库的配置,缺少适用于 root 系统用户的 ACL。您应该添加:
olcAccess: {0}to * by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external ,cn=auth manage by * break
此 ACL必须是此数据库的第一个(索引 {0})
{-1}前端数据库中的相同 ACL被附加到{1}hdb的 ACL 列表中。这意味着添加在此列表的末尾,即在“olcAccess: {2}to * by * read”之后。“to * by * read”指令导致 ACL 引擎停止处理,只有读取权限。
从OpenLDAP 管理员指南(参见5.2.5.2.):