2013-08-06 52 views
0

d我試圖使用openldap作爲中央認證系統,以及存儲一些基於用戶類型的數據。動態訪問控制在openldap ldap

我的LDAP DIT結構如下

     domain 
Superuser    Users    data 
       User1 user2 user3  Entry1 Entry2 

隨着每一個用戶輸入I有固定的身份驗證字符串,......例 -
爲USER1

authstring=Entry1-RW #allowing entry1 to be readable and writable 
authstring=Entry2.R #allowing entry2 to be readable 

,同樣,對於user2

authstring=*.RW  #allowing all entries to be readable and writable 

如何在沒有硬件的情況下定義我的slapd.conf爲了實現這個功能,所有的情況?
通常我們只能用dn來定義訪問控制。
我可以使用attrs限制訪問控制定義嗎?

access to dn.regex=uid=[^,]ou=data,dc=my-domain,dc=com 
    by dn="uid=.*,ou=users,dc=my-domain,dc=com" filter=authstring=$1.RW 

回答

0

我能做到以下幾點:(uid是它可能是CN的數據條目的屬性也)

access to dn.regex="uid=[^,]+,ou=data,dc=my-domain,dc=com" 
    by set.expand="this/uid & user/authstring" write 

但仍然問題是,我必須寫單獨ATTR對於每個的DataEntry和每種類型的權限 例: 對於用戶1:

authstringread:Entry1 
authstringreadwrite:Entry2 

和訪問控制設置將是

access to dn.regex=uid=[^,],ou=data,dc=my-domain,dc=com 
    by set.expand="this/uid & user/authstringreadwrite" write 
    by set.expand="this/uid & user/authstringread"  read 
-3

你當然可以限制使用ATTRS無論哪種方式的ACL方法:

用戶1:

aci: (targetattr=*)(targetfilter="(entryCategory=Entry1)")(version 3.0; acl "read-write"; allow (read, write)userdn ="ldap:///uid=user1,dc=example,dc=com";) 
aci: (targetattr=*)(targetfilter="(entryCategory=Entry2)")(version 3.0; acl "read"; allow (read)userdn ="ldap:///uid=user1,dc=example,dc=com";) 

對於用戶2:

aci: (targetattr=*)(targetfilter="(|(entryCategory=Entry1)(entryCategory=Entry2)")(version 3.0; acl "read-write"; allow (write)userdn ="ldap:///uid=user2, dc=example,dc=com";) 

同樣,您可以允許任何人具有特定的讀取或寫入權限。

aci: (version 3.0; acl "anonymous-read-search";allow (read, write) userdn = "ldap:///anyone";) 

針對特定用戶組:

userdn = "ldap:///uid=b*,c=example.com ||ldap:///cn=b*,dc=example,dc=com"; 

結帳此鏈接多個讀數:

http://docs.oracle.com/cd/E22289_01/html/821-1277/bind-rule-syntax.html#defining-anonymous-access-anyone-keyword

希望這有助於。

謝謝,約翰

+0

錯誤的產品。他問的是OpenLDAP。 – EJP

+0

這些ACI不是產品細節。鏈接只是作爲幫手。 –

+0

我不確定我們是否可以在openldap中以這種方式編寫它,我會嘗試...謝謝 – Gaurav