收集 Apache Cassandra 記錄
本文說明如何使用 Bindplane,將 Apache Cassandra 記錄檔擷取至 Google Security Operations。剖析器會擷取欄位,並轉換為 Unified Data Model (UDM)。這個外掛程式會使用 grok 模式剖析初始訊息,然後使用 JSON 篩選器處理巢狀資料,並執行條件式轉換,將各種欄位對應至 UDM 對等項目、處理不同記錄層級,以及使用中繼資料擴充輸出內容。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體
- Windows 2016 以上版本或 Linux 主機 (含 systemd)
- 如果透過 Proxy 執行,防火牆通訊埠已開啟
- Apache Cassandra 執行個體的特殊存取權
取得 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: 'CASSANDRA' 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
在 Apache Cassandra 中設定 Syslog 匯出功能
- 使用 SSH 登入 Apache Cassandra 主機。
- 開啟設定檔 logback.xml,並在第 28 行插入下列程式碼:- 在大多數版本的 Apache Cassandra 中,位置會是 $(CASSANDRA_HOME)/conf。
- 如果是 Datastax Enterprise 的套件安裝作業,位置會是 /etc/dse。
- 如果是 DSE 的 Tar 檔案安裝,位置會是 $(TARBALL_ROOT)/resources/cassandra/conf。
 
- 在大多數版本的 Apache Cassandra 中,位置會是 
- 在第 28 行的 - logback.xml檔案中新增以下 Appender 定義:- <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> <syslogHost>bindplane-ip</syslogHost> <port>bindplane-port</port> <facility>LOCAL7</facility> <throwableExcluded>true</throwableExcluded> <suffixPattern>%thread:%level:%logger{36}:%msg</suffixPattern> </appender>
- 請將 - bindplane-ip和- bindplane-port替換為實際的 Bindplane 代理程式 IP 位址和連接埠。
- 在 - logback.xml檔案的根記錄器區塊- <root level=INFO- >中新增下列程式碼:- 插入這行的位置取決於 Apache Cassandra 版本: - Apache Cassandra 5.0.x,第 123 行。
- Apache Cassandra 4.0.x 和 4.1.x,第 115 行。
- Apache Cassandra 3.11.x 和 3.0.x,第 92 行。
- Datastax Enterprise (所有版本),第 121 行。
 - <appender-ref ref=`SYSLOG` />
 
UDM 對應表
| 記錄欄位 | UDM 對應 | 邏輯 | 
|---|---|---|
| agent.ephemeral_id | observer.labels.value | 內部 JSON 訊息中的 agent.ephemeral_id值。 | 
| agent.hostname | observer.hostname | 內部 JSON 訊息中的 agent.hostname值。 | 
| agent.id | observer.asset_id | filebeat:與內部 JSON 訊息中agent.id值的串連。 | 
| agent.name | observer.user.userid | 內部 JSON 訊息中的 agent.name值。 | 
| agent.type | observer.application | 內部 JSON 訊息中的 agent.type值。 | 
| agent.version | observer.platform_version | 內部 JSON 訊息中的 agent.version值。 | 
| cloud.availability_zone | principal.cloud.availability_zone | 內部 JSON 訊息中的 cloud.availability_zone值。 | 
| cloud.instance.id | principal.resource.product_object_id | 內部 JSON 訊息中的 cloud.instance.id值。 | 
| cloud.instance.name | principal.resource.name | 內部 JSON 訊息中的 cloud.instance.name值。 | 
| cloud.machine.type | principal.resource.attribute.labels.value | 內部 JSON 訊息的 cloud.machine.type值,其中對應的key為machine_type。 | 
| cloud.provider | principal.resource.attribute.labels.value | 內部 JSON 訊息的 cloud.provider值,其中對應的key為provider。 | 
| event_metadata._id | metadata.product_log_id | 內部 JSON 訊息中的 event_metadata._id值。 | 
| event_metadata.version | metadata.product_version | 內部 JSON 訊息中的 event_metadata.version值。 | 
| host.architecture | target.asset.hardware.cpu_platform | 內部 JSON 訊息中的 host.architecture值。 | 
| host.fqdn | target.administrative_domain | 內部 JSON 訊息中的 host.fqdn值。 | 
| host.hostname | target.hostname | 內部 JSON 訊息中的 host.hostname值。 | 
| host.id | target.asset.asset_id | Host Id:與內部 JSON 訊息中host.id值的串連。 | 
| host.ip | target.asset.ip | 內部 JSON 訊息中 host.ip的 IP 位址陣列。 | 
| host.mac | target.mac | 來自內部 JSON 訊息的 host.macMAC 位址陣列。 | 
| host.os.kernel | target.platform_patch_level | 內部 JSON 訊息中的 host.os.kernel值。 | 
| host.os.platform | target.platform | 如果 host.os.platform為debian,請設為LINUX。 | 
| host.os.version | target.platform_version | 內部 JSON 訊息中的 host.os.version值。 | 
| hostname | principal.hostname | 使用 grok 從 message欄位擷取的hostname值。 | 
| key | security_result.detection_fields.value | 使用 grok 從 message欄位擷取的key值,其中對應的key為key。 | 
| log.file.path | principal.process.file.full_path | 內部 JSON 訊息中的 log.file.path值。 | 
| log_level | security_result.severity | 根據 log_level的值對應:DEBUG、INFO、AUDIT對應至INFORMATIONAL;ERROR對應至ERROR;WARNING對應至MEDIUM。 | 
| log_level | security_result.severity_details | 使用 grok 從 message欄位擷取的log_level值。 | 
| log_type | metadata.log_type | 原始記錄中的 log_type值。 | 
| message | security_result.description | 使用 grok 從 message欄位擷取的說明。 | 
| message | target.process.command_line | 使用 grok 從 message欄位擷取的指令列。 | 
| now | security_result.detection_fields.value | 使用 grok 從 message欄位擷取的now值,其中對應的key為now。使用 grok 從message欄位擷取event_time欄位,並從中剖析。如果同時存在hostname和host.hostname,請設為USER_RESOURCE_ACCESS,否則請設為GENERIC_EVENT。請設為CASSANDRA。請設為CASSANDRA。請設為ephemeral_id。如果cloud.instance.name存在,請設為VIRTUAL_MACHINE。將對應的偵測欄位設為key和now。 | 
| timestamp | timestamp | 來自原始記錄的 create_time欄位。 | 
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。