Wie ersetzt man olcAccess-Zeilen richtig mit ldapmodify?

Wie ersetzt man olcAccess-Zeilen richtig mit ldapmodify?

Dies ist ein Teil von olcDatabase={1}hdb.ldif

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

Ich möchte by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" writean die {0}„und“ {2}-Zeile etwas anhängen.

Bevor ich meinen LDAP-Server zerstöre,ist das folgende LDIF korrekt?

dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read

Mit:ldapmodify -Y EXTERNAL -H ldapi:/// -f ./changes.ldif

Meine Bedenken sind:

  • es gibt 3 olcAccess:Zeilen, ich habe die Zeile {1} nicht eingefügt. Wäre sie also nach dem Übernehmen der LDIF-Änderungen noch da?
  • ist die replace: olcAccessZeile richtig?

Antwort1

Dieses ldif hat bei mir funktioniert, mit dem vorherigen Befehl

dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read

verwandte Informationen