收集 Sophos Capsule8 記錄
本文說明如何使用 Bindplane 代理程式,將 Sophos Capsule8 (Linux Sensor) 記錄擷取至 Google Security Operations。Sophos Linux Sensor (舊稱 Capsule8) 採用 eBPF 技術,在核心層級偵測及應對威脅,為 Linux 工作負載、容器和 Kubernetes 環境提供執行階段防護。快訊和遙測資料會傳送至 Sophos Central,您可以使用 Sophos Central SIEM 整合指令碼,將這些資料匯出至 SIEM。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體
- Windows Server 2016 以上版本,或搭載
systemd的 Linux 主機 - 另一部 Windows、Linux 或 macOS 機器,可持續執行 Python 3.7 以上版本
- Bindplane 代理程式與執行 Sophos SIEM 整合指令碼的機器之間,必須有網路連線
- 如果是在 Proxy 後方執行,請確認防火牆通訊埠已按照 Bindplane 代理程式規定開啟
- Sophos Central Admin 控制台的特殊權限
- 在 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 網址
- 登入 Sophos Central。
- 依序點選帳戶名稱和「支援設定」。
- 找出以「這個帳戶位於」開頭的行,即可判斷地理區域。
請參閱下表,根據所在區域找出 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 警告輸出
- 在安裝 Sophos Linux Sensor 的 Linux 主機上,使用文字編輯器開啟
/etc/sophos/runtimedetections.yaml。 新增或更新下列設定,並將預留位置值替換為實際的 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 網址。
儲存檔案並結束。
重新啟動 Sophos Linux Sensor 服務:
sudo systemctl restart sophoslinuxsensor
設定 Sophos Linux Sensor,將中繼事件傳送至資料湖 (選用)
從 5.11.0 版開始,Sophos Linux Sensor 支援將事件資料傳送至 Sophos 資料湖泊,以取得額外的遙測資料。
- 在文字編輯器中開啟
/etc/sophos/runtimedetections.yaml。 新增下列設定:
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儲存檔案並結束。
重新啟動 Sophos Linux Sensor 服務:
sudo systemctl restart sophoslinuxsensor
取得 Bindplane 代理程式的 Google SecOps 憑證
如要向 Google SecOps 驗證 Bindplane 代理程式,請選擇下列其中一種方法:
- 新部署作業:使用 Chronicle API (選項 1)。
- 舊版部署作業:繼續使用擷取驗證檔案 (選項 2),直到 Ingestion API 於 2027 年 7 月 20 日停用。
方法 1:為 Chronicle API 建立服務帳戶 (建議)
- 登入 Google Cloud 控制台,然後選取連結至 Google SecOps 執行個體的 Google Cloud 專案。
- 依序前往「IAM & Admin」(IAM 與管理) >「Service Accounts」(服務帳戶)。
- 按一下「建立服務帳戶」。
- 請提供下列設定詳細資料:
- 「Service account name」(服務帳戶名稱):輸入帳戶名稱 (例如
bindplane-ingest)。 - 服務帳戶說明:輸入說明 (例如
Bindplane agent log ingestion)。
- 「Service account name」(服務帳戶名稱):輸入帳戶名稱 (例如
- 點按「Create and continue」(建立並繼續)。
- 在「將專案存取權授予這個服務帳戶」部分,按一下「選取角色」,然後選取「Chronicle 編輯者」。
- 依序點選「繼續」和「完成」。
- 按一下您建立的服務帳戶,然後前往「金鑰」分頁。
- 依序點選「新增金鑰」>「建立新的金鑰」。
- 選取「JSON」,然後按一下「建立」。金鑰檔案會下載到電腦。
- 將金鑰檔案儲存為 Bindplane 收集器目錄中的
ingestion-auth.json(Linux 上的/opt/observiq-otel-collector/ingestion-auth.json或 Windows 上的C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json),或更新config.yaml中的creds_file_path,使其與儲存路徑相符。 - 依序前往「IAM & Admin」(IAM 與管理) >「Settings」(設定),然後複製「Project number」(專案編號)。匯出工具設定時會用到。
方法 2:下載擷取驗證檔案 (舊版)
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「收集代理程式」。
- 下載擷取驗證檔案。
- 將檔案安全地儲存在要安裝 Bindplane 代理程式的系統中。
取得 Google SecOps 客戶 ID
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」 > 「設定檔」。
- 複製並儲存「機構詳細資料」專區中的「客戶 ID」。
安裝 Bindplane 代理程式
請按照下列操作說明,在 Windows 或 Linux 作業系統上安裝 Bindplane 代理程式。
Windows 安裝
- 以管理員身分開啟命令提示字元或 PowerShell。
執行下列指令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安裝完成。
執行下列指令,確認安裝成功:
sc query observiq-otel-collector服務應顯示為「RUNNING」。
安裝 Linux
- 開啟具有根層級或 sudo 權限的終端機。
執行下列指令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh等待安裝完成。
執行下列指令,確認安裝成功:
sudo systemctl status observiq-otel-collector服務應顯示為「active (running)」。
其他安裝資源
如需其他安裝選項和疑難排解資訊,請參閱 Bindplane 代理程式安裝指南。
設定 Bindplane 代理,擷取系統記錄檔並傳送至 Google SecOps
找出設定檔
Linux:
sudo nano /opt/observiq-otel-collector/config.yamlWindows:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
編輯設定檔
將
config.yaml的全部內容替換為下列設定:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/sophos_capsule8: 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 creds_file_path: '/opt/observiq-otel-collector/ingestion-auth.json' customer_id: 'your-customer-id' endpoint: chronicle.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是標準系統記錄通訊埠。
Exporter 設定:
creds_file_path:服務帳戶 JSON 金鑰檔案的完整路徑 (選項 1):- Linux:
/opt/observiq-otel-collector/ingestion-auth.json - Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Linux:
customer_id:Google SecOps 客戶 ID。location:將<LOCATION>替換為 Google SecOps 執行個體的區域 (例如us、europe或asia-southeast1)。匯出工具會在這個值前面加上chronicle.googleapis.com。如需完整清單,請參閱「區域性端點」。project:將<PROJECT_NUMBER>替換為「IAM 與管理」>「設定」中的專案編號。endpoint:維持設為chronicle.googleapis.com。
舊版擷取 API 匯出工具
如果您使用選項 2 的擷取驗證檔案,請將
exporters區塊替換為下列內容。將creds_file_path設為擷取驗證檔案的路徑。如果執行個體位於美國境外,請將malachiteingestion-pa.googleapis.com替換為區域端點 (例如europe-malachiteingestion-pa.googleapis.com)。exporters: chronicle/sophos_capsule8: compression: gzip creds_file_path: '/opt/observiq-otel-collector/ingestion-auth.json' customer_id: 'your-customer-id' endpoint: malachiteingestion-pa.googleapis.com log_type: SOPHOS_CAPSULE8 raw_log_field: body ingestion_labels:
儲存設定檔
編輯完畢後,請儲存檔案:
- Linux:依序按下
Ctrl+O、Enter和Ctrl+X - Windows:依序點選「檔案」>「儲存」
- Linux:依序按下
重新啟動 Bindplane 代理程式,套用變更
如要在 Linux 重新啟動 Bindplane 代理程式,請執行下列指令:
sudo systemctl restart observiq-otel-collector確認服務是否正在執行:
sudo systemctl status observiq-otel-collector查看記錄檔是否有錯誤:
sudo journalctl -u observiq-otel-collector -f
如要在 Windows 中重新啟動 Bindplane 代理程式,請選擇下列其中一個選項:
以管理員身分開啟命令提示字元或 PowerShell:
net stop observiq-otel-collector && net start observiq-otel-collector服務控制台:
- 按下
Win+R鍵,輸入services.msc,然後按下 Enter 鍵。 - 找出「observIQ OpenTelemetry Collector」。
- 按一下滑鼠右鍵,然後選取「重新啟動」。
確認服務是否正在執行:
sc query observiq-otel-collector檢查記錄是否有錯誤:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
- 按下
設定 Sophos Central API 憑證
- 登入 Sophos Central Admin。
- 依序前往「通用設定」>「API 憑證管理」。
- 按一下「Add Credential」。
- 輸入憑證名稱,並視需要填入說明,然後按一下「新增」。
複製「Client ID」和「Client Secret」,妥善儲存。
安裝及設定 Sophos Central SIEM 整合指令碼
安裝 Python
- 從 Python 網站下載並安裝 Python 3.7 以上版本。
- 在 Windows 上安裝時,請勾選「Add Python to PATH」(將 Python 新增至 PATH) 方塊。
執行下列指令,確認安裝成功:
python3 --version
下載 Sophos Central SIEM 整合指令碼
- 從 Sophos Central SIEM Integration GitHub 存放區下載最新版本。
- 將 ZIP 檔案解壓縮至要執行指令碼的電腦目錄。
設定 SIEM 整合指令碼
- 在解壓縮的目錄中,將
config.ini.sample複製到config.ini。 - 在文字編輯器中開啟
config.ini。 - 在
[login]區段下方,輸入 API 憑證:client_id:輸入 Sophos Central 的用戶端 ID。client_secret:輸入 Sophos Central 的用戶端密鑰。
- 設定輸出格式:
format:輸入json。
- 將輸出目的地設為 syslog:
filename:輸入「syslog」。
- 設定端點類型:
endpoint:輸入all,同時收集事件和快訊。
- 設定 syslog 屬性:
address:輸入 Bindplane 代理程式的 IP 位址和通訊埠 (例如192.168.1.100:514)。facility:輸入「daemon」。socktype:輸入udp。
儲存並關閉檔案。
執行 SIEM 整合指令碼
- 開啟終端機或命令提示字元,然後前往指令碼目錄。
執行指令碼:
python3 siem.py
自動執行 SIEM 整合指令碼
Windows (工作排程器)
- 從「開始」選單開啟「工作排程器」。
- 按一下「建立工作」。
- 在「General」分頁中:
- 「Name」(名稱):輸入
Sophos Capsule8 SIEM Export。
- 「Name」(名稱):輸入
- 在「Triggers」(觸發條件) 分頁中:
- 點選「New」(新增)。
- 將工作設為每 5 分鐘重複一次,持續時間為「無限期」。
- 在「動作」分頁中:
- 按一下「新增」,然後選取「啟動程式」。
- 在「Program/script」欄位中,輸入
python.exe的路徑。 - 在「Add arguments」(新增引數) 欄位中,輸入
siem.py的完整路徑。 - 在「Start in」(起始位置) 欄位中,輸入包含
siem.py的目錄。
- 按一下「確定」儲存工作。
Linux 或 macOS (cron)
開啟終端機並編輯 crontab:
crontab -e新增下列指令行,每 5 分鐘執行一次指令碼:
*/5 * * * * cd /path/to/Sophos-Central-SIEM-Integration && /usr/bin/python3 siem.py儲存並結束編輯器。
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 專家尋求解答。