收集 Sophos Capsule8 日志

支持的平台:

本文档介绍了如何使用 Bindplane 代理将 Sophos Capsule8(Linux 传感器)日志注入到 Google Security Operations。Sophos Linux Sensor(以前称为 Capsule8)通过使用 eBPF 技术在内核级检测和应对威胁,为 Linux 工作负载、容器和 Kubernetes 环境提供运行时保护。警报和遥测数据会发送到 Sophos Central,然后可以使用 Sophos Central SIEM 集成脚本将其导出到 SIEM。

准备工作

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

  • Google SecOps 实例
  • Windows Server 2016 或更高版本,或者具有 systemd 的 Linux 主机
  • 一台能够持续运行 Python 3.7 或更高版本的 Windows、Linux 或 macOS 机器
  • Bindplane 代理与运行 Sophos SIEM 集成脚本的机器之间的网络连接
  • 如果通过代理运行,请确保防火墙端口已根据 Bindplane 代理要求打开
  • 对 Sophos Central 管理控制台的特权访问权限
  • 已在 Linux 系统上部署 Sophos Linux Sensor (Capsule8)
  • Sophos Linux Sensor 版本 5.5.2.22 或更高版本
  • 以下 Sophos Central 许可之一:
    • Intercept X Advanced for Server with XDR
    • Central Managed Detection and Response Essential Server
    • Central Managed Detection and Response Complete Server

将 Sophos Linux Sensor 配置为将提醒导出到 Sophos Central

在配置 SIEM 集成之前,您必须先配置 Sophos Linux Sensor,以将提醒数据发送到 Sophos Central。

查找 Sophos Central MCS 网址

  1. 登录 Sophos Central
  2. 点击您的账号名称,然后点击支持设置
  3. 找到以此账号位于开头的行,以确定您的地理区域。
  4. 请使用下表根据您所在的区域查找 MCS 网址:

    区域 MCS 网址
    美国(俄勒冈) mcs2-cloudstation-us-west-2.prod.hydra.sophos.com
    美国(俄亥俄州) mcs2-cloudstation-us-east-2.prod.hydra.sophos.com
    爱尔兰 mcs2-cloudstation-eu-west-1.prod.hydra.sophos.com
    德国 mcs2-cloudstation-eu-central-1.prod.hydra.sophos.com
    加拿大 mcs2.stn100yul.ctr.sophos.com
    澳大利亚 mcs2.stn100syd.ctr.sophos.com
    亚太地区(东京) mcs2.stn100hnd.ctr.sophos.com
    南美洲(圣保罗) mcs2.stn100gru.ctr.sophos.com

配置 Sophos Linux Sensor 提醒输出

  1. 在安装了 Sophos Linux Sensor 的 Linux 主机上,使用文本编辑器打开 /etc/sophos/runtimedetections.yaml
  2. 添加或更新以下配置,并将占位值替换为您的实际 Sophos Central 详细信息:

    send_labs_telemetry: true
    endpoint_telemetry_enabled: true
    cloud_meta: auto
    
    # Set your Sophos Central tenant ID
    customer_id: "{TENANT_ID}"
    
    mcs:
      token: "{LINUX_REPO_API_KEY}"
      url: "{MCS_URL}"
      enabled: true
    
    • {TENANT_ID}:您的 Sophos Central 租户 ID。
    • {LINUX_REPO_API_KEY}:您的 SLS 软件包代码库 API 令牌。
    • {MCS_URL}:上表中您所在区域的 MCS 网址。
  3. 保存文件并退出。

  4. 重启 Sophos Linux Sensor 服务:

    sudo systemctl restart sophoslinuxsensor
    

将 Sophos Linux Sensor 配置为向 Data Lake 发送元事件(可选)

从 5.11.0 版开始,Sophos Linux Sensor 支持将事件数据发送到 Sophos Data Lake 以进行额外的遥测。

  1. 使用文本编辑器打开 /etc/sophos/runtimedetections.yaml
  2. 添加以下配置:

    investigations:
      reporting_interval: 5s
      zeromq:
        topics:
        - process_events: running_processes_linux_events
          audit_user_msg: user_events_linux
      sinks:
      - backend: mcs
        name: "mcs"
        type: mcs
      flight_recorder:
        enabled: true
        tables:
        - name: "process_events"
          enabled: true
          rows: 1000
          filter:
          - match eventType == "PROCESS_EVENT_TYPE_EXEC"
          - match eventType == "BASELINE_TASK"
          - default ignore
        - name: "audit_user_msg"
          enabled: true
          rows: 1000
          filter:
          - ignore programName == "cron"
          - ignore processPid == 1
          - default match
    
  3. 保存文件并退出。

  4. 重启 Sophos Linux Sensor 服务:

    sudo systemctl restart sophoslinuxsensor
    

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

  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
    
  3. 等待安装完成。

  4. 运行以下命令,验证安装是否成功:

    sc query observiq-otel-collector
    

    该服务应显示为 RUNNING

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
    
  3. 等待安装完成。

  4. 运行以下命令,验证安装是否成功:

    sudo systemctl status observiq-otel-collector
    

    该服务应显示为有效(正在运行)

其他安装资源

如需了解其他安装选项和问题排查信息,请参阅 Bindplane 代理安装指南

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

找到配置文件

  • Linux

    sudo nano /etc/bindplane-agent/config.yaml
    
  • Windows

    notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
    

修改配置文件

  • config.yaml 的全部内容替换为以下配置:

    receivers:
      udplog:
        listen_address: "0.0.0.0:514"
    
    exporters:
      chronicle/sophos_capsule8:
        compression: gzip
        creds_file_path: '/etc/bindplane-agent/ingestion-auth.json'
        customer_id: 'your-customer-id'
        endpoint: malachiteingestion-pa.googleapis.com
        log_type: SOPHOS_CAPSULE8
        raw_log_field: body
        ingestion_labels:
    
    service:
      pipelines:
        logs/sophos_capsule8_to_chronicle:
          receivers:
            - udplog
          exporters:
            - chronicle/sophos_capsule8
    

配置参数

替换以下占位符:

  • 接收器配置

    • listen_address:要监听的 IP 地址和端口。使用 0.0.0.0 可监听所有接口。端口 514 是标准 syslog 端口。
  • 导出器配置

    • creds_file_path:提取身份验证文件的完整路径:
      • Linux/etc/bindplane-agent/ingestion-auth.json
      • WindowsC:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
    • customer_id:Google SecOps 客户 ID。
    • endpoint:区域端点网址:
      • 美国malachiteingestion-pa.googleapis.com
      • 欧洲europe-malachiteingestion-pa.googleapis.com
      • 亚洲asia-southeast1-malachiteingestion-pa.googleapis.com
      • 如需查看完整列表,请参阅区域级端点

保存配置文件

  • 修改后,保存文件:

    • Linux:依次按 Ctrl+OEnterCtrl+X
    • Windows:依次点击文件 > 保存

重启 Bindplane 代理以应用更改

  • 如需在 Linux 中重启 Bindplane 代理,请运行以下命令:

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

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

      sudo journalctl -u observiq-otel-collector -f
      
  • 如需在 Windows 中重启 Bindplane 代理,请选择以下选项之一:

    • 以管理员身份运行命令提示符或 PowerShell:

      net stop observiq-otel-collector && net start observiq-otel-collector
      
    • 服务控制台:

      1. Win+R,输入 services.msc,然后按 Enter 键。
      2. 找到 observIQ OpenTelemetry 收集器
      3. 右键点击并选择重新启动
      4. 验证服务是否正在运行:

        sc query observiq-otel-collector
        
      5. 检查日志是否存在错误:

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

配置 Sophos Central API 凭据

  1. 登录 Sophos Central Admin
  2. 依次前往全局设置 > API 凭据管理
  3. 点击添加凭据
  4. 输入凭据名称和可选说明,然后点击添加
  5. 复制客户端 ID客户端密钥。请妥善存储这些信息。

安装并配置 Sophos Central SIEM 集成脚本

安装 Python

  1. Python 网站下载并安装 Python 3.7 或更高版本。
  2. 在 Windows 上,请在安装期间勾选 Add Python to PATH 框。
  3. 运行以下命令,验证安装是否成功:

    python3 --version
    

下载 Sophos Central SIEM 集成脚本

  1. Sophos Central SIEM 集成 GitHub 代码库下载最新版本。
  2. 将 ZIP 文件解压缩到脚本将运行的计算机上的目录中。

配置 SIEM 集成脚本

  1. 在提取的目录中,将 config.ini.sample 复制到 config.ini
  2. 使用文本编辑器打开 config.ini
  3. [login] 部分下,输入 API 凭据:
    • client_id:输入 Sophos Central 中的客户端 ID。
    • client_secret:输入 Sophos Central 中的客户端密钥。
  4. 设置输出格式:
    • format:输入 json
  5. 将输出目的地设置为 syslog:
    • filename:输入 syslog
  6. 设置端点类型:
    • endpoint:输入 all 可同时收集事件和提醒。
  7. 配置 syslog 属性:
    • address:输入 Bindplane 代理的 IP 地址和端口(例如 192.168.1.100:514)。
    • facility:输入 daemon
    • socktype:输入 udp
  8. 保存并关闭文件。

运行 SIEM 集成脚本

  1. 打开终端或命令提示符,然后前往脚本目录。
  2. 运行脚本:

    python3 siem.py
    

自动执行 SIEM 集成脚本

Windows(任务计划程序)

  1. 从“开始”菜单中打开任务计划程序
  2. 点击创建任务
  3. 常规标签页中:
    • 名称:输入 Sophos Capsule8 SIEM Export
  4. 触发器标签页中:
    1. 点击 New(新建)。
    2. 将任务设置为每 5 分钟重复一次,持续时间为无限期
  5. 操作标签页中:
    1. 点击新建,然后选择启动计划
    2. 程序/脚本字段中,输入 python.exe 的路径。
    3. 添加实参字段中,输入 siem.py 的完整路径。
    4. 启动位置字段中,输入包含 siem.py 的目录。
  6. 点击确定以保存任务。

Linux 或 macOS (cron)

  1. 打开终端并修改 crontab:

    crontab -e
    
  2. 添加以下代码行,以便每 5 分钟运行一次脚本:

    */5 * * * * cd /path/to/Sophos-Central-SIEM-Integration && /usr/bin/python3 siem.py
    
  3. 保存并退出编辑器。

UDM 映射表

日志字段 UDM 映射 逻辑
_network_interface_eth0_addr_0 principal.ip 已合并
_label_container_id principal.labels 已合并
_label_container_name principal.labels 已合并
_label_image_id principal.labels 已合并
_label_image_name principal.labels 已合并
_label_kubernetes_namespace principal.labels 已合并
_label_kubernetes_pod principal.labels 已合并
_label_maintainer principal.labels 已合并
_process_labels principal.labels 已合并
metadata.network_interface_eth0_hardware_addr principal.mac 已合并
_security_result security_result 已合并
不适用 metadata.gcp_instance_zone 常量:^.*?zones.(?P<_zone>.*)
不适用 metadata.network_interface_eth0_addr_0 常量:^(?P<_network_interface_eth0_addr_0>.*?)/

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