目录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");)