将 Cloud Armor 与 Google SecOps 集成
本文档介绍了如何将 Google Cloud Armor 与 Google Security Operations 集成。
使用场景
Cloud Armor 集成支持以下应用场景:
自动威胁屏蔽:在发生突发事件期间,通过更新安全政策规则,在 Google Cloud 边缘立即屏蔽恶意 IP 地址或范围。
安全政策管理:列出、检索和更新整个环境中的安全政策和规则,以确保 WAF 保护的一致性。
动态 DDoS 缓解:通过以编程方式调整安全政策设置,应对容量耗尽攻击或基于协议的攻击。
取证审核:检索现有安全政策的配置详细信息,以便将边缘保护与内部安全提醒相关联。
准备工作
在 Google SecOps 中配置 Cloud Armor 集成之前,请完成以下前提步骤:
选择并配置以下身份验证方法之一:
选项 1:Workload Identity(推荐):此方法通过使用服务账号模拟来使用短期有效的令牌。
方法 2:服务账号 JSON 密钥:此方法依赖于静态、长期有效的密钥文件。
创建和配置 IAM 角色
如需为集成提供必要的权限,请在 Google Cloud 项目中创建自定义角色:
在 Google Cloud 控制台中,前往角色。
点击 add 创建自定义角色。
提供标题、说明和唯一的 ID。
将角色发布阶段设置为正式版。
为该角色添加以下权限:
compute.backendBuckets.setSecurityPolicycompute.backendServices.setSecurityPolicycompute.regionBackendServices.setSecurityPolicycompute.regionSecurityPolicies.createcompute.regionSecurityPolicies.getcompute.regionSecurityPolicies.listcompute.regionSecurityPolicies.updatecompute.securityPolicies.createcompute.securityPolicies.getcompute.securityPolicies.listcompute.securityPolicies.update
点击创建。
创建服务账号
在 Google Cloud 控制台中,前往 IAM 和管理 > 服务账号。
点击 add 创建服务账号。
提供名称和说明,然后点击创建并继续。
在向此服务账号授予对项目的访问权限步骤中,分配您创建的自定义 IAM 角色。
点击完成。记下服务账号电子邮件地址。
配置 Workload Identity 凭证
Workload Identity 是推荐的方法,因为它通过服务账号模拟使用短期有效令牌。
识别唯一实例身份
建立连接需要向 Google SecOps 实例授予模拟服务账号的权限。
在 Google SecOps 中,前往内容中心 > 响应集成。
选择 Cloud Armor 集成,然后在
Workload Identity Email中输入您的服务账号电子邮件地址。依次点击保存 > 测试。测试失败。
点击测试旁边的 close_small 按钮,然后找到以
gke-init-python@...或soar-python@...开头的身份电子邮件。复制此唯一邮箱。
在 Google Cloud中授权实例身份
在 Google Cloud 控制台中,前往 IAM 和管理 > 服务账号。
选择目标服务账号,然后依次前往权限 > 授予访问权限。
将唯一邮箱粘贴到新的主账号字段中,并分配 Service Account Token Creator 角色 (
roles/iam.serviceAccountTokenCreator)。
配置 JSON 密钥
静态、长期有效的密钥文件需要手动轮替。仅当 Workload Identity 身份验证不可用时,才使用此方法。
在 Google Cloud 控制台中,依次前往 IAM 和管理 > 服务账号,然后选择您的服务账号。
前往密钥标签页,然后依次点击添加密钥 > 创建新密钥。
选择 JSON,然后点击创建。密钥文件会下载到您的计算机上。
集成参数
Cloud Armor 集成需要以下参数:
| 参数 | 说明 |
|---|---|
API Root |
必填。 Cloud Armor 服务的 API 根。 默认值为 |
Project ID |
可选。 Cloud Armor 的目标项目 ID。 如果未提供任何值,则集成会从服务账号凭证中检索 ID。 |
Workload Identity Email |
可选。 服务账号的客户端邮箱。为 Workload Identity 身份验证配置此参数。 如果已配置,则会忽略 |
User Service Account |
可选。 服务账号密钥 JSON 文件的完整内容。为服务账号密钥身份验证配置此参数。 如果已配置,则集成会忽略 |
Verify SSL |
必填。 如果选中,则集成会在连接到 Google Cloud 服务器时验证 SSL 证书。 默认处于启用状态。 |
如需了解如何在 Google SecOps 中配置集成,请参阅配置集成。
如有需要,您可以在后续阶段进行更改。配置集成实例后,您可以在 playbook 中使用该实例。如需详细了解如何配置和支持多个实例,请参阅支持多个实例。
操作
如需详细了解操作,请参阅 在工作桌上响应待处理的操作和在案例中运行手动操作。
向安全政策添加规则
在 Cloud Armor 服务中向安全政策添加新规则。
实体
此操作不会对实体执行。
操作输入
如需配置操作,请使用以下参数:
| 参数 | |
|---|---|
Policy Name |
必需 要向其添加新规则的安全政策名称。 |
Region |
可选 要添加规则的政策所在的区域。 如果未提供任何值,则规则会添加到全局级安全政策。 |
Rule JSON |
必需 要添加的规则的 JSON 定义。 如需详细了解如何向政策添加规则,请参阅方法:securityPolicies.addRule。 |
操作输出
| 操作输出类型 | |
|---|---|
| 案例墙附件 | 不适用 |
| 案例墙链接 | 不适用 |
| 案例墙表格 | 不适用 |
| 丰富化表 | 不适用 |
| JSON 结果 | 可用 |
| 脚本结果 | 可用 |
脚本结果
| 脚本结果名称 | 值 |
|---|---|
| is_success | True 或 False |
JSON 结果
{
"kind": "compute#securityPolicy",
"id": "ID",
"creationTimestamp": "2024-04-14T05:39:05.798-07:00",
"name": "example",
"description": "Test for integration",
"rules": [
{
"kind": "compute#securityPolicyRule",
"description": "test",
"priority": 100,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
},
{
"kind": "compute#securityPolicyRule",
"description": "Default rule, higher priority overrides it",
"priority": 2147483647,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
}
],
"fingerprint": "A3hq2ZQYxj8=",
"selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1/securityPolicies/example",
"type": "CLOUD_ARMOR",
"labelFingerprint": "42WmSpB8rSM=",
"region": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1"
}
案例墙
此操作会提供以下输出消息:
| 输出消息 | 消息说明 |
|---|---|
Successfully added a new rule to the security policy! |
操作成功。 |
Error executing action "Add a Rule to a Security Policy".
Reason: ERROR_REASON |
操作失败。 请检查与服务器的连接、输入参数、凭据、区域名称、JSON 文件的内容或政策名称。 |
创建安全政策
在 Cloud Armor 服务中创建安全政策。
实体
此操作不会对实体执行。
操作输入
如需配置操作,请使用以下参数:
| 参数 | |
|---|---|
Region |
可选 要在其中创建政策的区域。 如果未提供任何值,则会创建全局级安全政策。 |
Policy JSON |
必需 要创建的政策的 JSON 定义。 如需详细了解政策,请参阅 REST 资源:securityPolicies。 |
操作输出
| 操作输出类型 | |
|---|---|
| 案例墙附件 | 不适用 |
| 案例墙链接 | 不适用 |
| 案例墙表格 | 不适用 |
| 丰富化表 | 不适用 |
| JSON 结果 | 可用 |
| 脚本结果 | 可用 |
脚本结果
| 脚本结果名称 | 值 |
|---|---|
| is_success | True 或 False |
JSON 结果
{
"kind": "compute#securityPolicy",
"id": "ID",
"creationTimestamp": "2024-04-14T05:39:05.798-07:00",
"name": "example",
"description": "Test for integration",
"rules": [
{
"kind": "compute#securityPolicyRule",
"description": "test",
"priority": 100,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
},
{
"kind": "compute#securityPolicyRule",
"description": "Default rule, higher priority overrides it",
"priority": 2147483647,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
}
],
"fingerprint": "A3hq2ZQYxj8=",
"selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1/securityPolicies/example",
"type": "CLOUD_ARMOR",
"labelFingerprint": "42WmSpB8rSM=",
"region": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1"
}
案例墙
此操作会提供以下输出消息:
| 输出消息 | 消息说明 |
|---|---|
Successfully created a new security policy! |
操作成功。 |
Error executing action "Create a Security Policy". Reason:
ERROR_REASON |
操作失败。 请检查与服务器的连接、输入参数、凭据、区域名称或 JSON 文件的内容。 |
Ping
使用集成配置页面上提供的参数测试与 Cloud Armor 服务的连接。
实体
此操作不会对实体执行。
操作输入
不适用
操作输出
| 操作输出类型 | |
|---|---|
| 案例墙附件 | 不适用 |
| 案例墙链接 | 不适用 |
| 案例墙表格 | 不适用 |
| 丰富化表 | 不适用 |
| JSON 结果 | 不适用 |
| 脚本结果 | 可用 |
脚本结果
| 脚本结果名称 | 值 |
|---|---|
| is_success | True 或 False |
案例墙
此操作会提供以下输出消息:
| 输出消息 | 消息说明 |
|---|---|
Successfully connected to the Google Cloud Armor service with
the provided connection parameters! |
操作成功。 |
Failed to connect to the Google Cloud Armor service! Error is
ERROR_REASON |
操作失败。 请检查与服务器的连接、输入参数或凭据。 |
更新安全政策
更新 Cloud Armor 服务中的现有安全政策。
此操作无法更新政策中的规则。如需向相关政策添加规则,请使用向安全政策添加规则操作。
实体
此操作不会对实体执行。
操作输入
如需配置操作,请使用以下参数:
| 参数 | |
|---|---|
Policy Name |
必需 要向其添加新规则的安全政策名称。 |
Region |
可选 更新后的政策所在的区域。 如果未提供任何值,则会创建全局级安全政策。 |
Rule JSON |
必需 要更新的政策的 JSON 定义。 如需详细了解政策更新,请参阅方法:securityPolicies.patch 。 您无法通过此操作更新规则。 如需向政策添加规则,请使用向安全政策添加规则操作。 |
操作输出
| 操作输出类型 | |
|---|---|
| 案例墙附件 | 不适用 |
| 案例墙链接 | 不适用 |
| 案例墙表格 | 不适用 |
| 丰富化表 | 不适用 |
| JSON 结果 | 可用 |
| 脚本结果 | 可用 |
脚本结果
| 脚本结果名称 | 值 |
|---|---|
| is_success | True 或 False |
JSON 结果
{
"kind": "compute#securityPolicy",
"id": "ID",
"creationTimestamp": "2024-04-14T05:39:05.798-07:00",
"name": "example",
"description": "Test for integration",
"rules": [
{
"kind": "compute#securityPolicyRule",
"description": "test",
"priority": 100,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
},
{
"kind": "compute#securityPolicyRule",
"description": "Default rule, higher priority overrides it",
"priority": 2147483647,
"match": {
"versionedExpr": "SRC_IPS_V1",
"config": {
"srcIpRanges": [
"*"
]
}
},
"action": "allow",
"preview": false
}
],
"fingerprint": "A3hq2ZQYxj8=",
"selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1/securityPolicies/example",
"type": "CLOUD_ARMOR",
"labelFingerprint": "42WmSpB8rSM=",
"region": "https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/regions/northamerica-northeast1"
}
案例墙
此操作会提供以下输出消息:
| 输出消息 | 消息说明 |
|---|---|
Successfully added comment to the
identity protection detection with ID
DETECTION_ID in CrowdStrike |
操作成功。 |
Error executing action "Update a Security Policy". Reason:
ERROR_REASON |
操作失败。 请检查与服务器的连接、输入参数或凭据。 |