收集 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 整合指令碼的機器之間必須建立網路連線
  • 如果透過 Proxy 執行,請確保防火牆通訊埠已根據 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
    • 中央代管偵測與應變完整伺服器

設定 Sophos Linux Sensor,將快訊匯出至 Sophos Central

設定 SIEM 整合功能前,請先設定 Sophos Linux Sensor,將快訊資料傳送至 Sophos Central。

找出 Sophos Central MCS URL

  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,將 metaevent 傳送至 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. 開啟具有根層級或 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 代理程式,擷取系統記錄檔並傳送至 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 是標準的系統記錄檔通訊埠。
  • 匯出工具設定:

    • 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 Collector
      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. 依序前往「Global Settings」(全域設定) >「API Credentials Management」(API 憑證管理)
  3. 按一下「新增憑證」
  4. 輸入憑證名稱,並視需要填入說明,然後按一下「新增」
  5. 複製「Client ID」(用戶端 ID) 和「Client Secret」(用戶端密鑰)。妥善儲存。

安裝及設定 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 Integration 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. 將輸出目的地設為系統記錄:
    • filename:輸入 syslog
  6. 設定端點類型:
    • endpoint:輸入 all 即可同時收集事件和快訊。
  7. 設定系統記錄屬性:
    • address:輸入 Bindplane 代理程式的 IP 位址和連接埠 (例如 192.168.1.100:514)。
    • facility:輸入 daemon
    • socktype:輸入 udp
  8. 儲存並關閉檔案。

執行 SIEM 整合指令碼

  1. 開啟終端機或命令提示字元,然後前往指令碼目錄。
  2. 執行指令碼:

    python3 siem.py
    

自動執行 SIEM 整合指令碼

Windows (工作排程器)

  1. 從「開始」選單開啟「工作排程器」
  2. 按一下「建立工作」
  3. 在「一般」分頁中:
    • 「Name」(名稱):輸入 Sophos Capsule8 SIEM Export
  4. 在「觸發條件」分頁中:
    1. 點選「New」(新增)
    2. 將工作設為每 5 分鐘重複一次,時間長度為「無限期」
  5. 在「動作」分頁中:
    1. 按一下「新增」,然後選取「開始計畫」
    2. 在「Program/script」(程式/指令碼) 欄位中,輸入 python.exe 的路徑。
    3. 在「Add arguments」(新增引數) 欄位中,輸入 siem.py 的完整路徑。
    4. 在「Start in」欄位中,輸入包含 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 專業人員尋求答案。