更新时间:2024-08-23 GMT+08:00

弹性负载均衡 ELB

Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)可以使用以下授权项元素设置访问控制策略。

SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。

本章节介绍组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。

如何使用这些元素编辑SCP自定义策略,请参考创建SCP

操作(Action)

操作(Action)即为SCP中支持的授权项。

  • “访问级别”列描述如何对操作进行分类(list、read和write等)。此分类可帮助您了解在SCP中相应操作对应的访问级别。
  • “资源类型”列指每个操作是否支持资源级权限。
    • 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在SCP语句的Resource元素中指定所有资源类型(“*”)。
    • 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
    • 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。

    关于ELB定义的资源类型的详细信息请参见资源类型(Resource)

  • “条件键”列包括了可以在SCP语句的Condition元素中支持指定的键值。
    • 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
    • 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
    • 如果此列条件键没有值(-),表示此操作不支持指定条件键。

    关于ELB定义的条件键的详细信息请参见条件(Condition)

您可以在SCP语句的Action元素中指定以下ELB的相关操作。

表1 ELB支持的授权项

授权项

描述

访问级别

资源类型(*为必须)

条件键

elb:flavors:show

授予查询指定规格的详情。

read

flavor *

-

elb:flavors:list

授予查询规格详情列表的权限。

list

flavor *

-

elb:quotas:list

授予查询配额列表的权限。

list

-

-

elb:quotas:show

授予查询可以创建指定类型资源的最大数量的权限。

read

-

-

elb:availability-zones:list

授予查询可用区列表的权限。

list

availabilityZone *

-

-

g:EnterpriseProjectId

elb:loadbalancers:list

授予查询负载均衡器实例列表。

list

loadbalancer *

-

-

g:EnterpriseProjectId

elb:loadbalancers:show

授予获取负载均衡器实例详情的权限。

read

loadbalancer *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

elb:loadbalancers:create

授予创建负载均衡器实例的权限。

write

loadbalancer *

-

subnet

-

-

  • g:RequestTag/<tag-key>
  • g:TagKeys
  • g:EnterpriseProjectId
  • elb:AssociatePublicips

elb:loadbalancers:update

授予更新负载均衡器实例的权限。

write

subnet

-

loadbalancer *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId
  • elb:AssociatePublicips

elb:loadbalancers:delete

授予删除负载均衡器实例的权限。

write

loadbalancer *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

elb:listeners:create

授予创建监听器的权限。

write

listener *

g:EnterpriseProjectId

loadbalancer *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

-

  • g:RequestTag/<tag-key>
  • g:TagKeys

elb:listeners:update

授予修改监听器的权限。

write

listener *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

elb:listeners:list

授予查询监听器列表的权限。

list

listener *

-

-

g:EnterpriseProjectId

elb:listeners:show

授予获取监听器详情的权限。

read

listener *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

elb:listeners:delete

授予删除监听器的权限。

write

listener *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

elb:certificates:list

授予查询证书列表的权限。

list

certificate *

-

-

g:EnterpriseProjectId

elb:certificates:show

授予获取证书详情的权限。

read

certificate *

-

elb:certificates:create

授予创建证书的权限。

write

certificate *

-

-

g:EnterpriseProjectId

elb:certificates:update

授予修改证书的权限。

write

certificate *

-

elb:certificates:delete

授予删除证书的权限。

write

certificate *

-

elb:certificates:setPrivateKeyEcho

授予设置证书私钥回显开关的权限。

write

-

-

elb:certificates:getPrivateKeyEcho

授予查询证书私钥回显开关的权限。

write

-

-

elb:agreements:list

授予查询签署记录列表的权限。

list

agreement *

-

elb:agreements:show

授予获取签署信息详情的权限。

read

agreement *

-

elb:agreements:create

授予创建签署记录的权限。

write

agreement *

-

elb:agreements:update

授予修改签署记录的权限。

write

agreement *

-

elb:healthmonitors:create

授予创建健康检查的权限。

write

healthmonitor *

g:EnterpriseProjectId

pool *

g:EnterpriseProjectId

elb:healthmonitors:update

授予修改健康检查的权限。

write

healthmonitor *

g:EnterpriseProjectId

elb:healthmonitors:delete

授予删除健康检查的权限。

write

healthmonitor *

g:EnterpriseProjectId

elb:healthmonitors:show

授予获取健康检查详情的权限。

read

healthmonitor *

g:EnterpriseProjectId

elb:healthmonitors:list

授予查询健康检查列表的权限。

list

healthmonitor *

-

-

g:EnterpriseProjectId

elb:ipgroups:list

授予查询IP地址组列表的权限。

list

ipgroup *

-

-

g:EnterpriseProjectId

elb:ipgroups:show

授予获取IP地址组详情的权限。

read

ipgroup *

-

elb:ipgroups:create

授予创建IP地址组的权限。

write

ipgroup *

-

-

g:EnterpriseProjectId

elb:ipgroups:update

授予修改IP地址组的权限。

write

ipgroup *

-

elb:ipgroups:delete

授予删除IP地址组的权限。

write

ipgroup *

-

elb:l7policies:create

授予创建7层转发策略的权限。

write

listener *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

l7policy *

g:EnterpriseProjectId

pool

g:EnterpriseProjectId

elb:l7policies:update

授予修改7层转发策略的权限。

write

l7policy *

g:EnterpriseProjectId

listener

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

pool

g:EnterpriseProjectId

elb:l7policies:delete

授予删除7层转发策略的权限。

write

l7policy *

g:EnterpriseProjectId

elb:l7policies:show

授予获取转发策略详情的权限。

read

l7policy *

g:EnterpriseProjectId

elb:l7policies:list

授予查询转发策略的权限。

list

l7policy *

-

-

g:EnterpriseProjectId

elb:l7rules:create

授予创建7层转发规则的权限。

write

l7rule *

g:EnterpriseProjectId

l7policy *

g:EnterpriseProjectId

elb:l7rules:update

授予修改7层转发规则的权限。

write

l7rule *

g:EnterpriseProjectId

elb:l7rules:list

授予查询转发规则的权限。

list

l7policy *

-

l7rule *

-

-

g:EnterpriseProjectId

elb:l7rules:show

授予获取7层转发规则详情的权限。

read

l7rule *

g:EnterpriseProjectId

elb:l7rules:delete

授予删除7层转发规则的权限。

write

l7rule *

g:EnterpriseProjectId

elb:logtanks:list

授予查询云日志列表的权限。

list

logtank *

-

-

g:EnterpriseProjectId

elb:logtanks:show

授予获取云日志详情的权限。

read

logtank *

g:EnterpriseProjectId

elb:logtanks:create

授予创建云日志的权限。

write

logtank *

g:EnterpriseProjectId

loadbalancer *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

elb:logtanks:update

授予修改云日志的权限。

write

logtank *

g:EnterpriseProjectId

elb:logtanks:delete

授予删除云日志的权限。

write

logtank *

g:EnterpriseProjectId

elb:pools:list

授予查询后端服务器组列表的权限。

list

pool *

-

-

g:EnterpriseProjectId

elb:pools:show

授予获取后端服务器组详情的权限。

read

pool *

g:EnterpriseProjectId

elb:pools:create

授予创建后端服务器组的权限。

write

loadbalancer

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

listener

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

pool *

g:EnterpriseProjectId

elb:pools:update

授予修改后端服务器组的权限。

write

pool *

g:EnterpriseProjectId

elb:pools:delete

授予删除后端服务器组的权限。

write

pool *

g:EnterpriseProjectId

elb:members:list

授予查询后端服务器列表的权限。

list

pool

-

member *

-

-

g:EnterpriseProjectId

elb:members:show

授予获取后端服务器详情的权限。

read

member *

g:EnterpriseProjectId

elb:members:create

授予创建后端服务器的权限。

write

member *

g:EnterpriseProjectId

pool *

g:EnterpriseProjectId

subnet

-

elb:members:update

授予修改后端服务器的权限。

write

member *

g:EnterpriseProjectId

elb:members:delete

授予删除后端服务器的权限。

write

member *

g:EnterpriseProjectId

elb:security-policies:list

授予查询安全策略的权限。

list

securityPolicy *

-

-

g:EnterpriseProjectId

elb:security-policies:show

授予获取安全策略详情的权限。

read

securityPolicy *

-

elb:security-policies:create

授予创建安全策略的权限。

write

securityPolicy *

-

-

g:EnterpriseProjectId

elb:security-policies:update

授予修改安全策略的权限。

write

securityPolicy *

-

elb:security-policies:delete

授予删除安全策略的权限。

write

securityPolicy *

-

ELB的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。

表2 API与授权项的关系

API

对应的授权项

依赖的授权项

GET /v3/{project_id}/elb/flavors

elb:flavors:list

-

GET /v3/{project_id}/elb/flavors/{flavor_id}

elb:flavors:show

-

GET /v3/{project_id}/elb/quotas/details

elb:quotas:list

-

GET /v3/{project_id}/elb/quotas

elb:quotas:show

-

POST /v3/{project_id}/elb/loadbalancers

elb:loadbalancers:create

-

DELETE /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}

elb:loadbalancers:delete

-

DELETE /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/force-elb

elb:loadbalancers:delete

-

GET /v3/{project_id}/elb/loadbalancers

elb:loadbalancers:list

-

GET /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}

elb:loadbalancers:show

-

GET /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/statuses

elb:loadbalancers:show

-

PUT /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}

elb:loadbalancers:update

-

POST /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/availability-zone/batch-remove

elb:loadbalancers:update

-

POST /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/availability-zone/batch-add

elb:loadbalancers:update

-

POST /v3/{project_id}/elb/ipgroups

elb:ipgroups:create

-

DELETE /v3/{project_id}/elb/ipgroups/{ipgroup_id}

elb:ipgroups:delete

-

GET /v3/{project_id}/elb/ipgroups

elb:ipgroups:list

-

GET /v3/{project_id}/elb/ipgroups/{ipgroup_id}

elb:ipgroups:show

-

PUT /v3/{project_id}/elb/ipgroups/{ipgroup_id}

elb:ipgroups:update

-

POST /v3/{project_id}/elb/ipgroups/{ipgroup_id}/iplist/create-or-update

elb:ipgroups:update

-

POST /v3/{project_id}/elb/ipgroups/{ipgroup_id}/iplist/batch-delete

elb:ipgroups:update

-

POST /v3/{project_id}/elb/security-policies

elb:security-policies:create

-

DELETE /v3/{project_id}/elb/security-policies/{security_policy_id}

elb:security-policies:delete

-

GET /v3/{project_id}/elb/security-policies

elb:security-policies:list

-

GET /v3/{project_id}/elb/system-security-policies

elb:security-policies:list

-

GET /v3/{project_id}/elb/security-policies/{security_policy_id}

elb:security-policies:show

-

PUT /v3/{project_id}/elb/security-policies/{security_policy_id}

elb:security-policies:update

-

POST /v3/{project_id}/elb/pools/{pool_id}/members

elb:members:create

-

DELETE /v3/{project_id}/elb/pools/{pool_id}/members/{member_id}

elb:members:delete

-

GET /v3/{project_id}/elb/pools/{pool_id}/members

elb:members:list

-

GET /v3/{project_id}/elb/pools/{pool_id}/members/{member_id}

elb:members:show

-

PUT /v3/{project_id}/elb/pools/{pool_id}/members/{member_id}

elb:members:update

-

POST /v3/{project_id}/elb/pools/{pool_id}/members/batch-update

elb:members:update

-

GET /v3/{project_id}/elb/members

elb:members:list

-

POST /v3/{project_id}/elb/pools/{pool_id}/members/batch-add

elb:members:create

-

POST /v3/{project_id}/elb/pools/{pool_id}/members/batch-delete

elb:members:delete

-

POST /v3/{project_id}/elb/pools

elb:pools:create

-

DELETE /v3/{project_id}/elb/pools/{pool_id}

elb:pools:delete

-

GET /v3/{project_id}/elb/pools

elb:pools:list

-

GET /v3/{project_id}/elb/pools/{pool_id}

elb:pools:show

-

PUT /v3/{project_id}/elb/pools/{pool_id}

elb:pools:update

-

POST /v3/{project_id}/elb/master-slave-pools

elb:pools:create

-

GET /v3/{project_id}/elb/master-slave-pools

elb:pools:list

-

GET /v3/{project_id}/elb/master-slave-pools/{pool_id}

elb:pools:show

-

DELETE /v3/{project_id}/elb/master-slave-pools/{pool_id}

elb:pools:delete

-

POST /v3/{project_id}/elb/listeners

elb:listeners:create

-

DELETE /v3/{project_id}/elb/listeners/{listener_id}

elb:listeners:delete

-

DELETE /v3/{project_id}/elb/listeners/{listener_id}/force

elb:listeners:delete

-

GET /v3/{project_id}/elb/listeners

elb:listeners:list

-

GET /v3/{project_id}/elb/listeners/{listener_id}

elb:listeners:show

-

PUT /v3/{project_id}/elb/listeners/{listener_id}

elb:listeners:update

-

POST /v3/{project_id}/elb/healthmonitors

elb:healthmonitors:create

-

DELETE /v3/{project_id}/elb/healthmonitors/{healthmonitor_id}

elb:healthmonitors:delete

-

GET /v3/{project_id}/elb/healthmonitors

elb:healthmonitors:list

-

GET /v3/{project_id}/elb/healthmonitors/{healthmonitor_id}

elb:healthmonitors:show

-

PUT /v3/{project_id}/elb/healthmonitors/{healthmonitor_id}

elb:healthmonitors:update

-

GET /v3/{project_id}/elb/availability-zones

elb:availability-zones:list

-

GET /v3/{project_id}/elb/preoccupy-ip-num

elb:loadbalancers:show

-

POST /v3/{project_id}/elb/logtanks

elb:logtanks:create

-

DELETE /v3/{project_id}/elb/logtanks/{logtank_id}

elb:logtanks:delete

-

GET /v3/{project_id}/elb/logtanks

elb:logtanks:list

-

GET /v3/{project_id}/elb/logtanks/{logtank_id}

elb:logtanks:show

-

PUT /v3/{project_id}/elb/logtanks/{logtank_id}

elb:logtanks:update

-

POST /v3/{project_id}/elb/certificates

elb:certificates:create

-

DELETE /v3/{project_id}/elb/certificates/{certificate_id}

elb:certificates:delete

-

GET /v3/{project_id}/elb/certificates

elb:certificates:list

-

GET /v3/{project_id}/elb/certificates/{certificate_id}

elb:certificates:show

-

PUT /v3/{project_id}/elb/certificates/{certificate_id}

elb:certificates:update

-

POST /v3/{project_id}/elb/l7policies

elb:l7policies:create

-

DELETE /v3/{project_id}/elb/l7policies/{l7policy_id}

elb:l7policies:delete

-

GET /v3/{project_id}/elb/l7policies

elb:l7policies:list

-

GET /v3/{project_id}/elb/l7policies/{l7policy_id}

elb:l7policies:show

-

PUT /v3/{project_id}/elb/l7policies/{l7policy_id}

elb:l7policies:update

-

POST /v3/{project_id}/elb/l7policies/batch-update-priority

elb:l7policies:update

-

POST /v3/{project_id}/elb/l7policies/{l7policy_id}/rules

elb:l7rules:create

-

DELETE /v3/{project_id}/elb/l7policies/{l7policy_id}/rules/{l7rule_id}

elb:l7rules:delete

-

GET /v3/{project_id}/elb/l7policies/{l7policy_id}/rules

elb:l7rules:list

-

GET /v3/{project_id}/elb/l7policies/{l7policy_id}/rules/{l7rule_id}

elb:l7rules:show

-

PUT /v3/{project_id}/elb/l7policies/{l7policy_id}/rules/{l7rule_id}

elb:l7rules:update

-

资源类型(Resource)

资源类型(Resource)表示SCP所作用的资源。如表3中的某些操作指定了可以在该操作指定的资源类型,则必须在具有该操作的SCP语句中指定该资源的URN,SCP仅作用于此资源;如未指定,Resource默认为“*”,则SCP将应用到所有资源。您也可以在SCP中设置条件,从而指定资源类型。

ELB定义了以下可以在自定义SCP的Resource元素中使用的资源类型。

表3 ELB支持的资源类型

资源类型

URN

pool

elb:<region>:<account-id>:pool:<pool-id>

agreement

elb:<region>:<account-id>:agreement:<agreement-id>

loadbalancer

elb:<region>:<account-id>:loadbalancer:<loadbalancer-id>

certificate

elb:<region>:<account-id>:certificate:<certificate-id>

healthmonitor

elb:<region>:<account-id>:healthmonitor:<healthmonitor-id>

ipgroup

elb:<region>:<account-id>:ipgroup:<ipgroup-id>

securityPolicy

elb:<region>:<account-id>:securityPolicy:<security-policy-id>

logtank

elb:<region>:<account-id>:logtank:<logtank-id>

availabilityZone

elb:<region>:<account-id>:availabilityZone:<availability-zone-id>

member

elb:<region>:<account-id>:member:<pool-id>/<member-id>

l7policy

elb:<region>:<account-id>:l7policy:<l7policy-id>

l7rule

elb:<region>:<account-id>:l7rule:<l7policy-id>/<l7rule-id>

flavor

elb:<region>:<account-id>:flavor:<flavor-id>

subnet

vpc:<region>:<account-id>:subnet:<subnet-id>

listener

elb:<region>:<account-id>:listener:<listener-id>

条件(Condition)

条件(Condition)是SCP生效的特定条件,包括条件键运算符

  • 条件键表示SCP语句的Condition元素中的键值。根据适用范围,分为全局级条件键和服务级条件键。
    • 全局级条件键(前缀为g:)适用于所有操作,在鉴权过程中,云服务不需要提供用户身份信息,系统将自动获取并鉴权。详情请参见:全局条件键
    • 服务级条件键(前缀通常为服务缩写,如elb:)仅适用于对应服务的操作,详情请参见表4
    • 单值/多值表示API调用时请求中与条件关联的值数。单值条件键在API调用时的请求中最多包含一个值,多值条件键在API调用时请求可以包含多个值。例如:g:SourceVpce是单值条件键,表示仅允许通过某个VPC终端节点发起请求访问某资源,一个请求最多包含一个VPC终端节点ID值。g:TagKeys是多值条件键,表示请求中携带的所有标签的key组成的列表,当用户在调用API请求时传入标签可以传入多个值。
  • 运算符与条件键、条件值一起构成完整的条件判断语句,当请求信息满足该条件时,SCP才能生效。支持的运算符请参见:条件键

ELB定义了以下可以在SCP的Condition元素中使用的条件键,您可以使用这些条件键进一步细化SCP语句应用的条件。

表4 ELB支持的服务级条件键

服务级条件键

类型

单值/多值

说明

elb:AssociatePublicips

boolean

单值

根据创建或修改负载均衡器时是否涉及创建或绑定公网操作筛选访问权限。若要完全限制弹性负载均衡器的公网访问,则需要同时使用弹性公网IP的相关Action进行策略管理。