工作负载标签
标签(有时称为标签、注释、属性、元数据或上下文,尽管这些术语不一定总是完全同义)是 Cisco Secure Workload 功能的关键。
可读标签可根据工作负载的功能、位置和其他标准来对其进行描述。
Cisco Secure Workload 支持通过以下方法来添加用户标签:
标签的重要性
标签允许您定义逻辑策略。例如:
允许从使用者 hr_department 到提供者 employee_db 的流量
如下图所示,我们可以使用标签来定义逻辑策略,而不是指定使用者和提供者工作负载组的成员。请注意,这样就可以动态修改使用者组和提供者组的成员身份,而无需修改逻辑策略。在队列中添加和删除工作负载时,会通知 Cisco Secure Workload 您已配置的服务(例如外部协调器和云连接器)。这使得 Cisco Secure Workload 能够评估使用者组 hr_department 和提供者组 employee_db 的成员关系。
基于子网的标签继承
支持基于子网的标签继承。当满足以下条件之一时,较小的子网和 IP 地址将继承其所属较大子网的标签:
-
较小子网/地址的标签列表中缺少该标签。
-
较小子网/地址的标签值为空。
请看下例:
IP |
名称 |
目的 |
环境 |
灵性动物 |
---|---|---|---|---|
10.0.0.1 |
server-1 |
webtraffic |
生产 |
|
10.0.0.2 |
青蛙 |
|||
10.0.0.3 |
鹰 |
|||
10.0.0.0/24 |
网络 VLAN |
集成 |
||
10.0.0.0/16 |
webtraffic |
獾 |
||
10.0.0.0/8 |
测试 |
Bear |
IP 地址 10.0.0.3 的标签为 {“name”: “web-vlan”, “purpose”: “webtraffic”, “environment”: “integra- tion”, “spirit-animal”: “eagle”}。
标签前缀
标签会自动显示可识别信息来源的前缀。
所有用户标签在 UI 中均以 * 为前缀(在 OpenAPI 中为 user_ )。此外,从外部协调器或云连接器自动导入的标签会添加前缀 orchestrator_。对于从终端连接器导入的标签,请参阅面向终端的连接器中的详细信息,但它们可能包含以 ldap_ 为前缀的标签。
例如,从用户上传的 CSV 文件导入的密钥为部门的标签会在 UI 中显示为 * department,而在 OpenAPI 中显示为 user_department。具有从外部协调器导入的 location 密钥的标签会在 UI 中显示为 * orchestrator_location,而在 OpenAPI 中显示为 user_orchestrator_location。
下图显示了使用协调器生成的前缀标签进行资产搜索的示例:
orchestrator_system/os_image:
云连接器生成的标签
env: prod
,网络接口标签为 env: prod
,则安全工作负载中的标签值为 prod,test
,它会显示在相应连接器页面的 orchestrator_env 列下。
有关 AKS、EKS 和 GKE 的特定标签,另请参阅与 Kubernetes 集群相关的标签。
键 |
值 |
---|---|
orchestrator_system/orch_type |
AWS 或 Azure |
orchestrator_system/cluster_name |
<Cluster_name 是用户为该连接器的配置所起的名称> |
orchestrator_system/name |
<连接器的名称> |
orchestrator_system/cluster_id |
<虚拟网络 ID> |
实例特定标签
以下标签特定于每个节点:
键 |
值 |
---|---|
orchestrator_system/workload_type |
vm |
orchestrator_system/machine_id |
<由平台分配的 InstanceID> |
orchestrator_system/machine_name |
<由 AWS 赋予此节点的 PublicDNS(FQDN)> –或– <Azure 中的 InstanceName> |
orchestrator_system/segmentation_enabled |
<用于确定是否在资产上启用了分段的标志> |
orchestrator_system/virtual_network_id |
<资产所属虚拟网络的 ID> |
orchestrator_system/virtual_network_name |
<资产所属虚拟网络的名称> |
orchestrator_system/interface_id |
<连接到此资产的弹性网络接口的标识符> |
orchestrator_system/region |
<资产所属区域> |
orchestrator_system/resource_group |
(此标记仅适用于 Azure 资产) |
orchestrator_‘<Tag Key>‘ |
分配给云门户中资产的任意数量的自定义标签的 <Tag Value> 键值对。 |
与 Kubernetes 集群相关的标签
以下信息适用于普通 Kubernetes、OpenShift 以及在受支持的云平台(EKS、AKS 和 GKE)上运行的 Kubernetes。
对于每个对象类型,Cisco Secure Workload 会从 Kubernetes 集群实时导入资产,包括与对象关联的标签。标签键和值将按原样导入。
除了导入为 Kubernetes 对象定义的标签外,Cisco Secure Workload 还会生成便于在资产过滤器中使用这些对象的标签。这些附加标签在定义范围和策略时特别有用。
为所有资源生成的标签
Cisco Secure Workload 会向从 Kubernetes/OpenShift/EKS/AKS/GKE API 服务器检索的所有节点、Pod 和服务添加以下标签。
键 |
值 |
---|---|
orchestrator_system/orch_type |
kubernetes |
orchestrator_system/cluster_id |
<|产品| 中集群配置的 UUID> |
orchestrator_system/cluster_name |
<kubernetes 集群的名称> |
orchestrator_system/name |
<连接器的名称> |
orchestrator_system/namespace |
<此项目的 Kubernetes/OpenShift/EKS/AKS/GKE 命名空间> |
节点特定标签
以下标签仅针对节点生成。
键 |
值 |
---|---|
orchestrator_system/workload_type |
机器 |
orchestrator_system/machine_id |
<由 Kubernetes/OpenShift 分配的 UUID> |
orchestrator_system/machine_name |
<为此节点提供的名称> |
orchestrator_system/kubelet_version |
<此节点上运行的 kubelet 版本> |
orchestrator_system/container_runtime_version |
<在此节点上运行的容器运行时版本> |
Pod 特定标签
以下标签仅为 Pod 生成。
键 |
值 |
---|---|
orchestrator_system/workload_type |
pod |
orchestrator_system/pod_id |
<由 Kubernetes/OpenShift 分配的 UUID> |
orchestrator_system/pod_name |
<为此 Pod 提供的名称> |
orchestrator_system/hostnetwork |
<true|false> 反映 Pod 是否在主机网络中运行 |
orchestrator_system/machine_name |
<Pod 在其上面运行的节点的名称> |
orchestrator_system/service_endpoint |
[此 Pod 提供的服务名称列表] |
服务特定标签
以下标签仅为服务生成。
键 |
值 |
---|---|
orchestrator_system/workload_type |
service |
orchestrator_system/service_name |
<为此服务提供的名称> |
-
(仅适用于云管理的 Kubernetes)ServiceType: LoadBalancer 的服务仅支持用于收集元数据,不支持用于收集流数据或用于策略执行。
Tip |
使用 orchestrator_system/service_name 过滤项目与使用 orchestrator_system/service_endpoint 过滤项目不同。 例如,使用过滤器 orchestrator_system/service_name = web 会选择名称为 web 的所有服务,而使用 orchestrator_system/service_endpoint = web 会选择提供名称为 web 的服务的所有 Pod。 |
Kubernetes 集群的标签示例
以下示例显示 Kubernetes 节点的部分 YAML 表示形式以及Cisco Secure Workload 导入的相应标签。
- apiVersion: v1
kind: Node
metadata:
annotations:
node.alpha.kubernetes.io/ttl: "0"
volumes.kubernetes.io/controller-managed-attach-detach: "true"
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/hostname: k8s-controller
导入的标签键 |
---|
orchestrator_beta.kubernetes.io/arch |
orchestrator_beta.kubernetes.io/os |
orchestrator_kubernetes.io/hostname |
orchestrator_annotation/node.alpha.kubernetes.io/ttl |
orchestrator_annotation/volumes.kubernetes.io/controller-managed-attach-detach |
orchestrator_system/orch_type |
orchestrator_system/cluster_id |
orchestrator_system/cluster_name |
orchestrator_system/namespace |
orchestrator_system/workload_type |
orchestrator_system/machine_id |
orchestrator_system/machine_name |
orchestrator_system/kubelet_version |
orchestrator_system/container_runtime_version |
导入自定义标签
您可以上传或手动分配自定义标签,以便将用户定义的数据与特定主机相关联。此用户定义的数据会别用于注释关联的流和资产。
无论标签源如何(手动输入或上传、使用连接器或外部协调器注入等),可在所有根范围内标记的 IPv4/IPv6 地址/子网的数量都有限制。有关详细信息,请参阅标签限制。
上传标签文件指南
Procedure
Step 1 |
要查看示例文件,请在左侧窗格中选择下载示例 (Download a Sample)。 ,然后点击 |
Step 2 |
用于上传用户标签的 CSV 文件必须包含标签密钥(IP 地址)。 |
Step 3 |
要在标签中使用非英文字符,CSV 文件必须为 UTF-8 格式。 |
Step 4 |
确保 CSV 文件符合“标签密钥架构”部分中所述的准则。 |
Step 5 |
所有上传的文件都必须遵循相同的架构。 |
标签密钥架构
列名管理准则
-
标签密钥架构中必须有一列带有“IP”标题。此外,还必须至少有一列包含 IP 地址的属性。
-
“VRF”列在标签方案中具有特殊意义。如果提供,它应与您将标签上传到的根范围匹配。使用范围无关 API 上传 CSV 文件时,必须执行此操作。
-
列名只能包含以下字符:字母、数字、空格、连字符、下划线和斜线。
-
列名不能超过 200 个字符。
-
列名不能以“orchestrator_”、“TA_”、“ISE_”、“SNOW_”或“LDAP_”作为前缀,因为它们可能与来自内部应用的标签冲突。
-
CSV 文件不应包含重复的列名。
列值管理准则
-
值限制为 255 个字符。但是,它们应尽可能简短,同时仍要清晰、独特,并对用户有意义。
-
键和值不区分大小写。但建议保持一致。
-
“IP”列下显示的地址应符合以下格式:
-
IPv4 地址的格式可以是“xxxx”和“xxxx/32”。
-
IPv4 子网的格式应为“xxxx/<netmask> ”,其中 netmask 是 0 到 31 之间的整数。
-
长整型格式(“x:x:x:x:x:x:x:x”或“x:x:x:x:x:x:x:x/128”)和规范格式( “x:x::x”或“x:x::x/128”)。
-
IPv6 子网,采用长格式(“x:x:x:x:x:x:x:x/<netmask> ”)和规范格式(“x:x::x/ ”)。网络掩码必须是介于 0 和 127 之间的整数。
-
列的顺序无关紧要。系统将自动为标签启用前 32 个用户定义的列。如果上传的列超过 32 个,选中页面右侧的复选框最多可以启用 32 个。
上传自定义标签
以下步骤介绍具有站点管理员、客户支持或根范围所有者角色的用户如何上传标签。
Before you begin
要上传自定义标签,请根据“上传标签文件指南”部分创建一个 CSV 文件。
Procedure
Step 1 |
在左侧窗格中,选择上传新标签 (Upload New Labels) 下点击选择文件 (Select File)。 ,然后在 |
||
Step 2 |
在左侧窗格中,选择上传新标签 (Upload New Labels) 下点击选择文件 (Select File)。 ,然后在 |
||
Step 3 |
选择操作 - 添加、合并或删除。
重要提示:在上传自定义标签时,删除功能将删除与指定 IP 地址/子网关联的所有标签,而不限于 CSV 文件中列出的列。因此,必须谨慎使用删除操作。 |
||
Step 4 |
点击上传 (Upload)。 |
搜索标签
具有站点管理员、客户支持或根范围所有者角色的用户可以搜索、查看和编辑分配给 IP 地址或子网的标签。
Procedure
Step 1 |
在标签管理 (Label Management) 页面上,点击搜索并分配 (Search and Assign)。 |
Step 2 |
在 IP 或子网 (IP or Subnet) 字段中,输入 IP 地址或子网,然后点击下一步 (Next)。 在“分配标签”(Assign Labels) 页面上,系统将显示输入的 IP 地址或子网的现有标签。 |
手动分配或编辑自定义标签
具有站点管理员、客户支持或根范围所有者角色的用户可以将标签手动分配给给定的 IP 地址或子网。
过程
步骤 1 |
在标签管理 (Label Management) 页面上,点击搜索并分配 (Search and Assign)。 |
步骤 2 |
在 IP 或子网 (IP or Subnet) 字段中,输入 IP 地址或子网,然后点击下一步 (Next)。 系统将显示“分配标签”(Assign Labels) 页面。请注意,将显示现有标签,并可对其进行编辑。 |
步骤 3 |
要添加新标签,请在 <IP 地址/子网> 的标签 (Labels for <IP address/subnet>) 部分中输入标签名称和值,然后点击确认 (Confirm)。点击下一步 (Next)。 |
步骤 4 |
查看更改,然后点击分配 (Assign) 进行提交。 |
下载标签
具有站点管理员、客户支持或根范围所有者角色的用户可以下载属于根范围的先前定义的标签。
Procedure
Step 1 |
在标签管理 (Label Management) 页面上,点击上传用户定义的标签 (User Defined Label Upload)。 |
Step 2 |
在下载现有标签 (Download Existing Labels) 部分下,点击下载标签 (Download Labels)。 Cisco Secure Workload 使用的标签会作为 CSV 文件下载。 |
更改标签
警告 |
如果需要更改标签,请谨慎操作,因为这样做会更改基于该标签的现有查询、过滤器、范围、集群、策略和强制行为的成员身份和影响。 |
过程
步骤 1 |
在标签管理 (Label Management) 页面上,点击搜索并分配 (Search and Assign) 选项卡。 |
步骤 2 |
在 IP 或子网 (IP or Subnet) 字段中,输入 IP 地址或子网,然后点击下一步 (Next)。 系统将显示 Cisco Secure Workload 用于输入的 IP 地址/子网的标签。 |
步骤 3 |
在操作 (Actions) 列下,点击编辑图标以更改所需标签的名称和值。 |
步骤 4 |
点击确认 (Confirm),然后点击下一步 (Next)。 |
步骤 5 |
查看更改,然后点击分配 (Assign)。 |
禁用标签
更改架构的一种方法是禁用标签。请谨慎使用。
过程
步骤 1 |
导航至标签管理 (Label Management) 页面。 |
步骤 2 |
对于所需的标签,在操作 (Actions) 列下,选择禁用 (Disable),然后点击是 (Yes) 以确认以从资产中删除标签。 如果您决定稍后启用该标签,请点击启用 (Enable) 以使用该标签。 |
查看标签更改影响
具有站点管理员、客户支持或根范围所有者角色的用户可以查看和编辑分配给 IP 地址或子网的标签。
过程
步骤 1 |
在标签管理 (Label Management) 页面上,点击搜索并分配 (Search and Assign)。 |
步骤 2 |
在 IP 或子网 (IP or Subnet) 字段中,输入 IP 地址或子网,然后点击下一步 (Next)。 请注意,从 IP 地址或子网继承的现有标签是可编辑的。 |
步骤 3 |
要添加新标签,请在 Labels for IP address/subnet 部分中输入标签名称和值,然后点击确认 (Confirm)。 |
步骤 4 |
点击下一步 (Next)。 |
步骤 5 |
在操作 (Action) 列下,点击与要查看详细信息的标签对应的查看标签更改影响 (Review Label Change Impact) 链接。 |
步骤 6 |
点击返回 (Back) 关闭页面。 |
步骤 7 |
在搜索和分配 (Search and Assign) 页面中,点击分配 (Assign) 以确认更改。 |
删除标签
小心 |
更改架构的一种方法是禁用标签并将其删除。请谨慎决定。此操作会删除影响所有相关过滤器和范围的所选标签。确保这些标签未使用。此操作无法撤消。 |
过程
步骤 1 |
禁用标签。有关详细信息,请参阅禁用标签。 |
步骤 2 |
点击垃圾桶图标进行确认,然后点击是 (Yes) 删除标签。 |
查看标签使用情况
IP 地址或子网资产会根据使用 CSV 文件上传或用户手动分配的自定义标签进行更新。然后,标签可用于定义范围和过滤器,并根据这些过滤器创建应用策略。因此,了解标签的用法至关重要,因为对标签的任何修改都会直接影响 Cisco Secure Workload 中的范围、过滤器和策略。
要查看标签的使用情况,请执行此程序。
过程
步骤 1 |
在标签管理 (Label Management) 页面上,将显示标签键、正在使用的标签的前五个值、资产、范围、过滤器和使用自定义标签的集群。 |
步骤 2 |
在使用情况 (Usages) 列中,点击资产、范围或过滤器旁边的计数值。例如,要使用“位置”(Location) 标签查看范围,请点击范围查询 (Scope Queries) 列中的相应计数。 系统将显示范围和资产 (Scopes and Inventory) 页面,而查询会自动过滤具有所选标签的范围。 |
创建用于维护标签的流程
您的网络和资产将发生变化,因此必须计划更新标签以反映这些变化。
例如,如果某个工作负载已停用,并且其 IP 地址被重新分配给一个具有不同用途的工作负载,则需要更新与该工作负载关联的标签。这不仅适用于手动上传的标签,也适用于在其他系统 - 如配置管理数据库 (CMDB) 等系统中维护和注入的标签。
创建一个流程,确保定期、持续更新标签,并将此流程添加到网络维护日常程序中。