收集 Ansible AWX 日志

解析器版本:1.0

支持的语言:

本文档介绍了如何使用 Bindplane 将 Ansible AWX 日志注入 Google Security Operations。 Ansible AWX 是一款开源 Web 应用,可为 Ansible 提供界面、REST API 和任务引擎。借助它,团队可以集中管理整个组织的自动化 playbook、清单、凭据和预定作业。解析器会从 JSON 格式的 Ansible AWX 日志中提取字段,并将这些值映射到统一数据模型 (UDM)。

准备工作

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

  • Google SecOps 实例。
  • Windows Server 2016 或更高版本,或者具有 systemd 的 Linux 主机。
  • 如果在代理后面运行,请确保根据 Bindplane 代理要求打开防火墙端口。
  • 对 Ansible AWX 管理控制台的特权访问权限,具有管理员权限。

获取 Bindplane 代理的 Google SecOps 凭证

如需向 Google SecOps 验证 Bindplane 代理的身份,请选择以下方法之一:

  • 新部署:使用 Chronicle API(选项 1)。
  • 旧版部署:继续使用数据注入身份验证文件(方法 2),直到 Ingestion API 于 2027 年 7 月 20 日停用。
  1. 登录 Google Cloud 控制台,然后选择与您的 Google SecOps 实例关联的 Google Cloud 项目。
  2. 前往 IAM 和管理 > 服务账号。
  3. 点击创建服务账号。
  4. 提供以下配置详细信息:
    • 服务账号名称:输入账号的名称(例如 bindplane-ingest)。
    • 服务账号说明:输入说明(例如 Bindplane agent log ingestion)。
  5. 点击创建并继续。
  6. 在向此服务账号授予对项目的访问权限部分,点击选择角色,然后选择 Chronicle Editor。
  7. 点击继续,然后点击完成。
  8. 点击您创建的服务账号,然后前往密钥标签页。
  9. 依次点击添加密钥 > 创建新密钥。
  10. 选择 JSON,然后点击创建。密钥文件会下载到您的计算机上。
  11. 将密钥文件另存为 Bindplane 收集器目录(Linux 上的 /opt/observiq-otel-collector/ingestion-auth.json 或 Windows 上的 C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json)中的 ingestion-auth.json,或更新 config.yaml 中的 creds_file_path 以匹配您保存该文件的路径。
  12. 前往 IAM 和管理 > 设置,然后复制项目编号。您需要此信息才能配置导出器。

方法 2:下载数据注入身份验证文件(旧版)

  1. 登录 Google SecOps 控制台。
  2. 前往 SIEM 设置> 收集代理。
  3. 下载数据注入身份验证文件。
  4. 将文件安全地保存在将要安装 Bindplane 代理的系统上。

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 配置文件。
  3. 从组织详细信息部分复制并保存客户 ID。

安装 Bindplane 代理

按照以下说明在 Windows 或 Linux 操作系统上安装 Bindplane 代理。

Windows 安装

  1. 以管理员身份打开命令提示符或 PowerShell。
  2. 运行以下命令:

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

Linux 安装

  1. 打开具有 root 或 sudo 权限的终端。
  2. 运行以下命令:

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
    

其他安装资源

如需了解其他安装选项,请参阅此安装指南。

配置 Bindplane 代理以注入 syslog 并将其发送到 Google SecOps

  1. 访问配置文件:

    • 找到 config.yaml 文件。通常,该文件位于 Linux 上的 /observiq-otel-collector/ 目录中,或 Windows 上的安装目录中。
    • 使用文本编辑器(例如 nano、vi 或记事本)打开该文件。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
      udplog:
        # Replace the port and IP address as required
        listen_address: "0.0.0.0:514"
    
    exporters:
      chronicle/ansible_awx:
        protocol: https
        # Region of your instance, for example us, europe, asia-southeast1
        location: <LOCATION>
        # Project number of the Google Cloud project linked to the instance
        project: '<PROJECT_NUMBER>'
        compression: gzip
        # Adjust the path to the credentials file you downloaded in Step 1
        creds_file_path: '/path/to/ingestion-authentication-file.json'
        # Replace with your actual customer ID from Step 2
        customer_id: '<customer_id>'
        endpoint: chronicle.googleapis.com
        log_type: 'ANSIBLE_AWX'
        raw_log_field: body
    
    service:
      pipelines:
        logs/ansible_awx:
          receivers:
            - udplog
          exporters:
            - chronicle/ansible_awx
    
  • 根据您基础设施的需要替换端口和 IP 地址。
  • 将 <LOCATION> 替换为 Google SecOps 实例所在的区域(例如 us、europe 或 asia-southeast1)。导出工具会为此值添加 chronicle.googleapis.com 前缀。
  • 将 <PROJECT_NUMBER> 替换为 IAM 和管理 > 设置中的项目编号。
  • 将 <customer_id> 替换为实际客户 ID。
  • 将 /path/to/ingestion-authentication-file.json 更新为“获取 Bindplane 代理的 Google SecOps 凭据”部分中保存服务账号密钥文件(选项 1)的文件路径。

旧版提取 API 导出工具

  • 如果您使用选项 2 中的数据注入身份验证文件,请将 exporters 代码块替换为以下内容。将 creds_file_path 设置为提取身份验证文件的路径,如果您的实例位于美国境外,请将 malachiteingestion-pa.googleapis.com 替换为您的区域端点(例如 europe-malachiteingestion-pa.googleapis.com)。

    exporters:
      chronicle/ansible_awx:
        compression: gzip
        # Adjust the path to the credentials file you downloaded in Step 1
        creds_file_path: '/path/to/ingestion-authentication-file.json'
        # Replace with your actual customer ID from Step 2
        customer_id: '<customer_id>'
        endpoint: malachiteingestion-pa.googleapis.com
        log_type: 'ANSIBLE_AWX'
        raw_log_field: body
    

重启 Bindplane 代理以应用更改

如需在 Linux 中重启 Bindplane 代理,请执行以下操作:

  1. 运行以下命令:

    sudo systemctl restart observiq-otel-collector
    
  2. 验证服务是否正在运行:

    sudo systemctl status observiq-otel-collector
    
  3. 检查日志中是否存在错误:

    sudo journalctl -u observiq-otel-collector -f
    

如需在 Windows 中重启 Bindplane 代理,请执行以下操作:

  1. 请从下列选项中选择一项:

    • 以管理员身份运行命令提示符或 PowerShell:
    net stop observiq-otel-collector && net start observiq-otel-collector
    
    • “服务”控制台:
      1. 按 Win+R,输入 services.msc,然后按 Enter 键。
      2. 找到 observIQ OpenTelemetry 收集器。
      3. 右键点击,然后选择重新启动。
  2. 验证服务是否正在运行:

    sc query observiq-otel-collector
    
  3. 检查日志中的错误:

    type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
    

在 Ansible AWX 上配置外部日志记录

  1. 登录 Ansible AWX 网页界面。
  2. 从左侧导航栏前往设置。
  3. 在系统部分下,选择日志记录设置。
  4. 点击“日志记录设置”页面底部的修改。
  5. 提供以下配置详细信息:
    • Logging Aggregator:输入 Bindplane 代理主机的 IP 地址(例如 192.168.1.100)。
    • 日志记录聚合器端口:输入 Bindplane 代理端口号(例如 514)。
    • 日志记录聚合器类型:从下拉菜单中选择其他。
    • 日志聚合器用户名:留空(syslog 不需要)。
    • Logging Aggregator Password/Token(日志记录汇总工具密码/令牌):留空(syslog 不需要)。
    • 日志记录聚合器协议:选择 UDP。
    • Logging Aggregator Level Threshold:选择 INFO 或您偏好的日志级别。
    • 启用外部日志记录:切换到开启。
    • Loggers to Send Data to the Log Aggregator Form(要将数据发送到日志聚合器表单的日志记录器):选择相关的日志类型:
      • awx - 常规服务器日志
      • activity_stream - AWX 对象更改记录
      • job_events - Ansible 回调模块数据
      • system_tracking - 系统事实和配置数据
    • Log System Tracking Facts Individually(单独记录系统跟踪事实):切换为 OFF(关闭,默认)。
  6. 点击保存以应用设置。
  7. 点击测试以验证与 Bindplane 代理的连接。

UDM 映射表

日志字段 UDM 映射 逻辑
logger_name intermediary.application 直接映射
RenderedMessage metadata.description 直接映射
description metadata.description 直接映射
event1 metadata.description 直接映射
message metadata.description 直接映射
timestamp metadata.event_timestamp 已解析为 yyyy-MM-ddTHH:mm:ss.SSSZ
principal_present metadata.event_type 已映射:true → STATUS_UPDATE
target_present metadata.event_type 已映射:true → NETWORK_CONNECTION
user_present metadata.event_type 已映射:true → USER_UNCATEGORIZED
event1_data.uuid metadata.product_log_id 直接映射
Properties.Method network.http.method 直接映射
agent.type observer.application 直接映射
agent.id observer.asset_id 直接映射
agent.type observer.asset_id 直接映射
agent.hostname observer.hostname 直接映射
ephemeral_id_label observer.labels 已合并
agent.version observer.platform_version 直接映射
agent.name observer.user.userid 直接映射
Properties.applicationName principal.application 直接映射
Properties.MachineName principal.asset.asset_id 直接映射
Properties.Host principal.asset.hostname 直接映射
event1_data.remote_addr principal.asset.hostname 直接映射
principal_device principal.asset.hostname 直接映射
principal_hostname principal.asset.hostname 直接映射
Properties.ClientIP principal.asset.ip 已合并
ip_address principal.asset.ip 已合并
principal_ip principal.asset.ip 已合并
src_ip principal.asset.ip 已合并
Properties.Host principal.hostname 直接映射
event1_data.remote_addr principal.hostname 直接映射
principal_device principal.hostname 直接映射
principal_hostname principal.hostname 直接映射
Properties.ClientIP principal.ip 已合并
ip_address principal.ip 已合并
principal_ip principal.ip 已合并
src_ip principal.ip 已合并
src_port principal.port 直接映射
event1_data.task_path principal.process.file.full_path 直接映射
process_pid principal.process.pid 直接映射
availability_zone principal.resource.attribute.labels 已合并
connectionid_label principal.resource.attribute.labels 已合并
endpointname_label principal.resource.attribute.labels 已合并
machine_type principal.resource.attribute.labels 已合并
provider principal.resource.attribute.labels 已合并
cloud.instance.name principal.resource.name 直接映射
cloud.instance.id principal.resource.product_object_id 直接映射
Properties.UserName principal.user.userid 直接映射
user_name principal.user.userid 直接映射
event1_display security_result.description 直接映射
ca_id_label security_result.detection_fields 已合并
cf_component_label security_result.detection_fields 已合并
container_hash_label security_result.detection_fields 已合并
container_image_label security_result.detection_fields 已合并
container_name_label security_result.detection_fields 已合并
messagetemplate_label security_result.detection_fields 已合并
parent_uuid_label security_result.detection_fields 已合并
requestid_label security_result.detection_fields 已合并
requestpath_label security_result.detection_fields 已合并
serviceNowId_label security_result.detection_fields 已合并
sourcecontext_label security_result.detection_fields 已合并
stream_label security_result.detection_fields 已合并
task_label security_result.detection_fields 已合并
task_uuid_label security_result.detection_fields 已合并
threadid_label security_result.detection_fields 已合并
wf_env_label security_result.detection_fields 已合并
wf_id_label security_result.detection_fields 已合并
level security_result.severity 已映射:"DEBUG", "INFO", "AUDIT" → INFORMATIONAL,WARNING → MEDIUM
level security_result.severity_details 直接映射
log security_result.summary 直接映射
host.fqdn target.administrative_domain 直接映射
host.id target.asset.asset_id 直接映射
codename_label target.asset.attribute.labels 已合并
json_data target.asset.attribute.labels 已映射:host.*os.*platform → codename_label,host.*os.*platform → os_name_label
os_name_label target.asset.attribute.labels 已合并
hardware target.asset.hardware 已合并
json_data target.asset.hardware 已映射:host.*os.*platform → hardware
host.hostname target.asset.hostname 直接映射
kubernetes.host target.asset.hostname 直接映射
target_device target.asset.hostname 直接映射
ips target.asset.ip 已合并
json_data target.asset.ip 已映射:host.*os.*platform → ips
target_ip target.asset.ip 已合并
kubernetes.docker_id target.asset_id 直接映射
host.hostname target.hostname 直接映射
kubernetes.host target.hostname 直接映射
target_device target.hostname 直接映射
target_ip target.ip 已合并
json_data target.mac 已映射:host.*os.*platform → macs
macs target.mac 已合并
kubernetes.namespace_name target.namespace 直接映射
json_data target.platform 已映射:host.*os.*platform → LINUX
host.os.kernel target.platform_patch_level 直接映射
host.os.version target.platform_version 直接映射
io_instance_label target.resource.attribute.labels 已合并
io_name_label target.resource.attribute.labels 已合并
pod_id_label target.resource.attribute.labels 已合并
pod_template_hash_label target.resource.attribute.labels 已合并
cluster_name target.resource.name 直接映射
不适用 metadata.event_type 常量:NETWORK_CONNECTION
不适用 metadata.product_name 常量:ANSIBLE_AWX
不适用 metadata.vendor_name 常量:ANSIBLE_AWX
不适用 network.ip_protocol 常量:TCP
不适用 principal.resource.resource_type 常量:VIRTUAL_MACHINE
不适用 security_result.severity 常量:INFORMATIONAL
不适用 target.platform 常量:LINUX

更新日志

查看此解析器的更新日志

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