收集 Zeek (舊稱 Bro) TSV 記錄
本文說明如何使用 Bindplane 代理程式,將 Zeek (舊稱 Bro) TSV 記錄檔擷取至 Google Security Operations。
Zeek (舊稱 Bro) 是網路安全監控平台,可被動分析網路流量,並產生詳細的 Tab 分隔記錄檔,涵蓋連線、DNS 查詢、HTTP 交易、SSL/TLS 工作階段和檔案分析。Zeek 感應器預設會在 /opt/zeek/logs/ 或 /usr/local/zeek/logs/ 下產生 TSV 記錄檔。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體
- Windows Server 2016 以上版本,或搭載
systemd的 Linux 主機 - Bindplane 代理程式與 Zeek 感應器主機之間的網路連線
- 如果透過 Proxy 執行,請確保防火牆通訊埠已根據 Bindplane 代理程式需求開啟
- 具備 Zeek 感應器主機的特殊權限,可讀取記錄檔
- 存取感應器檔案系統上的 Zeek TSV 記錄檔 (通常位於
/opt/zeek/logs/或/usr/local/zeek/logs/下方)
取得 Google SecOps 擷取驗證檔案
- 登入 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服務應顯示為有效 (執行中)。
其他安裝資源
如需其他安裝選項和疑難排解資訊,請參閱 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/bro_tsv: compression: gzip creds_file_path: '/etc/bindplane-agent/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: BRO_TSV raw_log_field: body ingestion_labels: env: production service: pipelines: logs/bro_to_chronicle: receivers: - udplog exporters: - chronicle/bro_tsv
設定參數
替換下列預留位置:
接收器設定:
udplog:根據通訊協定的接收器類型:udplog(適用於 UDP 系統記錄檔)tcplog適用於 TCP Syslog
0.0.0.0:要接聽的 IP 位址:0.0.0.0,監聽所有介面 (建議)- 在一個介面上接聽的特定 IP 位址
514:要接聽的通訊埠號碼 (例如514、1514、6514)
匯出工具設定:
bro_tsv:匯出工具的說明名稱creds_file_path:擷取驗證檔案的完整路徑:- Linux:
/etc/bindplane-agent/ingestion-auth.json - Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Linux:
<customer_id>:上一步中的客戶 IDendpoint:區域端點網址:- 美國:
malachiteingestion-pa.googleapis.com - 歐洲:
europe-malachiteingestion-pa.googleapis.com - 亞洲:
asia-southeast1-malachiteingestion-pa.googleapis.com - 如需完整清單,請參閱「區域端點」
- 美國:
BRO_TSV:記錄類型,與 Chronicle 中顯示的完全相同ingestion_labels:YAML 格式的選用標籤 (例如env: production)
管道設定:
bro_to_chronicle:管道的說明名稱
儲存設定檔
- 編輯完成後,請儲存檔案:
- 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"
- 按下
設定 Zeek 系統記錄檔轉送
Zeek 會在本機產生 TSV 記錄檔。如要使用系統記錄檔將這些記錄檔轉送至 Bindplane 代理程式,請在 Zeek 感應器主機上設定系統記錄檔精靈。
- 使用 root 或 sudo 權限登入 Zeek 感應器主機。
- 如果沒有
rsyslog或syslog-ng,請安裝並設定。 建立 rsyslog 設定檔,轉送 Zeek 記錄:
sudo nano /etc/rsyslog.d/zeek-forward.conf新增下列設定,將 Zeek 記錄轉送至 Bindplane 代理程式:
module(load="imfile") input(type="imfile" File="/opt/zeek/logs/current/*.log" Tag="zeek:" Severity="info" Facility="local6") local6.* @<BINDPLANE_AGENT_IP>:514- 將
<BINDPLANE_AGENT_IP>替換為 Bindplane 代理程式主機的 IP 位址。 - 如果路徑不同,請將
/opt/zeek/logs/current/*.log換成 Zeek 記錄檔的實際路徑。 - 請使用
@@,而非@進行 TCP 轉送 (必須與 Bindplane 代理程式接收器類型相符)。
- 將
重新啟動 rsyslog,以套用變更:
sudo systemctl restart rsyslog查看 Bindplane 代理程式記錄,確認是否收到系統記錄訊息。
UDM 對應表
| 記錄欄位 | UDM 對應 | 邏輯 |
|---|---|---|
| rtt、operation、tunnel_type、action、cmd、arg、rows | additional.fields | 從 additional_rtt、additional_op、additional_tt、additional_action、additional_cmd、additional_arg、additional_rows 合併 |
| extensions.auth.type | 設為「AUTHTYPE_UNSPECIFIED」 | |
| conn_state、action、error、desc | metadata.description | 針對 bro_conn 設為 conn_state 說明,針對 bro_smb_files 設為動作,針對 bro_kerberos 設為「KERBEROS: %{error}」,針對 AsymPayloadFlow 設為 desc,針對其他項目設為常數 |
| bro_type、qerror、next_protocol、protocol | metadata.event_type | 預設為 GENERIC_EVENT,dns 為 NETWORK_DNS,conn/ntlm/smb_mapping/dce_rpc/tunnel/mysql/ssh/udp/tcp 為 NETWORK_CONNECTION,dhcp 為 NETWORK_DHCP,如果 next_protocol 為 http,則 http/ssl 為 NETWORK_HTTP,smb_files/files/x509 為 NETWORK_UNCATEGORIZED,radius 為 USER_LOGIN,ftp 為 NETWORK_FTP,如果 qerror query_not_present,則為 NETWORK_UNCATEGORIZED |
| bro_type、prod_event | metadata.product_event_type | 如果 bro_type 不為空白,則取自該值,否則取自 prod_event |
| uid、id | metadata.product_log_id | 如果 uid 可用,則為 uid 的值,否則為 id 的值 |
| metadata.product_name | 設為「Bro」 | |
| metadata.vendor_name | 設為「Zeek」 | |
| service_proto、source | network.application_protocol | 從 conn 的 service_proto 對應,從檔案的來源對應,其他則為常數 |
| 主機名稱 | network.dhcp.client_hostname | 直接複製值 |
| lease_time | network.dhcp.lease_time_seconds | 已轉換為 uinteger |
| dhcp_info | network.dhcp.type | 如果 =~「ACK」,則設為「ACK」;如果 =~「RELEASE」,則設為「RELEASE」;如果 =~「INFORM」,則設為「INFORM」;如果 =~「DISCOVER」,則設為「DISCOVER」;如果 =~「OFFER」,則設為「OFFER」;如果 =~「REQUEST」,則設為「REQUEST」 |
| assigned_ip | network.dhcp.yiaddr | 直接複製值 |
| 方向 | network.direction | 直接複製值 |
| answer_list | network.dns.answers | 直接複製值 |
| trans_id | network.dns.id | 已轉換為 uinteger |
| q | network.dns.questions | 從 q 合併 |
| rcode | network.dns.response_code | 如果不是「-」,則轉換為 uinteger |
| 指令 | network.ftp.command | 直接複製值 |
| 方法 | network.http.method | 直接複製值 |
| 參照網址 | network.http.referral_url | 直接複製值 |
| status_code | network.http.response_code | 已轉換為整數 |
| user_agent | network.http.user_agent | 直接複製值 |
| proto、protocol | network.ip_protocol | 連線的 Proto 值,UDP 為「UDP」,TCP 為「TCP」 |
| id_resp_bytes、received_bytes | network.received_bytes | 已將 conn 的 id_resp_bytes 和檔案的 received_bytes 轉換為 uinteger |
| id_orig_bytes | network.sent_bytes | 已轉換為 uinteger |
| uid | network.session_id | 直接複製值 |
| 加密 | network.tls.cipher | 直接複製值 |
| client_issuer | network.tls.client.certificate.issuer | 直接複製值 |
| client_subject | network.tls.client.certificate.subject | 直接複製值 |
| 用戶端 | network.tls.client.certificate.version | 直接複製值 |
| ja3 | network.tls.client.ja3 | 直接複製值 |
| 曲線 | network.tls.curve | 直接複製值 |
| 已建立 | network.tls.established | 直接複製值 |
| next_protocol | network.tls.next_protocol | 直接複製值 |
| 已恢復 | network.tls.resumed | 直接複製值 |
| issuer、certificate.issuer | network.tls.server.certificate.issuer | 發行者提供的值 (適用於 SSL),或憑證的發行者 (適用於 X.509) |
| certificate.not_valid_after | network.tls.server.certificate.not_after | 使用日期篩選器轉換 |
| certificate.not_valid_before | network.tls.server.certificate.not_before | 使用日期篩選器轉換 |
| certificate.serial | network.tls.server.certificate.serial | 直接複製值 |
| subject、certificate.subject | network.tls.server.certificate.subject | SSL 的主體值,X.509 的 certificate.subject |
| certificate.version | network.tls.server.certificate.version | 已轉換為字串 |
| ja3s | network.tls.server.ja3s | 直接複製值 |
| 版本 | network.tls.version | 直接複製值 |
| 網域 | principal.administrative_domain | 直接複製值 |
| file_size | principal.file.size | 已轉換為 uinteger |
| client_host、_system_name、_HostName | principal.hostname | Kerberos 的 client_host 值、X.509 的 _system_name 值,以及擷取出的 _HostName |
| id.orig_h | principal.ip | 從 id.orig_h 合併 |
| mac | principal.mac | 直接複製值 |
| id.orig_p | principal.port | 轉換為整數,值來自 id.orig_p 或針對 conn 反向,如果不是 local_orig |
| user_email | principal.user.email_addresses | 從 user_email 合併 |
| user、username、user_name | principal.user.userid | 使用者值 (適用於 FTP)、半徑使用者名稱、Kerberos 使用者名稱 |
| qclass | q.class | 已轉換為 uinteger |
| qname、q.name | q.name | qname 或 q.name 的值 |
| qtype | q.type | 已轉換為 uinteger |
| result、auth_success | security_result | 從 security_result 合併,其中 radius 失敗的動作為 BLOCK,ssh 的動作為 ALLOW/BLOCK/UNKNOWN |
| uri | target.administrative_domain | 使用 grok 從 URI 擷取 |
| full_file_path、fuid | target.file.full_path | smb_files 的 full_file_path 值,檔案的 fuid |
| md5 | target.file.md5 | 直接複製值 |
| mime_type | target.file.mime_type | 直接複製值 |
| sha1 | target.file.sha1 | 直接複製值 |
| size、file_size | target.file.size | 已將 smb_files 的大小轉換為 uinteger,檔案的大小則轉換為 file_size |
| server_host、host、CN、server | target.hostname | Kerberos 的 server_host 值、HTTP 的主機、X.509 的 CN、SSH 的伺服器 |
| id.resp_h | target.ip | 從 id.resp_h 合併 |
| host_key、host_key_alg、kex_alg、mac_alg、compression_alg、cipher_alg、auth_attempts | target.labels | 從各種標籤物件合併 |
| id.resp_p | target.port | 轉換為整數,值來自 id.resp_p,如果不是 local_orig,則為 conn 的反向值 |
| path、named_pipe | target.resource.name | smb_mapping 的路徑值,dce_rpc 的 named_pipe |
| share_type | target.resource.type | smb_mapping 的 share_type 值,dce_rpc 的「PIPE」 |
| 網址 | target.url | 由主機和 URI 串連而成 |
變更記錄
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。