ldapadd添加没有userPasswords的条目

时间:2017-09-18 11:04:34

标签: ldap openldap

我有一个从这个LDIF导入的LDAP数据库:

dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: hdb
olcDbDirectory: /var/lib/ldap-jenkins
olcSuffix: dc=example,dc=com
olcRootDN: cn=admin,dc=example,dc=com
olcRootPW:: e1NTSEF9YmkzUDlFa1ZycDJMb2JDRDZoRmJmNkpLR2xhNWV2Q1doQzBOWmc9PQ==
olcDbIndex: uid eq
olcDbIndex: mail eq
olcDbIndex: entryCSN eq
olcDbIndex: entryUUID eq
olcDbIndex: objectClass eq
olcAccess: to attrs=userPassword,shadowLastChange
  by self write
  by dn="cn=admin,dc=example,dc=com" write
  by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" write
  by anonymous auth
  by * none
olcAccess: to *
  by self write
  by dn="cn=admin,dc=example,dc=com" write
  by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" manage
  by dn="cn=jenkins,dc=example,dc=com" read
  by * none

我尝试使用# ldapadd -c -Y EXTERNAL -H ldapi:/// -f darth_vader.ldif导入此条目:

dn: mail=darth.vader@death.star,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: simpleSecurityObject
objectClass: person
cn: Anakin
sn: Skywalker
mail: darth.vader@death.star
userPassword: e1NTSEF9LzVHNXczbUViYnlJaE5CM0RBdGRjS3I3c1hYN085em90d3B3QWc9PQ==

导入条目,但没有userPassword。怎么了?

1 个答案:

答案 0 :(得分:2)

所以,问题是我连接数据库的方式,而不是导入。我使用jenkins用户进行连接,该用户无法访问ACL中指定的userPassword属性。他只是没有看到那个属性。

我需要做的是为他添加一些权限:

olcAccess: to attrs=userPassword,shadowLastChange
  by self write
  by dn="cn=admin,dc=example,dc=com" write
  by dn="cn=jenkins,dc=example,dc=com" read
  by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" write
  by anonymous auth
  by * none

阅读已经足够了,但是,authcompare这样的较低级别也可能会有效。