centos 7上的LDAP配置ACL

centos 7上的LDAP配置ACL,ldap,centos7,acl,Ldap,Centos7,Acl,我试图通过了解语法错误的位置来为Manager用户设置ACL 修改“olcDatabase={2}hdb”文件是否正确 我的终端命令: ldapmodify -a -x -D "cn=Manager,dc=gruppo6,dc=labreti,dc=it" -w root -H ldap:// -f acl.ldif 这就是错误: ldapmodify: invalid format (line 5) entry: "olcDatabase={2}hdb" acl.ldif: dn: olc

我试图通过了解语法错误的位置来为Manager用户设置ACL

修改“olcDatabase={2}hdb”文件是否正确

我的终端命令:

ldapmodify -a -x -D "cn=Manager,dc=gruppo6,dc=labreti,dc=it" -w root -H ldap:// -f acl.ldif
这就是错误:

ldapmodify: invalid format (line 5) entry: "olcDatabase={2}hdb"
acl.ldif:

dn: olcDatabase={2}hdb
changetype: modify
add: olcAccess
olcAccess:{0} to * by dn="cn=Manager,dc=gruppo6,dc=labreti,dc=it" manage by * break
{1} to attrs=userPassword by dn="cn=Manager,dc=gruppo6,dc=labreti,dc=it" write by self write by anonymous none by users none
{2} to attrs=loginShell by dn="cn=Manager,dc=gruppo6,dc=labreti,dc=it" write by self read by anonymous none by users none to attrs=uid,sn,homeDirectory by self write
{3} to dn.subtree="dc=gruppo6,dc=labreti,dc=it" by * read
olcDatabase={2}hdb.ldif:

# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify.
# CRC32 0c9c7626
dn: olcDatabase={2}hdb
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {2}hdb
olcDbDirectory: /var/lib/ldap
olcDbIndex: objectClass eq,pres
olcDbIndex: ou,cn,mail,surname,givenname eq,pres,sub
structuralObjectClass: olcHdbConfig
entryUUID: 05c622d2-9007-1039-808a-1106615e0d2d
creatorsName: cn=config
createTimestamp: 20191031084858Z
olcRootPW:: e1NTSEF9QXNRTGdiYjZ0RTltMjMwbHdFcW5VeE5ETzNxcE1qSXE=
olcSuffix: dc=gruppo6,dc=labreti,dc=it
olcRootDN: cn=Manager,dc=gruppo6,dc=labreti,dc=it
entryCSN: 20191031122732.077139Z#000000#000#000000
modifiersName: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
modifyTimestamp: 20191031122732Z
感谢大家的帮助,这里有两个问题:

  • 您试图在acl.ldif中使用错误的dn修改
    olcDatabase={2}hdb
    ,此条目应位于
    cn=config
    的子树中。您可以使用以下命令获取目标olcDatabase:

    slapcat -n 0 -a olcDatabase=hdb
    
    # Output 
    dn: olcDatabase={2}hdb,cn=config
    ...
    
  • 由于您正在修改现有条目,因此不需要
    ldapmodify
    命令中的
    -a
    标志(ldapadd):

    ldapmodify -x -D "cn=Manager,dc=gruppo6,dc=labreti,dc=it" -w root -H ldap:// -f acl.ldif
    
如果您的ldap管理器由于权限不足而无法修改此配置项(通过dn=“cn=manager,dc=gruppo6,dc=labreti,dc=it”manage),您仍然可以使用外部绑定(unix用户)执行此类操作:

ldapmodify -Y EXTERNAL -H ldapi:/// -f acl.ldif