收集 ServiceNow CMDB 数据

支持的平台:

本文档介绍了如何使用第三方 API 设置 Google Security Operations Feed 来收集 ServiceNow CMDB 数据。

准备工作

确保您满足以下前提条件:

  • Google SecOps 实例
  • 通过管理控制台访问权限对 ServiceNow 实例进行特权访问
  • 具有 cmdb_read 角色的 ServiceNow 用户账号(读取访问权限的最低要求)
  • 在 ServiceNow 实例中启用 REST API(默认已启用)

配置 IP 许可名单

在创建 Feed 之前,您必须在 ServiceNow 防火墙或网络设置中将 Google SecOps IP 范围列入许可名单。

获取 Google SecOps IP 范围

向 ServiceNow 添加 IP 范围

  1. 以管理员身份登录 ServiceNow 实例
  2. 依次前往全部 > 系统安全性 > IP 地址访问权限控制
  3. 点击 New(新建)。
  4. 提供以下配置详细信息:
    • 类型:选择允许
    • IP 地址:以 CIDR 表示法输入一个 Google SecOps IP 范围(例如 192.0.2.0/24)。
    • 名称:输入一个描述性名称(例如 GGoogle SecOps IP Range 1)。
    • 有效:选中此复选框即可启用相应规则。
  5. 点击提交
  6. 针对每个额外的 Google SecOps IP 范围重复执行第 3-5 步。

配置 ServiceNow API 访问权限

如需让 Google SecOps 拉取 CMDB 数据,您需要创建具有相应权限的 ServiceNow 用户。

  1. 登录 ServiceNow 管理控制台
  2. 依次前往全部> 用户管理 > 用户
  3. 点击 New(新建)。
  4. 提供以下配置详细信息:
    • 用户 ID:输入一个描述性用户名(例如 google_secops_integration)。
    • 名字:输入 Google
    • 姓氏:输入 SecOps Integration
    • 电子邮件地址:请输入有效的电子邮件地址以接收通知。
    • 密码:点击设置密码,然后创建安全系数高的密码。
    • 有效:选中相应复选框。
    • 仅限 Web 服务访问:选中相应复选框(建议仅在需要 API 访问权限时选择此选项)。
  5. 点击提交

分配所需权限

  1. 创建用户后,打开用户记录。
  2. 前往角色部分。
  3. 点击修改
  4. 集合列表中,搜索并添加以下角色:
    • cmdb_read:提供对 CMDB 表的读取权限。
  5. 点击保存

记录 API 凭据

创建用户后,请记录以下凭据:

  • 用户名:您创建的用户 ID(例如 google_secops_integration
  • 密码:您为用户设置的密码
  • API 主机名:您的 ServiceNow 实例 FQDN(例如 myinstance.servicenow.com
    • 请勿包含 https:// 或任何路径。
    • 请勿添加结尾斜杠。
  • 表名称:要查询的 CMDB 表(例如 cmdb_cicmdb_ci_servercmdb_ci_computer

了解 ServiceNow CMDB 表

ServiceNow CMDB 以表格的层次结构形式组织。用于资产数据注入的最常见表格包括:

表名称 说明 使用场景
cmdb_ci 基本配置项表(所有 CI 表的父表) 所有配置项
cmdb_ci_server 服务器配置项 物理服务器和虚拟服务器
cmdb_ci_computer 计算机配置项 工作站、笔记本电脑、台式机
cmdb_ci_linux_server Linux 服务器配置项 尤其是 Linux 服务器
cmdb_ci_win_server Windows 服务器配置项 Windows 服务器
cmdb_ci_vm_instance 虚拟机实例 虚拟机
cmdb_ci_network_adapter 网络适配器 网络接口卡
cmdb_ci_ip_address IP 地址 IP 地址记录
cmdb_ci_service 商务服务 服务目录项
cmdb_ci_appl 应用 应用配置项

验证 REST API 访问权限

在创建 Feed 之前,请验证您的 ServiceNow API 凭据是否正常运行。

使用 REST API Explorer 进行测试(可选)

  1. 以集成用户的身份登录到 ServiceNow 实例
  2. 依次前往所有 > 系统 Web 服务 > REST > REST API 探索器
  3. 从命名空间下拉菜单中选择 Table API
  4. 选择从表格中检索记录 (GET)
  5. 路径参数中,输入表名称(例如 cmdb_ci)。
  6. 点击发送
  7. 验证响应状态是否为 200 OK,以及是否返回了记录。

使用 curl 进行测试(可选)

  • 或者,使用 curl 测试 API:

    curl "https://your-instance.service-now.com/api/now/table/cmdb_ci?sysparm_limit=10" \
    --request GET \
    --header "Accept: application/json" \
    --user 'your-username':'your-password'
    
    • 替换:
      • your-instance.service-now.com:您的 ServiceNow 实例主机名
      • your-username:您的集成用户用户名
      • your-password:集成用户的密码

成功的响应将返回包含配置项的 JSON 数据。

设置 Feed

如需配置 Feed,请按以下步骤操作:

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称(例如 ServiceNow CMDB - All CIsServiceNow CMDB - Servers)。
  5. 选择第三方 API 作为来源类型
  6. 选择 ServiceNow CMDB 作为日志类型
  7. 点击下一步
  8. 为以下输入参数指定值:

    • 用户名:输入 ServiceNow 用户 ID(例如 google_secops_integration)。
    • 密钥:输入 ServiceNow 用户密码。 重要提示:此字段为敏感字段。密码会经过加密处理,保存后无法查看。
    • API 主机名:输入 ServiceNow 实例的完全限定域名。
      • 示例: myinstance.servicenow.com
      • 请勿添加
        • 协议 (https://)
        • 路径 (/api/now/table/)
        • 尾随斜杠
    • 区域实例:如果您的 ServiceNow 实例位于特定区域,请使用正确的主机名格式:
      • 标准:instance.service-now.com
      • 欧盟:instance.service-now.eu
      • 其他区域:请咨询您的 ServiceNow 管理员
    • 表名称:输入要查询的 ServiceNow CMDB 表。
      • 示例
        • cmdb_ci(所有配置项)
        • cmdb_ci_server(所有服务器)
        • cmdb_ci_computer(工作站和计算机)
        • cmdb_ci_linux_server(仅限 Linux 服务器)
        • cmdb_ci_win_server(仅限 Windows 服务器) 注意:表名称区分大小写,必须完全一致。每个 Feed 只能查询一个表。如需注入多个表,请为每个表创建单独的 Feed。
    • 资产命名空间资产命名空间
    • 提取标签:要应用于相应 Feed 中事件的标签。
  9. 点击下一步

  10. 最终确定界面中查看新的 Feed 配置,然后点击提交

设置完成后,Feed 开始从 ServiceNow 实例检索 CMDB 记录。初始同步可能需要几分钟时间,具体取决于表中的记录数。

提取多个 CMDB 表

如需从多个 CMDB 表中注入数据,请为每个表创建单独的 Feed:

  1. 按照上述步骤创建第一个 Feed(例如,针对 cmdb_ci_server)。
  2. 点击添加新 Feed 以创建其他 Feed。
  3. 使用相同的 ServiceNow 凭据,但指定不同的表名称。

配置示例

Feed 名称 表名称 用途
ServiceNow CMDB - 服务器 cmdb_ci_server 所有服务器 CI
ServiceNow CMDB - 计算机 cmdb_ci_computer 工作站 CI
ServiceNow CMDB - 网络适配器 cmdb_ci_network_adapter 网络接口 CI
ServiceNow CMDB - 应用 cmdb_ci_appl 应用 CI

所需 API 权限

集成用户需要具备以下 ServiceNow 权限:

权限/角色 访问权限级别 用途
cmdb_read 读取 检索 CMDB 配置项数据

其他角色(可选)

  • itil:如果您需要写入权限来创建或更新 CI,则必须提供此角色(Google SecOps 提取不需要此角色)
  • rest_api_explorer:有助于在设置期间测试 API 访问权限

UDM 映射表

ServiceNow Field UDM 映射 逻辑
name entity.asset.hostname 资产的主主机名
ip_address entity.asset.ip 资产的主要 IP 地址
mac_address entity.asset.mac 资产的 MAC 地址
serial_number entity.asset.hardware.serial_number 硬件序列号
asset_tag entity.asset.asset_id 资产标签或标识符
sys_class_name entity.asset.asset_type CI 类(服务器、计算机等)
os entity.asset.platform_software.platform 操作系统
sys_created_on entity.asset.first_seen_time 素材资源创建时间戳
sys_updated_on entity.asset.last_seen_time 上次更新时间戳
location entity.asset.location.name 实际位置
company entity.asset.attribute.labels.value 所有公司/组织
event.idm.entity.entity.metadata.entity_type USER 从变更日志映射
calendar_integration", "u_ldap_source", "u_show_popup", "source", "building", "web_service_access_only", "notification", "enable_multifactor_authn", "sso_source", "sys_domain.display_value", "sys_domain.link", "u_itil_license_type", and "u_assets_validated entity.entity.asset.attribute.labels 从变更日志映射
last_login_time entity.relation.entity.user.last_login_time 从变更日志映射
x_bmgr_support_ent_bomgar_username", "vip", "zip", "time_format", "active", "gender", "failed_attempts", "federated_id", "internal_integration_user", "u_business_line", "department.link", "introduction", "preferred_language", "manager.link", "photo", "avatar", "time_zone", "schedule", and "correlation_id entity.relation.entity.user.attribute.labels 从变更日志映射
street entity.relation.entity.user.personal_address.name 从变更日志映射
department.display_value entity.relation.entity.user.department 从变更日志映射
u_office entity.relation.entity.user.company_name 从变更日志映射
title entity.relation.entity.user.title 从变更日志映射
first_name entity.relation.entity.user.first_name 从变更日志映射
last_name entity.relation.entity.user.last_name 从变更日志映射
middle_name entity.relation.entity.user.middle_name 从变更日志映射
manager.display_value entity.relation.entity.user.managers.user_display_name 从变更日志映射
sys_domain_path", "transaction_log", "cost_center", "sys_mod_count", and "sys_tags entity.entity.labels 从变更日志映射
employee_number", "phone", "home_phone", and "mobile_phone entity.relation.entity.user.phone_numbers 从变更日志映射
city entity.relation.entity.user.personal_address.city 从变更日志映射
state entity.relation.entity.user.personal_address.state 从变更日志映射
country entity.location.country_or_region 从变更日志映射
u_site_code entity.location.city 从变更日志映射
u_region entity_labels 从变更日志映射
location.display_value entity.labels 从变更日志映射
location.link entity.labels 从变更日志映射
email _relation.entity.user.email_addresses 从变更日志映射
sys_id entity.asset.product_object_id 从变更日志映射
u_sima_bs_activation_date", "attestation_status", "u_oracle_asm_lun_size", "u_app_resource_jndi_name", "is_encrypted", "monitor", "operational_status", "u_updated_ci", "u_cluster_node", "firewall_status", "skip_sync", "u_excluded", "u_data_classification", "u_sla_report", "u_restriction", "u_rack_slot", "u_account_aztech_oe.link", "u_account_aztech_oedisplay_value", "u_organisational_entity.link", "u_organisational_entity.display_value", "assignment_group.link", "assignment_group.display_value", "cost_center.link", "cost_center.display_value", "u_service_instance", "u_local_oe_cost_center", "managed_by", "u_mode_of_operation", "install_status", and "u_provider_tag entity.labels 从变更日志映射
u_build_user entity.user.email_addresses 从变更日志映射
metadata.entity_type ASSET 从变更日志映射

更新日志

查看相应解析器的更改日志

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。