目錄html
Directory Server 將ACI存儲在目錄條目的多值屬性中。設置ACI時,將aci
添加到響應的目錄條目。數據庫
Root DSE
條目的ACI只應用於該條目自己ACI屬性使用如下語法:express
(target_rule) (version 3.0; acl "ACL_name"; permission_rule bind_rules;)
target_rule
: 指定要設置訪問控制的條目、屬性或條目集、屬性集。version 3.0
: 標識ACI版本的必須字段。permission_rule
: 定義權限。bind_rules
: 指定ACI的綁定規則groupdn
關鍵字的組條目的ACI必須與組條目位於同一服務器上,同時動態組成員也必須在同一個服務器上,靜態組成員能夠位於遠程服務器上。roledn
關鍵字的ACI必須和角色定義條目在同一服務器上。targetfilter
targetattrfilters
userattr
LDAP URLs
不是本機地址,則URL將被忽略。ACI存放在條目的aci
屬性中。若是包含ACI的條目是複製數據庫的一部分,則ACI也會複製。安全
ldapsearch -D "cn=Directory Manager" -W -p 389 -h server.example.com -x \ -b "dc=example,dc=com" -s sub '(aci=*)' aci
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: modify add: aci aci: (targetattr="userPassword") (version 3.0; acl "Allow users updating their password"; allow (write) userdn= "ldap:///self";)
// 刪除全部aci ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: delete delete: aci // 刪除指定aci ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: modify delete: aci aci: (targetattr="userPassword") (version 3.0; acl "Allow users updating their password"; allow (write) userdn= "ldap:///self";)
若是沒有定義目標,則ACI應用於當前條目及其子條目。服務器
在一個ACI中,如下加粗部分爲目標規則:
(target_rule)
(version 3.0; acl "ACL_name"; permission_rule bind_rules;)
dom
(keyword comparison_operator "expression")
keyword
: 關鍵字,target
、targetattr
、targetfilter
、targetattrfilters
。comparison_operator
: 有效值爲==
和!=
,代表目標是不是表達式指定的對象,不推薦使用!=
。expression
: 設置目標,必須用雙引號引發來。表達式自己取決於使用的關鍵字。target
基於DN以及子條目的訪問控制,使用target
關鍵字。使用target
關鍵字的目標表達式:ide
(target comparison_operator "ldap:///distinguished_name")
Example:性能
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=People,dc=example,dc=com changetype: modify add: aci aci: (target = "ldap:///ou=People,dc=example,dc=com") (version 3.0; acl "Allow users to read and search attributes of own entry"; allow (search, read) (userdn = "userdn = "ldap:///self");)
支持通配符,可是不支持DN後綴部分的通配符。ui
# 支持 (target = "ldap:///uid=user_name*,dc=example,dc=com") # 不支持 (target = "ldap:///dc=*.com")
targetattr
訪問條目的某些屬性值。url
read
:返回給客戶端的屬性值。search
:能夠被搜索的屬性值。write
:條目中能夠被修改的屬性值。add
:建立新條目時,能夠被添加的屬性。可使用||
拼接多個屬性。以下:
(targetattr comparison_operator "attribute_1 || attribute_2 || ...")
支持通配符*
,基於安全考慮,在write
權限上不容許使用通配符。
targetfilter
使用標準LDAP過濾器定位條目、屬性。表達式:
(targetfilter comparison_operator "LDAP_filter")
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (targetfilter = "(|(department=Engineering)(department=Sales)") (version 3.0; acl "Allow HR updating engineering and sales entries"; allow (write) (groupdn = "ldap:///cn=Human Resources,dc=example,dc.com");)
targetattrfilters
經過目標的屬性值來設置權限,基於屬性值的ACI稱爲基於值(value-based)的ACI。
# 對於具備一個屬性和過濾器組合的受權 (targetattrfilters="operation=attribute:filter") # 多個屬性值和過濾器組合的受權 (targetattrfilters="operation=attribute_1:filter_1 && attribute_2:filter_2 ... && attribute_m:filter_m") # 多個屬性值和過濾器組合的多個受權 (targetattrfilters="operation_1=attribute_1_1:filter_1_1 && attribute_1_2:filter_1_2 ... && attribute_1_m:filter_1_m , operation_2=attribute_2_1:filter_2_1 && attribute_2_2:filter_2_2 ... & attribute_2_n:filter_2_n ")
operation
能夠設置爲add
或del
。attribute:filter
爲屬性值和LDAP過濾器。
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (targetattrfilters="add=nsroledn:(!(nsroledn=cn=Admin)) && telephoneNumber:(telephoneNumber=123*)") (version 3.0; acl "Allow adding roles and telephone"; allow (add) (userdn = "ldap:///self");)
target_from
& target_to
容許移動條目。
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (target_from="ldap:///uid=*,cn=staging,dc=example,dc=com") (target_to="ldap:///cn=People,dc=example,dc=com") (version 3.0; acl "MODDN from"; allow (moddn)) userdn="ldap:///uid=user,dc=example,dc=com";)
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (target = "ldap:///cn=*,ou=Groups,dc=example,dc=com") targetfilter="(&(objectClass=top)(objectClass=groupOfUniqueNames))") (targetattr="cn || uniqueMember || objectClass") (version 3.0; acl "example"; allow (read, search, write, add) (userdn = "ldap:///uid=test,ou=People,dc=example,dc=com");) ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (target="ldap:///cn=*,dc=example,dc=com")(targetattr="member" || "cn") (version 3.0; acl "Allow uid=user to search and read members of groups"; allow (read, search) (userdn = "ldap:///uid=user,ou=People,dc=example,dc.com");) ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (targetattr = "jpegPhoto|| manager") (targetfilter = "(department=Engineering)") (version 3.0; acl "Allow engineering admins updating jpegPhoto and manager of department members"; allow (write) (groupdn = "ldap:///cn=Engineering Admins,dc=example,dc.com");) ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=Engineering,dc=example,dc=com changetype: modify add: aci aci: (targetattr = "ou || cn") (targetfilter = "(ou=Engineering)") (version 3.0; acl "Allow uid=user to search and read engineering attributes"; allow (read, search) (userdn = "ldap:///uid=user,ou=People,dc=example,dc.com");)
權限規則指的是ACI關聯的權限是容許或拒絕。
在一個ACI中,如下加粗部分爲權限規則:
(target_rule) (version 3.0; acl "ACL_name";
permission_rule
bind_rules;)
權限規則語法:
permission (rights)
permission
:設置容許(allow)仍是拒絕(deny)rights
: 權限字段。權限 | 描述 |
---|---|
read |
設置用戶是否能夠讀取目錄,僅適用於LDAP的搜索操做。 |
write |
設置用戶是否能夠經過添加、修改和刪除屬性來修改條目。僅適用於LDAP中的modify 和modrdn 。 |
add |
設置用戶是否能夠添加條目,僅適用於LDAP中的add 操做 |
delete |
設置用戶是否能夠刪除條目,僅適用於LDAP中的delete 刪除操做。 |
search |
設置用戶是否能夠搜索目錄數據。查看做爲搜索結果的一部分返回,則分配search 和read 權限。僅適用於LDAP中的搜索操做。 |
compare |
設置用戶是否能夠將其提供的數據與存儲在目錄中的數據進行比較,使用比較權限,目錄返回成功或失敗,可是沒法看到用戶條目或者屬性的值。僅適用於LDAP中的比較操做。 |
selfwrite |
設置用戶是否能夠從組中添加或刪除本身的DN,此權限僅限於組管理。 |
proxy |
設置指定的DN是否可使用其餘條目的權限訪問目標。proxy 權限在ACI受權範圍內、用戶或者租,能夠像代理的用戶、組同樣執行命令。沒法單獨限制用戶。 |
all |
除proxy 以外的全部權限。 |
針對LDAP操做必需要受權的用戶權限類型。
add
添加條目write
授予條目中的每一個屬性值的寫入權限,默認狀況下授予此權限,能夠經過關鍵字targetattrfilters
來受權指定的屬性。delete
容許刪除條目write
授予條目中的每一個屬性值的寫入權限,默認狀況下授予此權限,能夠經過關鍵字targetattrfilters
來受權指定的屬性。write
授予條目中的每一個屬性值的寫入權限,默認狀況下授予此權限,能夠經過關鍵字targetattrfilters
來受權指定的屬性。search
在搜索過濾器中使用屬性類型授予搜索權限read
對條目中屬性的讀取權限。綁定規則定義必須知足綁定參數,以便LDAP應用ACI,綁定規則能夠基於:DNs
、組成員或角色
、條目的具體位置
、綁按期間的身份驗證類型
、綁定的時間和天數
。
在一個ACI中,如下加粗部分爲綁定規則:
(target_rule) (version 3.0; acl "ACL_name"; permission_rule
bind_rules
;)
綁定語法:
keyword comparison_operator "expression"
keyword
:設置綁定操做的類型。comparison_operator
: 比較運算符。==
或!=
。expression
: 設置表達式,必須用引號引發來,表達式自己取決於使用的關鍵字。userdn
userdn
關鍵字容許根據一個或多個DN設置權限。
userdn comparison_operator "ldap:///distinguished_name || ldap:///distinguished_name || ..."
表達式的值:
*
通配符。ldap:///anyone
。ldap:///all
。ldap:///parent
。groupdn
基於組的ACI。使用groupdn
關鍵字時,LDAP服務器將根據member
、uniqueMember
、memberURL
、memberCertificateDescription
屬性驗證組成員身份。
groupdn comparison_operator "ldap:///distinguished_name || ldap:///distinguished_name || ..."
表達式的值:
groupdn comparison_operator "ldap:///distinguished_name??scope?(filter)"
過濾器示例:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: modify add: aci aci: (targetattr="homePostalAddress") (version 3.0; acl "Allow manager=example setting homePostalAddress"; allow (write) userdn = "ldap:///dc=example,dc=com??sub?(manager=example)";)
使用userattr
關鍵字指定綁定條目與目標條目之間必須匹配的屬性。
userattr
關鍵字使用語法:
userattr comparison_operator "attribute_name#bind_type_or_attribute_value
USERDN
綁定類型要在綁定用戶DN與屬性中存儲的DN匹配時應用ACI。userattr
關鍵字與USERDN
綁定類型的語法:
userattr comparison_operator "attribute_name#USERDN"
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: modify add: aci aci: (targetattr = "telephoneNumber") (version 3.0; acl "Manager: telephoneNumber"; allow (all) userattr = "manager#USERDN";)
GROUPDN
綁定類型要在綁定用戶DN是屬性中設置的組的成員時應用ACI。userattr
關鍵字與GROUPDN
綁定類型的語法:
userattr comparison_operator "attribute_name#GROUPDN"
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=Social Committee,ou=Groups,dc=example,dc=com changetype: modify add: aci aci: (target="ou=Social Committee,ou=Groups,dc=example,dc=com) (targetattrfilters="del=objectClass:(objectClass=groupOfNames)") (version 3.0; acl "Delete Group"; allow (delete) userattr = "owner#GROUPDN";)
若是使用靜態組,而且和目標條目有相同的後綴,可使用如下語法提升性能:
userattr comparison_operator "ldap:///distinguished_name?attribute_name#GROUPDN"
SELFDN
綁定類型當綁定用戶的DN在目標條目的單值屬性中時,SELFDN
綁定類型容許授予權限。userattr
關鍵字與SELFDN
綁定類型的語法:
userattr comparison_operator "attribute_name#SELFDN"
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=otp,dc=example,dc=com changetype: modify add: aci aci: (target = "ldap:///ipatokenuniqueid=*,cn=otp,dc=example,dc=com") (targetfilter = "(objectClass=ipaToken)")(version 3.0; acl "token-add-delete"; allow (add) userattr = "ipatokenOwner#SELFDN";)
LDAPURL
綁定類型綁定DN與目標條目屬性中指定的過濾器匹配時,使用LDAPURL
綁定類型。userattr
關鍵字與LDAPURL
綁定類型的語法:
userattr comparison_operator "attribute_name#LDAPURL"
Example:
# ou=People,dc=example,dc=com條目的aciurl屬性值爲:ldap:///ou=People,dc=example,dc=com??one?(uid=user*) ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: ou=People,dc=example,dc=com changetype: modify add: aci aci: (targetattr = "*") (version 3.0; acl "Allow read,search "; allow (read,search) (userattr = "aciurl#LDAPURL);)
userattr comparison_operator "attribute_name#value"
userattr
繼承能夠經過parent
關鍵字並制定繼承ACI目標的級數來實現。語法:
userattr comparison_operator "parent[inheritance_level].attribute_name#bind_type_or_attribute_value
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: cn=Profiles,dc=example,dc=com changetype: modify add: aci aci: (targetattr="*") (version 3.0; acl "Profile access", allow (read,search) userattr="parent[0,1].owner#USERDN" ;)
ip
關鍵字能夠設置特定IP地址或網段的訪問權限。語法:
ip comparison_operator "IP_address_or_range"
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (targetattr = "*") (version 3.0;acl "Deny 192.168.0.2/24"; deny (all) (userdn = "ldap:///anyone") and (ip != "192.0.2.");)
dns
關鍵字設置特定主機或域的訪問權限。語法:
dns comparison_operator "host_name_or_domain_name"
Example:
ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x dn: dc=example,dc=com changetype: modify add: aci aci: (targetattr = "*") (version 3.0;acl "Deny example.com"; deny (all) (userdn = "ldap:///anyone") and (dns != "*.example.com");)