收集 Sophos Capsule8 日志

支持的语言:

本文档介绍了如何使用 Bindplane 收集 Sophos Linux Sensor(以前称为 Capsule8)日志。Sophos Capsule8 通过使用 eBPF 技术在内核级别检测和应对威胁,为 Linux 工作负载、容器和 Kubernetes 环境提供运行时保护。解析器首先提取 JSON 格式的日志数据并将其结构化。然后,它会将提取的字段映射到 Chronicle 统一数据模型 (UDM) 中的相应属性,重点是元数据、安全结果和正文信息。

准备工作

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

  • Google SecOps 实例
  • Windows 2016 或更高版本,或者具有 systemd 的 Linux 主机
  • 一台额外的 Windows 或 Linux 机器,能够持续运行 Python
  • 如果通过代理运行,请确保防火墙端口已根据 Bindplane 代理要求打开
  • 对 Sophos Central 管理控制台的特权访问权限
  • 已在 Linux 系统上部署 Sophos Linux Sensor(以前称为 Capsule8)

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

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

Sophos Central 集成的前提条件

  1. Sophos Linux Sensor 版本 5.5.2.22 或更高版本。
  2. 以下许可之一:
    • Intercept X Advanced for Server with XDR
    • Central Managed Detection and Response Essential Server
    • Central Managed Detection and Response Complete Server
  3. 您的 Sophos Central MCS 网址和租户 ID。
  4. 有效的 SLS 软件包代码库 API 令牌。

查找您的 MCS 网址

  1. 登录 Sophos Central
  2. 依次点击您的账号名称 > 支持设置
  3. 找到以 This account is located 开头的行,即可了解您的 Sophos Central 账号所在的地理区域
  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

如果您在表中未看到自己所在的区域,请使用 mcs2.stn100bom.ctr.sophos.com 作为 MCS 网址。

配置 Sophos Linux Sensor 提醒输出

  1. 使用文本编辑器打开 /etc/sophos/runtimedetections.yaml
  2. 添加以下行,并将占位符值替换为您的实际 Sophos Central 详细信息:

    send_labs_telemetry: true
    endpoint_telemetry_enabled: true
    cloud_meta: auto
    
    # Set your customer id:
    customer_id: "{tenant-id}"
    
    mcs:
      token: "{LINUX_REPO_API_KEY}"
      url: "{MCS_URL}"
      enabled: true
    
  3. 保存更改并退出。

  4. 重启传感器:

    systemctl restart sophoslinuxsensor
    

可选:配置 Sophos Linux Sensor 以将元事件发送到数据湖

从 5.11.0 版开始,SLS 支持将事件数据发送到 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. 重启传感器:

    systemctl restart sophoslinuxsensor
    

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

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

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 个人资料
  3. 复制并保存组织详细信息部分中的客户 ID

安装 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. 访问配置文件:

    1. 找到 config.yaml 文件。通常,它位于 Linux 上的 /etc/bindplane-agent/ 目录中,或位于 Windows 上的安装目录中。
    2. 使用文本编辑器(例如 nanovi 或记事本)打开该文件。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
      udplog:
        # Replace the port and IP address as required
        listen_address: "0.0.0.0:514"
    
    exporters:
      chronicle/chronicle_w_labels:
        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
        # Add optional ingestion labels for better organization
        log_type: 'SOPHOS_CAPSULE8'
        raw_log_field: body
        ingestion_labels:
    
    service:
      pipelines:
        logs/source0__chronicle_w_labels-0:
          receivers:
            - udplog
          exporters:
            - chronicle/chronicle_w_labels
    
    • 根据基础架构的需要替换端口和 IP 地址。
    • <customer_id> 替换为实际的客户 ID。
    • /path/to/ingestion-authentication-file.json 更新为获取 Google SecOps 提取身份验证文件部分中保存身份验证文件的路径。

重启 Bindplane 代理以应用更改

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

    sudo systemctl restart bindplane-agent
    
  • 如需在 Windows 中重启 Bindplane 代理,您可以使用服务控制台,也可以输入以下命令:

    net stop BindPlaneAgent && net start BindPlaneAgent
    

配置 Sophos Central API 访问权限

  1. 登录 Sophos Central Admin
  2. 依次选择全局设置 > API 令牌管理
  3. 点击添加令牌以创建新令牌。
  4. 输入令牌名称,然后点击保存;系统会显示所提供令牌的 API 令牌摘要
  5. API 令牌摘要部分,点击复制以复制 API 访问网址和标头。

在其他机器上安装 Python

  1. 打开网络浏览器,然后前往 Python 网站
  2. 点击适用于您所用操作系统的 Download Python
  3. 安装 Python:

    • 在 Windows 上:
      1. 运行安装程序。
      2. 勾选显示 Add Python to PATH 的复选框。
      3. 点击立即安装
    • 在 Mac 上:

      1. Python 可能已安装,如果没有,您可以使用终端安装最新版本。
      2. 打开终端,然后输入以下命令:

        python --version
        

下载 Sophos 集成脚本

  1. 前往 Sophos Central SIEM Integration GitHub Repository 的 GitHub 页面。
  2. 依次点击绿色的“Code”按钮 >“Download ZIP”
  3. 解压缩 ZIP 文件。

设置脚本配置

  1. 打开您解压缩 ZIP 归档文件的目录中的 config.ini 文件。
  2. 修改配置文件:
    • API 令牌:输入之前从 Sophos Central 复制的 API 密钥。
    • Syslog 服务器详细信息:输入 Syslog 服务器的详细信息。
    • 主机:输入 BindPlane 代理 IP 地址。
    • 端口:输入 BindPlane 代理端口号。
    • 协议:输入 UDP(您也可以根据自己的设置使用 TCPTLS)。
  3. 保存文件。

运行脚本

  1. 前往脚本文件夹。

    • 在 Windows 上:

      1. Windows 键,然后输入 cmd
      2. 点击命令提示符
      3. 前往脚本文件夹:
      cd C:/Users/YourName/Downloads/Sophos-Central-SIEM-Integration
      
    • 在 macOS 上:

      1. 依次前往应用 > 实用程序
      2. 打开终端
      3. 前往脚本文件夹:
      cd /Users/YourName/Downloads/Sophos-Central-SIEM-Integration
      
  2. 运行脚本

    • 输入以下命令以启动脚本:

      python siem.py
      

自动执行脚本,使其在 Windows 上持续运行(使用任务调度程序):

  1. 在“开始”菜单中输入任务计划程序,打开“任务计划程序”。
  2. 点击创建任务
  3. 常规标签页中:
    • 为任务命名(例如,Sophos AV Log Export)。
  4. 触发器标签页中:
    • 点击新建,然后将任务设置为每天启动时运行(具体取决于您的偏好)。
  5. 操作标签页中:
    • 点击新建,然后选择启动计划
    • 浏览以查找 python.exe 可执行文件(通常位于 C:/Python/XX/python.exe)。
    • 添加实参字段中,输入脚本的路径(例如 C:/Users/YourName/Downloads/Sophos-Central-SIEM-Integrationsiem.py)。
  6. 点击确定以保存任务。

自动执行脚本,使其在 Mac 上持续运行(使用 Cron 作业):

  1. 打开终端。
  2. 输入 crontab -e 并按 Enter 键。
  3. 在文件末尾添加新行:

    * * * * * /usr/bin/python /Users/YourName/Downloads/Sophos-Central-SIEM-Integration/siem.py
    
  4. 点击保存,然后退出编辑器。

UDM 映射表

日志字段 UDM 映射 逻辑
categories read_only_udm.security_result.category_details categories 数组中的每个元素都会添加为单独的 category_details。
评论 read_only_udm.security_result.description 直接从“评论”字段映射。
置信度 read_only_udm.security_result.severity_details 直接从置信度字段映射。
说明 read_only_udm.security_result.summary 直接从说明字段映射。
incident_id read_only_udm.security_result.rule_id 直接从 incident_id 字段映射。
沿袭 principal.process.parent_process... 沿袭数组用于填充父进程链,最多可填充 15 层。沿袭数组中的每个元素都代表链中的一个进程,其中索引 0 是直接父进程,更高的索引代表更远的祖先进程。每个谱系元素的 PID 和名称字段都会映射到 UDM 中的相应字段。
location.container_id principal.labels.value 直接从 location.container_id 字段映射。相应键设置为“container_id”。
location.container_labels.maintainer principal.labels.value 直接从 location.container_labels.maintainer 字段映射。相应键设置为“maintainer”。
location.container_name principal.labels.value 直接从 location.container_name 字段映射。相应键设置为“container_name”。
location.image_id principal.labels.value 直接从 location.image_id 字段映射。相应键设置为“image_id”。
location.image_name principal.labels.value 直接从 location.image_name 字段映射。相应键设置为“image_name”。
location.kubernetes_namespace principal.labels.value 直接从 location.kubernetes_namespace 字段映射。相应键设置为“kubernetes_namespace”。
location.kubernetes_pod principal.labels.value 直接从 location.kubernetes_pod 字段映射。相应键设置为“kubernetes_pod”。
matched_rule read_only_udm.security_result.rule_name 直接从 matched_rule 字段映射。
metadata.gcp_instance_hostname principal.hostname 直接从 metadata.gcp_instance_hostname 字段映射。
metadata.gcp_instance_zone principal.cloud.availability_zone 可用区是从 metadata.gcp_instance_zone 字段中提取的,提取方式是使用正则表达式。
metadata.gcp_project_id principal.cloud.project.name 直接从 metadata.gcp_project_id 字段映射。
metadata.gcp_project_numeric_id principal.cloud.project.id 直接从 metadata.gcp_project_numeric_id 字段映射。
metadata.network_interface_eth0_addr_0 principal.ip 系统会使用正则表达式从 metadata.network_interface_eth0_addr_0 字段中提取 IP 地址。
metadata.network_interface_eth0_hardware_addr principal.mac 直接从 metadata.network_interface_eth0_hardware_addr 字段映射。
policy_type read_only_udm.metadata.product_event_type 直接从 policy_type 字段映射。
process_info.args principal.labels.value process_info.args 数组中的每个元素都会添加为单独的标签。键设置为“process_info.arg[index]”,其中 index 是实参在数组中的位置。
process_info.name principal.process.file.full_path 直接从 process_info.name 字段映射。
process_info.pid principal.process.pid 直接从 process_info.pid 字段映射。
process_info.ppid principal.process.parent_process.pid 直接从 process_info.ppid 字段映射。
优先级 read_only_udm.security_result.severity 直接从优先级字段映射,并转换为大写。
时间戳 read_only_udm.metadata.event_timestamp 直接从时间戳字段映射。
uuid read_only_udm.metadata.product_log_id 直接从 UUID 字段映射。
不适用 read_only_udm.metadata.log_type 设置为常量值“SOPHOS_CAPSULE8”。
不适用 read_only_udm.metadata.event_type 设置为常量值“SCAN_HOST”。
不适用 read_only_udm.metadata.vendor_name 设置为常量值“Sophos”。
不适用 read_only_udm.metadata.product_name 设置为常量值“Capsule8”。

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