使用基于上下文的限制保护 Security and Compliance Center 资源
自 2025 年 7 月 17 日起,您不能在本产品的此版本中创建新实例。 Security and Compliance Center Workload Protection 的更新体验中提供了所有功能。 更多信息,请参阅 过渡文档。
基于上下文的限制使帐户所有者和管理员能够根据访问请求的上下文来定义和实施 IBM Cloud 资源的访问限制。 对 Security and Compliance Center 资源的访问可通过基于上下文的限制以及身份和访问管理 (IAM) 策略进行控制。
这些限制适用于基于身份的传统 IAM 策略,以提供额外的保护层。 与 IAM 策略不同,基于上下文的限制不会分配访问权。 基于上下文的限制检查访问请求是否来自您配置的允许上下文。 由于 IAM 访问权和基于上下文的限制都强制实施访问权,因此基于上下文的限制即使在凭证已泄露或管理不当的情况下也会提供保护。 有关更多信息,请参阅 什么是基于上下文的限制。
用户必须对 Security and Compliance Center 服务具有管理员角色才能创建,更新或删除规则。 用户还必须对基于上下文的限制服务具有“编辑者”或“管理员”角色,才能创建,更新或删除网络区域。 对基于上下文的限制服务具有“查看者”角色的用户只能向规则添加网络区域。
生成的任何审计日志事件都来自基于上下文的限制服务,而不是 Security and Compliance Center。 有关更多信息,请参阅 监视基于上下文的限制。
要开始使用基于上下文的限制来保护 Security and Compliance Center 资源,请参阅 利用基于上下文的限制来保护资源 教程。
Security and Compliance Center 如何与基于上下文的限制集成
设置为 Security and Compliance Center 的基于上下文的限制将整体应用于 Security and Compliance Center的所有组件。 通过启用基于上下文的限制,可以限制对 Security and Compliance Center的用户界面功能和 Security and Compliance Center的公共 API 的访问。
要限制访问权,必须创建 区域 和 规则。 首先,创建具有网络或资源定义的相应详细信息的区域。 然后,创建规则,并将该区域附加到规则以限制访问权。 创建或更新区域或规则后,更改可能需要几分钟才能生效。
限制
创建规则后,可能需要最多 10 分钟才能使该规则生效。
Security and Compliance Center 不支持对特定资源采用基于上下文的限制。 在创建新规则时,必须确保限制的作用域限定为“所有资源”,而不是“特定资源”。
Security and Compliance Center 对 Cloud Object Storage进行服务到服务调用。 要确保 Security and Compliance Center 功能正常运行,必须在以 Cloud Object Storage为目标的规则的网络区域中添加 Security and Compliance Center 作为服务引用。 必须对以 Event Notifications为目标的规则使用相同的过程。
基于上下文的限制仅可用于已更新的体系结构。
基于上下文的限制仅保护与 Security and Compliance Center API 关联的操作。 与以下平台 API 关联的操作不受基于上下文的限制保护。 请参考 API 文档以获取特定操作标识。
创建网络区域
网络区域表示在其中创建访问请求的 IP 地址的允许列表。 它定义了一组具有以下属性的一个或多个网络位置:
- IP 地址,包括单个地址,范围或子网。
- VPC
- 服务引用,允许从其他 IBM Cloud 服务进行访问。
确保将 Security and Compliance Center 添加到针对其他 IBM Cloud 资源的规则的网络区域,否则工作流程中的某些操作可能会失败。
在控制台中创建网络区域
要在 UI 中创建网络区域,请完成以下步骤。
- 确定要添加到允许列表的资源。
- 执行以下步骤以 在控制台中创建网络区域。 将 Security and Compliance Center 服务添加到网络区域,以允许 Security and Compliance Center 访问帐户中的服务和资源。
使用 API 创建网络区域
您可以使用 create-zone
命令来创建网络区域。 有关更多信息,请参阅 API 文档。 您可以将 Security and Compliance Center 作为服务引用添加到网络区域,以允许 Security and Compliance Center 访问作为规则主体的帐户中的资源和服务。
Security and Compliance Center 的 serviceRef
属性为 compliance
。
用于将 Security and Compliance Center 添加到网络区域的示例有效内容。
{
"name": "Example zone 1",
"description": "",
"addresses": [
{
"type": "serviceRef",
"ref": {
"service_name": "compliance",
"account_id": "ACCOUNT-ID"
}
]
}
用于将多个服务,IP 地址和 VPC 添加到网络区域的示例有效内容。
{
{
"name": "zone",
"description": "",
"addresses": [
{
"type": "ipAddress",
"value": "192.168.0.0"
},
{
"type": "vpc",
"value": "crn:v1:bluemix:public:is:us-east:a/CRN"
},
{
"type": "vpc",
"value": "crn:v1:bluemix:public:is:us-south:a/CRN"
},
{
"type": "serviceRef",
"ref": {
"service_name": "cloud-object-storage",
"account_id": "ACCOUNT-ID"
},
{
"type": "serviceRef",
"ref": {
"service_name": "codeengine",
"account_id": "ACCOUNT-ID"
},
{
"type": "serviceRef",
"ref": {
"service_name": "containers-kubernetes",
"account_id": "ACCOUNT-ID"
},
{
"type": "serviceRef",
"ref": {
"service_type": "platform_service",
"account_id": "ACCOUNT-ID"
},
{
"type": "serviceRef",
"ref": {
"service_name": "iam-groups",
"account_id": "ACCOUNT-ID"
}
],
"excluded": []
}
}
使用 CLI 创建网络区域
您可以使用 cbr-zone-create
命令将网络位置,VPC 和服务引用添加到网络区域。 有关更多信息,请参阅 CBR CLI 参考。 将 Security and Compliance Center 添加到网络区域作为服务引用,以允许 Security and Compliance Center 访问作为规则主体的帐户中的资源和服务。
要查找可用服务引用的列表,请运行 ibmcloud cbr service-ref-targets
命令。 SSC 的 service_name
为 compliance
。
用于将 compliance
服务添加到网络区域的示例命令。
ibmcloud cbr zone-create --name example-zone-1 --description "Example zone 1" --service-ref service_name=compliance
用于将单个 IP 地址添加到网络区域的示例命令。
ibmcloud cbr zone-create --addresses 129.41.86.7 --description "Allow only client IP" --name allow-client-ip
创建规则
定义规则以保护对帐户中资源的访问权。 您在规则中定义的上下文确定网络区域 (允许列表) 中的资源如何与规则中定义的资源进行交互。
在创建规则之前,请查看 限制。
在控制台中创建规则
完成以下步骤以创建 Security and Compliance Center的规则。
- 查看您为帐户创建的网络区域。
- 遵循步骤以 在控制台中创建规则。
使用 API 创建规则
请查看以下示例,以了解如何使用 API 为 Security and Compliance Center 创建规则。 有关更多信息,请参阅 API 文档。
此有效内容将创建以 Security and Compliance Center 服务为目标的规则,并且仅允许来自指定网络区域的专用端点访问该服务。
{
"description": "Example rule 1",
"resources": [
{
"attributes": [
{
"name": "accountId",
"value": "ACCOUNT-ID"
},
{
"name": "serviceName",
"value": "compliance"
}
]
}
],
"contexts": [
{
"attributes": [
{
"name": "networkZoneId",
"value": "NETWORK-ZONE-ID"
},
{
"name": "endpointType",
"value": "private"
}
]
}
]
}
使用 CLI 创建规则
查看以下示例以了解如何使用 CLI 为 Security and Compliance Center 创建规则。 有关更多信息,请参阅 CBR CLI 参考。
此命令创建以 Security and Compliance Center 服务为目标的规则,并且仅允许来自指定网络区域的专用端点访问该服务。
ibmcloud cbr rule-create --description 'Example Rule Description' --service-name compliance --context-attributes endpointType=private --zone-id ZONE_ID --enforcement-mode report
对于实施方式选项,CLI 接受值 enabled
,disabled
和 report
。 如果未指定强制实施,那么缺省情况下将启用该规则。
后续步骤
遵循创建或修改区域或规则,并进行足够的测试以确保访问权和可用性。
当未建立相应的规则时,尝试在已定义区域外部访问资源的用户将接收到 HTTP error 403
。