收集 Elastic Auditbeat 記錄

支援的國家/地區:

本文說明如何使用 Amazon S3,將 Elastic Auditbeat 記錄擷取至 Google Security Operations。剖析器會從 JSON 記錄檔中擷取欄位,將其正規化為 Unified Data Model (UDM),並使用主機資訊、網路詳細資料和安全性結果分類等額外情境資訊,擴充資料內容。這個函式會將 event1.action 和其他欄位對應至特定 UDM 中繼資料事件類型,藉此處理各種事件類型,並盡可能預設為 GENERIC_EVENT 或更具體的類別。

事前準備

請確認您已完成下列事前準備事項:

  • Google SecOps 執行個體。
  • Elastic Auditbeat 伺服器的特殊存取權。
  • Logstash 伺服器的特殊存取權。
  • AWS 的特殊權限存取權 (S3、身分與存取權管理 (IAM))。

取得 Elastic Auditbeat 的必要條件

  1. 確認伺服器已安裝並設定 Elastic Auditbeat
  2. 在專用伺服器或 Auditbeat 旁安裝 Logstash
  3. 請記下 Auditbeat 設定檔位置 (通常為 /etc/auditbeat/auditbeat.yml)。

為 Google SecOps 設定 AWS S3 值區和 IAM

  1. 按照這份使用者指南建立 Amazon S3 bucket建立 bucket
  2. 儲存 bucket 的「名稱」和「區域」,以供日後參考 (例如 elastic-auditbeat-logs)。
  3. 請按照這份使用者指南建立使用者建立 IAM 使用者
  4. 選取建立的「使用者」
  5. 選取「安全憑證」分頁標籤。
  6. 在「Access Keys」部分中,按一下「Create Access Key」
  7. 選取「第三方服務」做為「用途」
  8. 點選「下一步」
  9. 選用:新增說明標記。
  10. 按一下「建立存取金鑰」
  11. 按一下「下載 .CSV 檔案」,儲存「存取金鑰」和「私密存取金鑰」以供日後參考。
  12. 按一下 [完成]
  13. 選取「權限」分頁標籤。
  14. 在「權限政策」部分中,按一下「新增權限」
  15. 選取「新增權限」
  16. 選取「直接附加政策」
  17. 搜尋「AmazonS3FullAccess」AmazonS3FullAccess政策。
  18. 選取政策。
  19. 點選「下一步」
  20. 按一下「Add permissions」。

設定 Auditbeat,將資料傳送至 Logstash

  1. 編輯 Auditbeat 設定檔 /etc/auditbeat/auditbeat.yml
  2. 註解掉所有現有的輸出設定 (例如 Elasticsearch)。
  3. 新增 Logstash 輸出設定:

    # ==================== Outputs ====================
    output.logstash:
      hosts: ["localhost:5044"]
      # If Logstash is on a different server, use its IP/hostname
      # hosts: ["logstash-server:5044"]
    
      # Optional: Enable load balancing if using multiple Logstash instances
      loadbalance: true
    
      # Optional: Configure bulk settings (default is 2048)
      bulk_max_size: 2048
    
      # Optional: Configure SSL if needed
      # ssl.enabled: true
      # ssl.certificate_authorities: ["/path/to/ca.crt"]
    
  4. 重新啟動 Auditbeat 以套用變更:

    sudo systemctl restart auditbeat
    

設定 Logstash 管道

  1. 建立新的 Logstash 管道設定檔 /etc/logstash/conf.d/auditbeat-to-s3.conf

    input {
      beats {
        port => 5044
        # Optional: Configure SSL
        # ssl => true
        # ssl_certificate => "/path/to/server.crt"
        # ssl_key => "/path/to/server.key"
      }
    }
    
    filter {
      # Add any necessary transformations here
      # The data should remain in raw JSON format for Chronicle parsing
    
      # Optional: Add metadata for debugging
      mutate {
        add_field => { "[@metadata][pipeline]" => "auditbeat-to-s3" }
      }
    }
    
    output {
      s3 {
        # AWS credentials
        access_key_id => "YOUR_AWS_ACCESS_KEY_ID"
        secret_access_key => "YOUR_AWS_SECRET_ACCESS_KEY"
    
        # S3 bucket configuration
        region => "us-east-1"  # Replace with your bucket region
        bucket => "elastic-auditbeat-logs"  # Replace with your bucket name
    
        # Organize logs by date using Logstash timestamp interpolation
        prefix => "auditbeat/%{+YYYY}/%{+MM}/%{+dd}/"
    
        # File rotation settings
        size_file => 10485760  # 10MB files
        time_file => 5  # Rotate every 5 minutes
    
        # Compression for cost optimization
        encoding => "gzip"
    
        # Output format - keep as JSON for Chronicle
        codec => "json_lines"
    
        # Optional: Server-side encryption
        # server_side_encryption => true
        # server_side_encryption_algorithm => "AES256"
      }
    
      # Optional: Keep a local copy for debugging
      # stdout { 
      #   codec => rubydebug 
      # }
    }
    
    • YOUR_AWS_ACCESS_KEY_IDYOUR_AWS_SECRET_ACCESS_KEY 替換為實際的 AWS 憑證。
    • 更新 regionbucket 值,以符合 S3 設定。
    • 啟動或重新啟動 Logstash:
    sudo systemctl restart logstash
    

(選用) 為 Google SecOps 建立唯讀 IAM 使用者和金鑰

  1. 前往 AWS 控制台 > IAM > 使用者
  2. 點選 [Add users] (新增使用者)。
  3. 提供下列設定詳細資料:
    • 使用者:輸入 secops-reader
    • 存取類型:選取「存取金鑰 - 程式輔助存取」
  4. 按一下「建立使用者」
  5. 附加最低讀取權限政策 (自訂):依序選取「Users」(使用者) >「secops-reader」>「Permissions」(權限) >「Add permissions」(新增權限) >「Attach policies directly」(直接附加政策) >「Create policy」(建立政策)
  6. JSON:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": ["s3:GetObject"],
          "Resource": "arn:aws:s3:::elastic-auditbeat-logs/*"
        },
        {
          "Effect": "Allow",
          "Action": ["s3:ListBucket"],
          "Resource": "arn:aws:s3:::elastic-auditbeat-logs"
        }
      ]
    }
    
  7. Name = secops-reader-policy

  8. 依序點選「建立政策」> 搜尋/選取 >「下一步」>「新增權限」

  9. secops-reader 建立存取金鑰:依序點選「安全憑證」>「存取金鑰」

  10. 按一下「建立存取金鑰」

  11. 下載 .CSV。(您會將這些值貼到動態饋給中)。

在 Google SecOps 中設定動態饋給,擷取 Elastic Auditbeat 記錄

  1. 依序前往「SIEM 設定」>「動態饋給」
  2. 按一下「+ 新增動態消息」
  3. 在「動態饋給名稱」欄位中輸入動態饋給名稱 (例如 Elastic Auditbeat Logs)。
  4. 選取「Amazon S3 V2」做為「來源類型」
  5. 選取「Elastic Audit Beats」做為「記錄類型」
  6. 點選「下一步」
  7. 指定下列輸入參數的值:
    • S3 URIs3://elastic-auditbeat-logs/auditbeat/
    • 來源刪除選項:根據偏好設定選取刪除選項。
    • 檔案存在時間上限:包含在過去天數內修改的檔案。預設值為 180 天。
    • 存取金鑰 ID:具有 S3 值區存取權的使用者存取金鑰。
    • 存取密鑰:具有 S3 bucket 存取權的使用者私密金鑰。
    • 資產命名空間資產命名空間
    • 擷取標籤:套用至這個動態饋給事件的標籤。
  8. 點選「下一步」
  9. 在「完成」畫面中檢查新的動態饋給設定,然後按一下「提交」

UDM 對應表

記錄欄位 UDM 對應 邏輯
@timestamp metadata.event_timestamp 系統會從 @timestamp 欄位剖析事件時間戳記。
agent.id observer.asset_id 開頭為「agent_id: 」。
agent.type observer.application 觀察者應用程式設為代理程式類型。
agent.version observer.platform_version 觀察程式平台版本會設為代理程式版本。
client.bytes principal.labels 以「位元組」為鍵新增為標籤。已轉換為字串。
client.ip principal.ip 主體 IP 會設為用戶端 IP。
client.packets principal.labels 以「封包」為鍵新增為標籤。已轉換為字串。
client.port principal.port 主體通訊埠設為用戶端通訊埠。轉換為整數。
cloud.availability_zone principal.cloud.availability_zone 主要雲端可用區會設為雲端可用區。
cloud.instance.id principal.resource.id 主體資源 ID 會設為雲端執行個體 ID。
cloud.machine.type principal.resource.resource_subtype 主體資源子類型設為雲端機器類型。
cloud.region principal.cloud.availability_zone 如果提供雲端地區,系統會覆寫可用區。
destination.bytes target.labels 以「位元組」為鍵新增為標籤。已轉換為字串。
destination.ip target.ip 目標 IP 會設為目的地 IP。
destination.packets target.labels 以「封包」為鍵新增為標籤。已轉換為字串。
destination.port target.port 目標通訊埠會設為目的地通訊埠。轉換為整數。
ecs.version metadata.product_version 如有的話,則會覆寫 jsonPayload.@metadata.version 中的值。
event1.category security_result.category_details 所有值都會新增至 category_details。
event1.duration network.session_duration.seconds 轉換為整數。
event1.id metadata.product_log_id 中繼資料產品記錄 ID 會設為事件 ID。
event1.outcome extensions.auth.auth_details 驗證詳細資料會設為事件結果。
file.extension target.file.mime_type 目標檔案 MIME 類型會設為檔案副檔名。
file.hash.sha1 target.file.sha1 目標檔案 SHA-1 設為檔案 SHA-1 雜湊。
file.path target.file.full_path 目標檔案完整路徑會設為該路徑。
file.size target.file.size 已轉換為 uinteger。
group.id principal.group.product_object_id 主要群組產品物件 ID 會設為群組 ID。
group.name principal.group.group_display_name 主體群組顯示名稱會設為群組名稱。
host.architecture principal.asset.hardware.cpu_platform 儲存在臨時變數 hardware.cpu_platform 中,然後合併至 principal.asset.hardware
host.hostname principal.hostname 主體主機名稱會設為主機主機名稱。
host.id principal.asset.asset_id 前置字串為「Host Id: 」。
host.ip principal.asset.ip 所有值都會加到主要資產 IP 中。
host.mac principal.mac 破折號會替換為半形冒號。
host.name principal.hostnameobserver.hostname 如有的話,則會覆寫 host.hostname 中的值。
host.os.kernel principal.platform_patch_level 主要平台修補程式層級會設為主機 OS 核心。
host.os.version principal.platform_version 主要平台版本會設為主機作業系統版本。儲存在暫時變數 host_os_version 中。
httpRequest.remoteIp target.ip 如果存在且未設定其他目標 IP,系統就會使用這個值。
httpRequest.requestMethod network.http.method 網路 HTTP 方法會設為 HTTP 要求方法。
httpRequest.requestSize network.sent_bytes 已轉換為 uinteger。
httpRequest.requestUrl network.http.referral_url 網路 HTTP 參照網址設為 HTTP 要求網址。
httpRequest.responseSize network.received_bytes 已轉換為 uinteger。
httpRequest.serverIp principal.ip 如果存在且未設定其他主體 IP,系統就會使用這個值。
httpRequest.status network.http.response_code 轉換為整數。
httpRequest.userAgent network.http.user_agent 網路 HTTP 使用者代理程式會設為 HTTP 要求使用者代理程式。
insertId network.session_id 聯播網工作階段 ID 會設為插入 ID。
jsonPayload.@metadata.beat metadata.product_event_type 中繼資料產品事件類型會設為中繼資料節拍。
jsonPayload.@metadata.version metadata.product_version 中繼資料產品版本會設為中繼資料版本。
jsonPayload.destination.ip target.ip 如果存在且未設定其他目標 IP,系統就會使用這個值。
jsonPayload.destination.port target.port 如果存在且未設定其他目標埠,系統就會使用這個值。轉換為整數。
jsonPayload.event1.category security_result.category_details 所有值都會新增至 category_details。
jsonPayload.file.path target.file.full_path 如果存在且未設定其他目標路徑,系統就會使用這個值。
jsonPayload.process.executable principal.process.file.full_pathtarget.process.file.full_path 如果沒有其他值,可用於設定主體和目標程序完整路徑。
jsonPayload.process.name principal.application 如果存在且未設定其他主要應用程式,系統就會使用這個值。
jsonPayload.process.parent.pid principal.process.pid 如果存在且未設定其他主程序 PID,系統就會使用這個值。已轉換為字串。
jsonPayload.process.parent.ppid principal.process.parent_process.pid 如果存在且未設定其他主要父項程序 PID,系統就會使用這個值。已轉換為字串。
jsonPayload.process.parent.process.executable principal.process.file.full_path 如果存在且未設定其他主體程序完整路徑,系統就會使用這個值。
jsonPayload.process.parent.process.exe principal.process.file.full_path 如果存在且未設定其他主體程序完整路徑,系統就會使用這個值。
jsonPayload.process.parent.process.title principal.process.command_line 如果存在且未設定其他主程序命令列,系統就會使用這個值。
jsonPayload.process.pid target.process.pid 目標程序 PID 會設為 JSON 酬載程序 PID。
jsonPayload.process.title target.process.command_line 目標程序指令列會設為 JSON 酬載程序標題。
jsonPayload.user.id target.user.userid 如果存在且未設定其他目標使用者 ID,系統就會使用這個值。已轉換為字串。
jsonPayload.user.name target.user.user_display_name 如果這個值存在,且未設定其他目標使用者顯示名稱,系統就會使用這個值。
msg metadata.description 中繼資料說明已設為訊息。
network.bytes network.sent_bytes 已轉換為 uinteger。
network.community_id network.community_id 聯播網社群 ID 會設為聯播網社群 ID。
network.transport network.ip_protocol 已轉換為大寫。
package.description security_result.description 安全防護結果說明會設為套件說明。
package.name security_result.rule_name 安全防護結果規則名稱會設為套件名稱。
package.reference security_result.about.url 安全結果網址設為套件參照。
package.size security_result.about.file.size 已轉換為 uinteger。
package.type security_result.about.file.mime_typesecurity_result.rule_type 安全性結果 MIME 類型和規則類型會設為套件類型。
process.created principal.asset.creation_time 如果有的話,系統會使用這個值。剖析為 ISO8601。
process.entity_id principal.process.product_specific_process_id 開頭為「Process:」。
process.executable principal.process.file.full_pathtarget.process.file.full_path 如果沒有其他值,可用於設定主體和目標程序完整路徑。
process.hash.sha1 principal.process.file.sha1 主程序 SHA-1 會設為程序 SHA-1 雜湊。
process.name principal.application 如果存在且未設定其他主要應用程式,系統就會使用這個值。
process.pid principal.process.pid 如果存在且未設定其他主程序 PID,系統就會使用這個值。已轉換為字串。
process.ppid principal.process.parent_process.pid 如果存在且未設定其他主要父項程序 PID,系統就會使用這個值。已轉換為字串。
process.start principal.asset.creation_time 如果沒有 process.created,但有這個欄位,系統就會使用這個值。剖析為 ISO8601。
resource.labels.backend_service_name target.resource.name 目標資源名稱會設為資源後端服務名稱。
resource.labels.forwarding_rule_name target.resource.attribute.labels 以「轉送規則名稱」為鍵新增為標籤。
resource.labels.project_id target.resource.product_object_id 目標資源產品物件 ID 會設為資源專案 ID。
resource.labels.target_proxy_name target.resource.attribute.labels 以「目標 Proxy 名稱」鍵新增為標籤。
resource.labels.url_map_name target.resource.attribute.labels 以「網址對應名稱」鍵新增為標籤。
server.bytes intermediary.labels 以「位元組」為鍵新增為標籤。已轉換為字串。
server.ip intermediary.ip 中介 IP 會設為伺服器 IP。
server.packets intermediary.labels 以「封包」為鍵新增為標籤。已轉換為字串。
server.port intermediary.port 中繼通訊埠會設為伺服器通訊埠。轉換為整數。
service.type target.application 目標應用程式設為服務類型。
source.bytes src.labels 以「位元組」為鍵新增為標籤。已轉換為字串。
source.ip src.ip 來源 IP 會設為來源 IP。
source.packets src.labels 以「封包」為鍵新增為標籤。已轉換為字串。
source.port src.port 來源通訊埠設為來源通訊埠。轉換為整數。
system.audit.host.boottime about.asset.last_boot_time 剖析為 ISO8601。
system.audit.host.hostname about.hostname 「關於主機名稱」會設為系統稽核主機名稱。
system.audit.host.id principal.user.userid 主體使用者 ID 會設為系統稽核主機 ID。
system.audit.host.mac.0 about.mac 關於 MAC 位址會設為第一個系統稽核主機 MAC 位址。
trace target.process.file.full_path 如果存在且未設定其他目標程序完整路徑,系統就會使用這個值。
user.effective.id target.user.userid 如果存在且未設定其他目標使用者 ID,系統就會使用這個值。
user.effective.name target.user.user_display_name 如果這個值存在,且未設定其他目標使用者顯示名稱,系統就會使用這個值。
user.id target.user.userid 如果存在且未設定其他目標使用者 ID,系統就會使用這個值。已轉換為字串。
user.name target.user.user_display_name 如果這個值存在,且未設定其他目標使用者顯示名稱,系統就會使用這個值。
不適用 metadata.event_type 一開始請設為「GENERIC_EVENT」。根據剖析器程式碼註解中說明的邏輯變更。
不適用 metadata.log_type 設為「ELASTIC_AUDITBEAT」。
不適用 metadata.product_name 設為「Auditbeat」。
不適用 metadata.vendor_name 設為「Elastic」。
不適用 extensions.auth.type 如果是 USER_LOGIN 和 USER_LOGOUT 事件,請設為「AUTHTYPE_UNSPECIFIED」。
auditd.data.syscall metadata.product_event_type 中繼資料產品事件類型設為 auditd 系統呼叫。

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