收集 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 管理控制台的管理员权限。

获取 Google SecOps 注入身份验证文件

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 收集代理
  3. 下载数据注入身份验证文件。将文件安全地保存在将要安装 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 上的安装目录中。
    • 使用文本编辑器(例如 nanovi 或记事本)打开该文件。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
      udplog:
        # Replace the port and IP address as required
        listen_address: "0.0.0.0:514"
    
    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
    
    service:
      pipelines:
        logs/ansible_awx:
          receivers:
            - udplog
          exporters:
            - chronicle/ansible_awx
    
  • 根据基础架构的需要替换端口和 IP 地址。
  • <customer_id> 替换为实际的客户 ID。
  • /path/to/ingestion-authentication-file.json 更新为“获取 Google SecOps 注入身份验证文件”部分中保存身份验证文件的文件路径。

重启 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. 提供以下配置详细信息:
    • 日志聚合器:输入 Bindplane 代理主机(例如 192.168.1.100)的 IP 地址。
    • 日志聚合器端口:输入 Bindplane 代理端口号(例如 514)。
    • 日志记录聚合器类型:从下拉菜单中选择其他
    • Logging Aggregator Username:留空(syslog 不需要此字段)。
    • 日志聚合器密码/令牌:留空(syslog 不需要)。
    • 日志汇总器协议:选择 UDP
    • Logging Aggregator Level Threshold:选择 INFO 或您偏好的日志级别。
    • 启用外部日志记录:切换为开启
    • 将数据发送到日志汇总器表单的记录器:选择相关日志类型:
      • awx - 通用服务器日志
      • activity_stream - AWX 对象更改记录
      • job_events - Ansible 回调模块数据
      • system_tracking - 系统事实和配置数据
    • 单独记录系统跟踪事实:切换为关闭(默认)。
  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 已映射:trueSTATUS_UPDATE
target_present metadata.event_type 已映射:trueNETWORK_CONNECTION
user_present metadata.event_type 已映射:trueUSER_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"INFORMATIONALWARNINGMEDIUM
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.*platformcodename_labelhost.*os.*platformos_name_label
os_name_label target.asset.attribute.labels 已合并
hardware target.asset.hardware 已合并
json_data target.asset.hardware 已映射:host.*os.*platformhardware
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.*platformips
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.*platformmacs
macs target.mac 已合并
kubernetes.namespace_name target.namespace 直接映射
json_data target.platform 已映射:host.*os.*platformLINUX
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 专业人士的解答。