收集 HashiCorp Vault 稽核記錄

支援:

本文說明如何使用 Bindplane,將 HashiCorp Vault 稽核記錄擷取至 Google Security Operations。

HashiCorp Vault 是 Secret Manager 和資料保護平台,提供安全儲存、動態 Secret 生成、資料加密和以身分為基礎的存取控管功能。Vault 會產生稽核記錄,記錄所有對 Vault 的要求和回應,包括驗證、密鑰存取和政策變更。這些稽核記錄可透過 syslog 轉送至 SIEM,用於安全監控和法規遵循。

事前準備

請確認您符合下列必要條件:

  • Google SecOps 執行個體。
  • Windows Server 2016 以上版本,或搭載 systemd 的 Linux 主機。
  • Bindplane 代理程式與 HashiCorp Vault 伺服器之間的網路連線。
  • 如果是在 Proxy 後方執行,請確認防火牆通訊埠已按照 Bindplane 代理程式需求開啟。
  • HashiCorp Vault 伺服器的特殊權限存取權 (根權杖或足夠的政策權限,可啟用稽核裝置)。

取得 Bindplane 代理程式的 Google SecOps 憑證

如要向 Google SecOps 驗證 Bindplane 代理程式,請選擇下列其中一種方法:

  • 新部署作業:使用 Chronicle API (選項 1)。
  • 舊版部署作業:在 2027 年 7 月 20 日停用 Ingestion API 前,請繼續使用擷取驗證檔案 (選項 2)。
  1. 登入 Google Cloud 控制台,選取連結至 Google SecOps 執行個體的 Google Cloud 專案。
  2. 依序前往「IAM & Admin」(IAM 與管理) >「Service Accounts」(服務帳戶)。
  3. 按一下「建立服務帳戶」。
  4. 請提供下列設定詳細資料:
    • 「Service account name」(服務帳戶名稱):輸入帳戶名稱 (例如 bindplane-ingest)。
    • 服務帳戶說明:輸入說明 (例如 Bindplane agent log ingestion)。
  5. 點按「Create and continue」(建立並繼續)。
  6. 在「將專案存取權授予這個服務帳戶」部分,按一下「選取角色」,然後選取「Chronicle 編輯者」。
  7. 依序點選「繼續」和「完成」。
  8. 按一下您建立的服務帳戶,然後前往「金鑰」分頁。
  9. 依序點選「新增金鑰」>「建立新的金鑰」。
  10. 選取「JSON」,然後點選「建立」。金鑰檔案會下載到電腦。
  11. 將金鑰檔案儲存為 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,使其與儲存路徑相符。
  12. 依序前往「IAM 與管理」>「設定」,然後複製「專案編號」。匯出工具設定時會用到。

方法 2:下載擷取驗證檔案 (舊版)

  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](https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi)" /quiet
    
  3. 等待安裝完成。

  4. 執行下列指令,確認安裝成功:

    sc query observiq-otel-collector
    

服務應顯示為「RUNNING」。

Linux 安裝

  1. 開啟具有 root 或 sudo 權限的終端機。
  2. 執行下列指令:

    sudo sh -c "$(curl -fsSlL [https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh](https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh))" install_unix.sh
    
  3. 等待安裝完成。

  4. 執行下列指令,確認安裝成功:

    sudo systemctl status observiq-otel-collector
    

服務應顯示為「active (running)」。

其他安裝資源

如需其他安裝選項和疑難排解資訊,請參閱 Bindplane 代理程式安裝指南。

設定 Bindplane 代理,擷取系統記錄檔並傳送至 Google SecOps

找出設定檔

  • Linux:

    sudo nano /opt/observiq-otel-collector/config.yaml
    
  • Windows:

    notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
    

編輯設定檔

  • 將 config.yaml 的全部內容替換為下列設定:

    receivers:
      tcplog:
        listen_address: "0.0.0.0:1514"
    
    exporters:
      chronicle/vault:
        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-here'
        endpoint: chronicle.googleapis.com
        log_type: HASHICORP
        raw_log_field: body
        ingestion_labels:
          env: production
    
    service:
      pipelines:
        logs/vault_to_chronicle:
          receivers:
            - tcplog
          exporters:
            - chronicle/vault
    

設定參數

替換下列預留位置:

  • 接收器設定:

    • listen_address:要監聽的 IP 位址和通訊埠。使用 0.0.0.0 監聽所有介面。建議使用連接埠 1514,避免在 Linux 上需要 Root 權限。
  • 匯出工具設定:

    • creds_file_path:服務帳戶 JSON 金鑰檔案的完整路徑 (選項 1):
      • Linux:/opt/observiq-otel-collector/ingestion-auth.json
      • Windows:C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
    • customer_id:您的 Google SecOps 客戶 ID。
    • location:將 <LOCATION> 替換為 Google SecOps 執行個體的區域 (例如 us、europe 或 asia-southeast1)。匯出工具會在這個值前面加上 chronicle.googleapis.com。如需完整清單,請參閱「區域性端點」。
    • project:將 <PROJECT_NUMBER> 替換為「IAM 與管理」>「設定」中的專案編號。
    • endpoint:維持設為 chronicle.googleapis.com。
    • ingestion_labels:YAML 格式的選用標籤 (例如 env: production)。

舊版擷取 API 匯出工具

  • 如果您使用選項 2 的擷取驗證檔案,請將 exporters 區塊替換為下列內容。將 creds_file_path 設為擷取驗證檔案的路徑,如果您的執行個體位於美國境外,請將 malachiteingestion-pa.googleapis.com 替換為區域端點 (例如 europe-malachiteingestion-pa.googleapis.com)。

    exporters:
      chronicle/vault:
        compression: gzip
        creds_file_path: '/opt/observiq-otel-collector/ingestion-auth.json'
        customer_id: 'your-customer-id-here'
        endpoint: malachiteingestion-pa.googleapis.com
        log_type: HASHICORP
        raw_log_field: body
        ingestion_labels:
          env: production
    

儲存設定檔

編輯完畢後,請儲存檔案:

  • Linux:依序按下 Ctrl+O、Enter 和 Ctrl+X
  • Windows:依序點選「檔案」>「儲存」

重新啟動 Bindplane 代理程式,套用變更

如要在 Linux 中重新啟動 Bindplane 代理程式,請按照下列步驟操作:

  1. 執行下列指令:

    sudo systemctl restart observiq-otel-collector
    
  2. 確認服務正在執行:

    sudo systemctl status observiq-otel-collector
    
  3. 查看記錄檔是否有錯誤:

    sudo journalctl -u observiq-otel-collector -f
    

如要在 Windows 重新啟動 Bindplane 代理程式,請按照下列步驟操作:

  1. 您可以選擇下列其中一個選項:

    • 以管理員身分開啟命令提示字元或 PowerShell:
    net stop observiq-otel-collector && net start observiq-otel-collector
    
    • 服務控制台:
      1. 按下 Win+R 鍵,輸入 services.msc,然後按下 Enter 鍵。
      2. 找出「observIQ OpenTelemetry Collector」。
      3. 按一下滑鼠右鍵,然後選取「重新啟動」。
  2. 確認服務正在執行:

    sc query observiq-otel-collector
    
  3. 查看記錄檔是否有錯誤:

    type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
    

透過系統記錄檔設定 HashiCorp Vault 稽核記錄轉送功能

Vault 稽核裝置會記錄所有要求和回應。您可以啟用 syslog 稽核裝置,將稽核記錄轉送至 Bindplane 代理程式。

啟用 syslog 稽核裝置

  1. 開啟終端機,並確認可存取 Vault CLI 和有效的 Vault 權杖。
  2. 執行下列指令,啟用系統記錄稽核裝置:

    vault audit enable syslog tag="vault" facility="AUTH"
    
  3. 確認稽核裝置已啟用:

    vault audit list
    

輸出內容應顯示系統記錄稽核裝置為「已啟用」。

設定將系統記錄檔轉送至 Bindplane 代理

啟用 Vault syslog 稽核裝置後,請設定系統 syslog 精靈 (rsyslog 或 syslog-ng),將 Vault 稽核記錄轉送至 Bindplane 代理程式。

選項 - rsyslog 設定

  1. 建立新的 rsyslog 設定檔:

    sudo nano /etc/rsyslog.d/50-vault-forward.conf
    
  2. 新增下列設定:

    # Forward Vault audit logs to Bindplane agent
    if $programname == 'vault' then @@BINDPLANE_IP:1514
    

    將 BINDPLANE_IP 替換為 Bindplane 代理程式主機的 IP 位址。

  3. 重新啟動 rsyslog:

    sudo systemctl restart rsyslog
    

選項:syslog-ng 設定

  1. 編輯 syslog-ng 設定檔:

    sudo nano /etc/syslog-ng/conf.d/vault-forward.conf
    
  2. 新增下列設定:

    destination d_bindplane {
        network("BINDPLANE_IP" port(1514) transport("tcp"));
    };
    
    filter f_vault {
        program("vault");
    };
    
    log {
        source(s_src);
        filter(f_vault);
        destination(d_bindplane);
    };
    

    將 BINDPLANE_IP 替換為 Bindplane 代理程式主機的 IP 位址。

  3. 重新啟動 syslog-ng:

    sudo systemctl restart syslog-ng
    

替代方案:使用記錄轉送工具進行檔案式稽核

如果不想使用系統記錄稽核,可以啟用檔案稽核裝置並轉送檔案內容:

  1. 啟用檔案稽核裝置:

    vault audit enable file file_path=/var/log/vault/audit.log
    
  2. 設定 rsyslog 來監控及轉送檔案:

    sudo nano /etc/rsyslog.d/50-vault-file-forward.conf
    
    module(load="imfile")
    input(type="imfile"
        File="/var/log/vault/audit.log"
        Tag="vault-audit"
        Severity="info"
        Facility="auth")
    
    if $syslogtag == 'vault-audit' then @@BINDPLANE_IP:1514
    

    將 BINDPLANE_IP 替換為 Bindplane 代理程式主機的 IP 位址。

  3. 重新啟動 rsyslog:

    sudo systemctl restart rsyslog
    

驗證記錄轉送

  1. 執行 Vault 作業 (例如登入或讀取密鑰):

    vault login token=<YOUR_TOKEN>
    
  2. 檢查 Bindplane 代理記錄,確認系統已收到記錄。

詳情請參閱 HashiCorp Vault 稽核裝置說明文件。

UDM 對應表

記錄欄位 UDM 對應 邏輯
auth.client_token network.session_id 值取自 auth.client_token (經雜湊處理)。
auth.display_name principal.user.user_display_name 值取自 auth.display_name。
auth.metadata.role_name principal.user.attribute.roles.name 值取自 auth.metadata.role_name。
auth.policies principal.user.attribute.permissions.name 值取自 auth.policies 陣列。
auth.token_type additional.fields 從 auth.token_type 擷取值,並新增鍵 token_type。
request.id metadata.product_log_id 值取自 request.id。
request.operation metadata.product_event_type 值取自 request.operation。
request.path target.resource.name 值取自 request.path。
request.remote_address principal.ip 值取自 request.remote_address。
request.namespace.id target.namespace 值取自 request.namespace.id。
response.auth.client_token network.session_id 值取自回應 client_token (經雜湊處理)。
type metadata.product_event_type 附加至作業 (例如 request 或 response)。
time metadata.event_timestamp 剖析為 RFC 3339 時間戳記。
error security_result.description 如果 error 存在,則從中擷取值。
metadata.vendor_name 設為「HashiCorp」HashiCorp。
metadata.product_name 設為「Vault」。
metadata.event_type 如果是密鑰作業,請設為 USER_RESOURCE_ACCESS;如果是驗證作業,請設為 USER_LOGIN;否則請設為 GENERIC_EVENT。
response.auth.metadata.username event.idm.read_only_udm.target.user.userid 從變更記錄對應
appname event.idm.read_only_udm.target.application 從變更記錄對應
priority event.idm.read_only_udm.security_result.priority_details 從變更記錄對應
proc_id event.idm.read_only_udm.observer.process.pid 從變更記錄對應
auth.policies event.idm.read_only_udm.additional.fields 從變更記錄對應
auth.token_policies event.idm.read_only_udm.additional.fields 從變更記錄對應
request.policy_override event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.admin_password event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.admin_token event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.admin_user event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.certificate event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.check_url event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.keystore event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.keystore_password event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
response.data.private_key event.idm.read_only_udm.target.resource.attribute.labels 從變更記錄對應
type event.idm.read_only_udm.additional.fields 從變更記錄對應
auth.identity_policies event.idm.read_only_udm.additional.fields 從變更記錄對應
request.data event.idm.read_only_udm.additional.fields 從變更記錄對應
facility event.idm.read_only_udm.additional.fields 從變更記錄對應
task event.idm.read_only_udm.additional.fields 從變更記錄對應
jsonPayload.auth.policy_results.granting_policies.type", "jsonPayload.auth.policy_results.granting_policies.name", and "jsonPayload.auth.policy_results.granting_policies.namespace_id additional.fields 從變更記錄對應
jsonPayload.request.namespace.id target.namespace 從變更記錄對應
jsonPayload.cos.googleapis.com/container_id", "jsonPayload.cos.googleapis.com/container_name", "jsonPayload.cos.googleapis.com/stream additional.fields 從變更記錄對應
resource.labels.instance_id principal.resource.product_object_id 從變更記錄對應
principal.resource.attribute.cloud.availability_zone resource.labels.zone 從變更記錄對應
logName security_result.category_details 從變更記錄對應
resource.labels.namespace_name target.namespace 從變更記錄對應
resource.labels.pod_name", "resource.labels.container_name additional.fields 從變更記錄對應
resource.labels.project_id target.cloud.project.name 從變更記錄對應
resource.labels.location target.location.name 從變更記錄對應
insertId metadata.product_log_id 從變更記錄對應
labels.k8s-pod/app_kubernetes_io/instance", "labels.k8s-pod/app_kubernetes_io/name", "labels.k8s-pod/component", "labels.k8s-pod/helm_sh/chart", "labels.k8s-pod/controller-revision-hash", "labels.k8s-pod/vault-initialized", "labels.k8s-pod/vault-version", "labels.k8s-pod/vault-sealed", "labels.k8s-pod/vault-perf-standby", and "labels.k8s-pod/vault-active target.resource.attribute.labels 從變更記錄對應
labels.compute.googleapis.com/resource_name target.resource.name 從變更記錄對應
status network.http.response_code 從變更記錄對應
runner principal.user.userid 從變更記錄對應
job_id", "job_status additional.fields 從變更記錄對應
host observer.hostname 從變更記錄對應
cluster observer.resource.name 從變更記錄對應
cluster observer.resource.resource_type 從變更記錄對應

變更記錄

查看這個剖析器的變更記錄

還有其他問題嗎?向社群成員和 Google SecOps 專家尋求解答。