2017-01-23 4 views
0

J'ai essayé d'appliquer ce dlif à mon serveur OpenLDAP:Comment permettre correctement un accès utilisateur donné à jour un enregistrement sur OpenLDAP

$ cat acl.ldif 
dn: olcDatabase={1}hdb,cn=config 
changetype: modify 
add: olcAccess 
olcAccess: {3}to dn.exact="cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com" attrs="ipServicePort,description" by dn="[email protected],ou=people,dc=thedomain,dc=com" write by * read 

Je crois que cela devrait permettre à l'utilisateur avec DN: "[email protected],ou=people,dc=thedomain,dc=com" mettre à jour le attributs ipServicePort et description sur "cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com"

Cela semble s'appliquer bien:

$ sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f acl.ldif 
SASL/EXTERNAL authentication started 
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth 
SASL SSF: 0 
modifying entry "olcDatabase={1}hdb,cn=config" 

Quand je la recherche que je peux trouver mon jour e nEssayez:

$ sudo ldapsearch -Y EXTERNAL -H ldapi:// -b cn=config 'olcDatabase={1}hdb' 
SASL/EXTERNAL authentication started 
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth 
SASL SSF: 0 
# extended LDIF 
# 
# LDAPv3 
# base <cn=config> with scope subtree 
# filter: olcDatabase={1}hdb 
# requesting: ALL 
# 
# {1}hdb, config 
dn: olcDatabase={1}hdb,cn=config 
objectClass: olcDatabaseConfig 
objectClass: olcHdbConfig 
olcDatabase: {1}hdb 
olcDbDirectory: /var/lib/ldap 
olcSuffix: dc=thedomain,dc=com 
olcAccess: {0}to attrs=userPassword,shadowLastChange by self write by anonymou 
s auth by dn="cn=admin,dc=domain,dc=ie,dc=aws,dc=thedomain,dc=net" write by * n 
one 
olcAccess: {1}to dn.base="" by * read 
olcAccess: {2}to * by dn="cn=admin,dc=domain,dc=ie,dc=aws,dc=thedomain,dc=net" w 
rite by * read 
olcAccess: {3}to dn.exact="cn=ldap-city-thedomain-com,dc=repl,dc=thedomain, 
dc=com" attrs="ipServicePort,description" by dn="[email protected],ou=p 
eople,dc=thedomain,dc=com" write by * read 
olcLastMod: TRUE 
olcRootDN: cn=admin,dc=thedomain,dc=com 
olcRootPW: {SSHA}HASHEDPW 
olcSyncrepl: {0}rid=003 provider=ldap://ldap.city.thedomain.com binddn="cn 
=admin,dc=thedomain,dc=com" bindmethod=simple credentials=Cju8MJZhegnEgKp2nU s 
earchbase="dc=thedomain,dc=com" type=refreshAndPersist interval=00:00:00:10 re 
try="5 5 300 5" timeout=1 
olcSyncrepl: {1}rid=004 provider=ldap://ldap1.domain.ie.aws.thedomain.net binddn 
="cn=admin,dc=thedomain,dc=com" bindmethod=simple credentials=Cju8MJZhegnEgKp2 
nU searchbase="dc=thedomain,dc=com" type=refreshAndPersist interval=00:00:00:1 
0 retry="5 5 300 5" timeout=1 
olcMirrorMode: TRUE 
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: entryCSN eq 
olcDbIndex: entryUUID eq 
# search result 
search: 2 
result: 0 Success 
# numResponses: 2 
# numEntries: 1 

Cependant, lorsque je tente de faire un changement en utilisant ces informations d'identification, il échoue encore:

$ cat /tmp/modify.ldif 
dn: cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com 
changetype: modify 
replace: ipServicePort 
ipServicePort: 1485176342 

dn: cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com 
changetype: modify 
replace: description 
description: Updated by ldap.city.thedomain.com on Mon Jan 23 12:59:02 UTC 2017 

Course à pied:

$ ldapmodify -H ldap://localhost -w PASSWORD -D "[email protected],ou=people,dc=thedomain,dc=com" -f /tmp/modify.ldif   
modifying entry "cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com" 
ldap_modify: Insufficient access (50) 

J'ai aussi essayé de faire mon ACL un peu moins restrictive pour essayer de comprendre ce qui ne fonctionnait pas, je l'ai essayé les fichiers acl.ldif suivants:

dn: olcDatabase={1}hdb,cn=config 
changetype: modify 
add: olcAccess 
olcAccess: {3}to dn="cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com" attrs="ipServicePort,description" by dn="[email protected],ou=people,dc=thedomain,dc=com" write by * read 

résultat a été le même

dn: olcDatabase={1}hdb,cn=config 
changetype: modify 
add: olcAccess 
olcAccess: {3}to dn="cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com" by dn="[email protected],ou=people,dc=thedomain,dc=com" write by * read 

résultat a été le même

dn: olcDatabase={1}hdb,cn=config 
changetype: modify 
add: olcAccess 
olcAccess: {3}to * by dn="[email protected],ou=people,dc=thedomain,dc=com" write by * read 

résultat a été le même

La seule chose que je ne l'ai pas essayé encore, comme je l'espérais éviter faire de la db cette insécurité, même pendant les tests, était de permettre * d'écrire cet enregistrement, ou * d'écrire dans tous les enregistrements.

J'ai pris la dn du dossier que je veux permettre l'édition à partir d'Apache Directory Studio, qui me montre:

DN: cn=ldap-city-thedomain-com,dc=repl,dc=thedomain,dc=com 

Et mes utilisateurs DN de la même:

DN: [email protected],ou=people,dc=thedomain,dc=com 

Je suis sûr que je fais quelque chose de manifestement idiot, car ma connaissance de ldap est mauvaise et lire la documentation est pénible pour moi. J'espère que quelqu'un peut repérer mon erreur évidente et suggérer une correction que je ne vois pas ce que je l'ai fait mal après un grand nombre d'heures de bricoler.

Répondre

0

Merci à JoBbZ en #openldap IRC. C'est un simple malentendu de ma part. L'ordre est important dans les règles ACL. LDAP cesser de regarder le premier match, donc je dois sauver mon olcAccess comme 2 pas 3