收集 Sophos Central 記錄
本文說明如何使用 Bindplane 收集 Sophos Central 記錄。剖析器會將 JSON 記錄轉換為統一資料模型 (UDM)。這項服務會從巢狀 JSON 結構中擷取欄位,將這些欄位對應至 UDM 欄位,並根據 type 欄位執行事件分類,然後為不同 Sophos Central 事件類型提供特定詳細資料和動作,進而擴充資料。
事前準備
- 確認您有 Google Security Operations 執行個體。
- 確認您使用的是 Windows 2016 以上版本,或是搭載
systemd
的 Linux 主機。 - 請確認您有額外的 Windows 或 Linux 裝置,能夠持續執行 Python。
- 如果透過 Proxy 執行,請確認防火牆通訊埠已開啟。
- 確認您具備 Sophos XG Firewall 的特殊權限。
取得 Google SecOps 擷取驗證檔案
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「收集代理程式」。
- 下載擷取驗證檔案。將檔案安全地儲存在要安裝 Bindplane 的系統上。
取得 Google SecOps 客戶 ID
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「設定檔」。
- 複製並儲存「機構詳細資料」專區中的客戶 ID。
安裝 Bindplane 代理程式
Windows 安裝
- 以系統管理員身分開啟「命令提示字元」或「PowerShell」。
執行下列指令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
Linux 安裝
- 開啟具有根層級或 sudo 權限的終端機。
執行下列指令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
其他安裝資源
- 如需其他安裝選項,請參閱這份安裝指南。
設定 Bindplane 代理程式,擷取系統記錄檔並傳送至 Google SecOps
存取設定檔:
- 找出
config.yaml
檔案。通常位於 Linux 的/etc/bindplane-agent/
目錄,或 Windows 的安裝目錄。 - 使用文字編輯器 (例如
nano
、vi
或記事本) 開啟檔案。
- 找出
按照下列方式編輯
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: '/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 ingestion_labels: log_type: SYSLOG namespace: sophos_central raw_log_field: body 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 存取權
- 登入 Sophos Central Admin。
- 依序選取「通用設定」>「API 權杖管理」。
- 按一下「新增權杖」即可建立新權杖。
- 輸入權杖名稱,然後按一下「儲存」。系統會顯示所提供權杖的「API 權杖摘要」。
- 在「API Token Summary」部分中,按一下「Copy」即可複製 API 存取網址和標頭。
在其他機器上安裝 Python
- 開啟網路瀏覽器,然後前往 Python 網站。
- 點選作業系統 (Windows 或 Mac) 適用的「下載 Python」。
安裝 Python。
- Windows:
- 執行安裝程式。
- 勾選「Add Python to PATH」方塊。
- 按一下「立即安裝」。
在 Mac 上:
- Python 可能已安裝,如果沒有,您可以使用終端機安裝最新版本。
開啟「終端機」並輸入下列指令:
python --version
- Windows:
下載 Sophos 整合指令碼
- 前往 Sophos Central SIEM Integration GitHub 存放區的 GitHub 頁面。
- 按一下綠色的「Code」按鈕 >「Download ZIP」。
- 解壓縮 ZIP 檔案。
設定指令碼
- 尋找並開啟
config.ini
檔案 (使用文字編輯器)。 - 編輯設定檔:
- API 權杖:輸入先前從 Sophos Central 複製的 API 金鑰。
- 系統記錄檔伺服器詳細資料:輸入系統記錄檔伺服器的詳細資料。
- 主機:輸入 Bindplane IP 位址。
- 「Port」(通訊埠):輸入 Bindplane 通訊埠編號。
- 通訊協定:輸入 UDP (視設定而定,您也可以使用 TCP 或 TLS)。
- 儲存檔案。
執行指令碼
前往指令碼資料夾。
使用 Windows 電腦:
- 按下 Windows 鍵,然後輸入
cmd
。 - 按一下「命令提示字元」。
前往指令碼資料夾:
cd C:\Users\YourName\Downloads\Sophos-Central-SIEM-Integration
- 按下 Windows 鍵,然後輸入
在 macOS 上執行下列操作:
- 依序前往「應用程式」>「工具程式」。
- 開啟 [Terminal]。
前往指令碼資料夾:
cd /Users/YourName/Downloads/Sophos-Central-SIEM-Integration
執行指令碼:
輸入下列指令來啟動指令碼:
python siem.py
在 Windows 上自動執行指令碼 (使用工作排程器):
- 在「開始」選單中輸入「工作排程器」,開啟工作排程器。
- 按一下「建立工作」。
- 在「一般」分頁中:
- 為工作命名,例如
Sophos Central Log Export
。
- 為工作命名,例如
- 在「觸發程序」分頁中:
- 按一下「新增」,然後視偏好設定將工作設為「每日」或「啟動時」執行。
- 在「動作」分頁中:
- 按一下「新增」,然後選取「開始計畫」。
- 瀏覽
python.exe
可執行檔 (通常位於C:\PythonXX\python.exe
)。 - 在「Add arguments」(新增引數) 欄位中,輸入腳本路徑,例如
C:\Users\YourName\Downloads\Sophos-Central-SIEM-Integration\siem.py
。
- 按一下「確定」儲存工作。
自動執行指令碼,在 Mac 上持續運作 (使用 Cron Jobs):
- 開啟終端機。
- 輸入
crontab -e
,然後按下 Enter 鍵。 在檔案結尾處加上新的一行:
* * * * * /usr/bin/python /Users/YourName/Downloads/Sophos-Central-SIEM-Integration/siem.py
儲存並結束編輯器。
UDM 對應表
記錄欄位 | UDM 對應 | 邏輯 |
---|---|---|
customer_id | target.resource.id | 直接從「customer_id 」欄位對應。 |
data.core_remedy_items.items.0.descriptor | target.process.file.full_path | 直接從「data.core_remedy_items.items.0.descriptor 」欄位對應。 |
data.source_info.ip | principal.ip principal.asset.ip |
直接從「data.source_info.ip 」欄位對應。 |
說明 | metadata.description | 直接從 description 欄位對應,前提是 metadata.event_type 為 GENERIC_EVENT 。 |
dhost | principal.hostname principal.asset.hostname |
直接從「dhost 」欄位對應。 |
duid | security_result.detection_fields.value | 直接從「duid 」欄位對應。 |
結束 | metadata.event_timestamp | 剖析為 RFC 3339 格式,並對應至 event_timestamp 欄位。 |
端點 ID | target.asset_id | 已對應為 Device endpoint Id: {endpoint_id} 。 |
endpoint_type | security_result.about.labels.value | 直接從「endpoint_type 」欄位對應。 |
群組 | security_result.category_details | 直接從「group 」欄位對應。 |
名稱 | security_result.description security_result.summary |
直接從「name 」欄位對應。 |
metadata.event_type | 根據 type 欄位和剖析器中的其他邏輯判斷。可能的值包括:FILE_OPEN、SCAN_HOST、SETTING_MODIFICATION、STATUS_HEARTBEAT、SETTING_CREATION、NETWORK_CONNECTION、SCAN_PROCESS、SCAN_UNCATEGORIZED、USER_CREATION、USER_UNCATEGORIZED、STATUS_UPDATE。 |
|
metadata.log_type | 設為 SOPHOS_CENTRAL 。 |
|
metadata.product_event_type | 直接從「type 」欄位對應。 |
|
metadata.product_name | 設為 Sophos Central 。 |
|
metadata.vendor_name | 設為 Sophos 。 |
|
network.direction | 設為 OUTBOUND ,表示特定 type 值指出出站網路連線。 |
|
network.ip_protocol | 針對表示 TCP 網路連線的特定 type 值,設為 TCP 。 |
|
security_result.action | 根據使用 grok 模式從 name 欄位擷取的 action 欄位判斷。可能的值包括:ALLOW、BLOCK、ALLOW_WITH_MODIFICATION、UNKNOWN_ACTION。 |
|
security_result.detection_fields.key | 如果存在 duid 欄位,請設為 duid 。 |
|
security_result.rule_name | 使用特定 type 值的 grok 模式,從 name 欄位擷取。 |
|
security_result.severity | 從 severity 欄位對應,對應方式如下:low -> LOW、medium -> MEDIUM、high/critical -> HIGH。 |
|
target.application | 使用特定 type 值的 grok 模式,從 name 欄位擷取。 |
|
target.asset.hostname | 從特定 type 值的 dhost 欄位對應。 |
|
target.file.full_path | 使用特定 type 值的 grok 模式從 name 欄位擷取,或直接從 data.core_remedy_items.items.0.descriptor 或 core_remedy_items.items.0.descriptor 對應。 |
|
target.file.size | 使用 grok 模式從 name 欄位擷取,並轉換為特定 type 值的 uinteger 。 |
|
target.hostname | 從特定 type 值的 dhost 欄位對應。 |
|
target.resource.name | 根據 type 欄位設為特定值,或使用 grok 模式從 name 欄位擷取值。 |
|
target.resource.type | 根據 type 欄位設為特定值。 |
|
target.user.userid | 使用 grok 模式擷取使用者名稱後,從 suser 欄位對應。 |
|
target.url | 使用特定 type 值的 grok 模式,從 name 欄位擷取。 |
|
source_info.ip | principal.ip principal.asset.ip |
直接從「source_info.ip 」欄位對應。 |
suser | principal.user.userid target.user.userid |
使用 grok 模式從 suser 欄位擷取,並移除主機名稱前置字元。 |
類型 | metadata.product_event_type | 直接從「type 」欄位對應。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。