收集 AWS Security Hub 記錄

支援的國家/地區:

本文說明如何將 AWS Security Hub 記錄擷取至 Google Security Operations。AWS Security Hub 可全面掌握 AWS 帳戶的安全快訊和發現事項。將這些發現項目傳送至 Google SecOps 後,您就能使用 Google SecOps 功能,加強監控和威脅偵測。

事前準備

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

  • Google SecOps 執行個體
  • AWS 的特殊存取權

設定 AWS IAM 和 S3

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

建立 Lambda 函式

  1. 登入 AWS 管理主控台
  2. 前往 Lambda
  3. 按一下「建立函式」,然後選取「從頭開始撰寫」
  4. 為函式命名,例如 SecurityHubToS3
  5. 選擇 Python 3.x 做為執行階段。
  6. 輸入 Lambda 程式碼,從 EventBridge 取得結果並寫入 S3 值區:

    import json
    import boto3
    from datetime import datetime
    
    # Initialize the S3 client
    s3_client = boto3.client('s3')
    
    # S3 bucket where findings will be stored
    bucket_name = 'aws-security-hub-findings-stream'
    
    def lambda_handler(event, context):
       # Extract Security Hub findings from the event
       findings = event['detail']['findings']
    
       # Generate a timestamp for the file name to avoid overwriting
       timestamp = datetime.now().strftime('%Y-%m-%dT%H-%M-%S')
    
       # Generate the S3 object key (file name) based on the timestamp
       object_key = f"security_hub_findings_{timestamp}.json"
    
       # Convert findings to JSON format
       findings_json = json.dumps(findings)
    
       # Upload the findings to S3
       try:
          response = s3_client.put_object(
                Bucket=bucket_name,
                Key=object_key,
                Body=findings_json,
                ContentType='application/json'
          )
          print(f"Successfully uploaded findings to S3: {response}")
       except Exception as e:
          print(f"Error uploading findings to S3: {e}")
          raise e
    
       return {
          'statusCode': 200,
          'body': json.dumps('Successfully processed findings')
       }
    
  7. 將 IAM 角色新增至 Lambda 函式,並設定下列政策,為 Lambda 設定權限:

    {
       "Version": "2012-10-17",
       "Statement": [
          {
                "Effect": "Allow",
                "Action": [
                   "s3:PutObject"
                ],
                "Resource": "arn:aws:s3:::aws-security-hub-findings-stream/*"
          }
       ]
    }
    

如何設定 AWS Security Hub,透過 EventBridge 轉送發現項目

  1. 登入 AWS 管理主控台
  2. 在搜尋列中輸入並選取服務清單中的「Security Hub」
  3. 按一下「設定」
  4. 在「整合」專區下方,找到「EventBridge」,然後按一下「啟用」
  5. 在搜尋列中輸入並選取服務清單中的「EventBridge」EventBridge
  6. 在 EventBridge 控制台中,依序點選「規則」>「建立規則」
  7. 提供下列規則設定:
    1. 規則名稱:為規則提供描述性名稱,例如 SendSecurityHubFindingsToS3
    2. 事件來源:選取「AWS 服務」
    3. 「服務名稱」:選擇「Security Hub」
    4. 事件類型:選取「Security Hub Findings」(Security Hub 發現項目)
    5. 設定目標:選擇「Lambda function」(Lambda 函式)
    6. 選取您剛建立的 Lambda 函式 (SecurityHubToS3)。
  8. 點選「建立」

設定動態饋給

在 Google SecOps 平台中,有兩種不同的進入點可設定動態饋給:

  • 「SIEM 設定」>「動態消息」
  • 內容中心 > 內容包

依序前往「SIEM 設定」>「動態消息」,設定動態消息

如要為這個產品系列中的不同記錄類型設定多個動態饋給,請參閱「設定多個動態饋給」。

如要設定單一動態饋給,請按照下列步驟操作:

  1. 依序前往「SIEM 設定」>「動態饋給」
  2. 按一下「新增動態消息」
  3. 在下一個頁面中,按一下「設定單一動態饋給」
  4. 在「Feed name」(動態消息名稱) 欄位中,輸入動態消息的名稱,例如「AWS Security Hub Logs」(AWS Security Hub 記錄)
  5. 選取「Amazon S3」做為「來源類型」
  6. 選取「AWS Security Hub」做為「記錄類型」
  7. 點選「下一步」
  8. 指定下列輸入參數的值:

    • 區域:Amazon S3 值區所在的區域。
    • S3 URI:bucket URI。
      • s3://your-log-bucket-name/
        • 請將 your-log-bucket-name 替換為 S3 值區的實際名稱。
    • URI 是:根據 bucket 結構,選取「Directory」(目錄) 或「Directory which includes subdirectories」(包含子目錄的目錄)
    • 來源刪除選項:根據擷取偏好設定選取刪除選項。

    • 存取金鑰 ID:具備 S3 值區讀取權限的使用者存取金鑰。

    • 存取密鑰:使用者的存取密鑰,具備從 S3 bucket 讀取的權限。

    • 資產命名空間資產命名空間

    • 擷取標籤:要套用至這個動態饋給事件的標籤。

  9. 點選「下一步」

  10. 在「Finalize」畫面上檢查新的動態饋給設定,然後按一下「Submit」

從內容中心設定動態饋給

為下列欄位指定值:

  • 區域:Amazon S3 值區所在的區域。
  • S3 URI:bucket URI。
    • s3://your-log-bucket-name/
      • 請將 your-log-bucket-name 替換為 S3 值區的實際名稱。
  • URI 是:根據 bucket 結構,選取「Directory」(目錄) 或「Directory which includes subdirectories」(包含子目錄的目錄)
  • 來源刪除選項:根據擷取偏好設定選取刪除選項。
  • 存取金鑰 ID:具備 S3 值區讀取權限的使用者存取金鑰。

  • 存取密鑰:使用者的存取密鑰,具備從 S3 bucket 讀取的權限。

進階選項

  • 動態饋給名稱:系統預先填入的值,用於識別動態饋給。
  • 來源類型:將記錄收集到 Google SecOps 的方法。
  • 資產命名空間與動態饋給相關聯的命名空間
  • 擷取標籤:套用至這個動態饋給所有事件的標籤。

UDM 對應表

記錄欄位 UDM 對應 邏輯
account principal.group.product_object_id 與發現項目相關聯的 AWS 帳戶 ID。
configurationItem.ARN target.resource.id 設定項目的 Amazon Resource Name (ARN)。
configurationItem.awsAccountId principal.user.userid 設定項目的 AWS 帳戶 ID。
configurationItem.awsRegion target.asset.location.country_or_region 設定項目的 AWS 區域。
configurationItem.configuration.complianceType security_result.summary 設定項目的法規遵循類型。
configurationItem.configuration.configRuleList[].complianceType security_result.summary 各項設定規則的法規遵循狀態。
configurationItem.configuration.configRuleList[].configRuleArn security_result.rule_id AWS Config 規則的 ARN。
configurationItem.configuration.configRuleList[].configRuleId security_result.about.labels.configRuleId AWS Config 規則的 ID。
configurationItem.configuration.configRuleList[].configRuleName security_result.rule_name AWS Config 規則的名稱。
configurationItem.configuration.privateIpAddress target.ip 設定項目的私人 IP 位址。
configurationItem.configuration.publicIpAddress target.ip 設定項目的公開 IP 位址。
configurationItem.configurationItemCaptureTime target.asset.attribute.creation_time 設定項目的擷取時間,已轉換為時間戳記。
configurationItem.configurationItemStatus target.asset.attribute.labels.Configuration Item Status 設定項目的狀態。
configurationItem.relationships[].resourceId target.asset.attribute.cloud.vpc.id 相關資源的資源 ID,如果與 vpc 相符,則用於虛擬私有雲 ID。
configurationItem.resourceId target.resource.id 設定項目的資源 ID。
configurationItem.resourceName target.resource.name 資源的名稱。
configurationItem.resourceType target.resource.resource_subtype 設定項目的資源類型。
configurationItem.tags.Contact principal.user.user_display_nameprincipal.user.email_addresses 從標記擷取聯絡資料,並剖析電子郵件和使用者名稱。
configurationItem.tags.OS/configurationItem.tags.Os target.asset.platform_software.platform 來自代碼的作業系統,如果為 WindowsLinux,則會對應至平台。
configurationItemDiff.changeType metadata.event_type 變更類型,對應至 RESOURCE_WRITTEN 或 RESOURCE_CREATION。
detail.accountId principal.group.product_object_id 與發現項目相關聯的 AWS 帳戶 ID。
detail.actionDescription detail.actionName detail.description sec_result.description 發現項目的說明。
detail.findings[].AwsAccountId principal.group.product_object_id 與發現項目相關聯的 AWS 帳戶 ID。
detail.findings[].CompanyName detail.findings[].CreatedAt detail.findings[].Description sec_result.description 發現項目的說明。
detail.findings[].FindingProviderFields.Severity.Label sec_result.severity 發現項目的嚴重性標籤,並轉換為大寫。
detail.findings[].FindingProviderFields.Types[] detail.findings[].FirstObservedAt detail.findings[].GeneratorId detail.findings[].Id detail.findings[].LastObservedAt detail.findings[].ProductArn detail.findings[].ProductFields. 詳情請見下方 用於其他欄位、主體和目標資訊的各種欄位。
detail.findings[].ProductName detail.findings[].RecordState detail.findings[].Region target.location.name 發現項目的 AWS 區域。
detail.findings[].Resources[].Details. 詳情請見下方 與發現項目相關的資源詳細資料。
detail.findings[].Resources[].Id target.resource.product_object_id 資源的 ID。
detail.findings[].Resources[].Partition detail.findings[].Resources[].Region target.location.name 資源的 AWS 區域。
detail.findings[].Resources[].Tags detail.findings[].Resources[].Type target.resource.resource_typetarget.resource.resource_subtypemetadata.event_type 資源類型,用於資源類型、子類型和事件類型對應。
detail.findings[].Sample detail.findings[].SchemaVersion detail.findings[].Severity.Label detail.findings[].SourceUrl detail.findings[].Title sec_result.summary 調查結果的標題。
detail.findings[].Types[] detail.findings[].UpdatedAt detail.findings[].Workflow.Status detail.findings[].WorkflowState detail-type metadata.product_event_type 事件的詳細類型。
id metadata.product_log_id 活動的 ID。
region target.location.name 活動的 AWS 區域。
resources[] source time version (剖析器邏輯) metadata.event_timestamp 原始記錄項目的建立時間,用做事件時間戳記。
(剖析器邏輯) metadata.log_type 設為 AWS_SECURITY_HUB
(剖析器邏輯) metadata.product_name 設為 AWS Security Hub
(剖析器邏輯) metadata.vendor_name 設為 AMAZON
(剖析器邏輯) target.asset.attribute.cloud.environment 設為 AMAZON_WEB_SERVICES
(剖析器邏輯) metadata.event_type 如果未從 Resources[].TypeconfigurationItemDiff.changeType 對應,則預設設為 USER_RESOURCE_ACCESS。如果存在 configurationItems 且未設定其他事件類型,請設為 STATUS_UPDATE。如果存在 configurationItemconfigurationItems,且狀態為 OKResourceDiscovered,請設為 RESOURCE_READ。如果存在 configurationItemconfigurationItems,且狀態為 ResourceDeleted,請設為 RESOURCE_DELETION
(剖析器邏輯) metadata.description 如果 detail.findings[].ProductFields.aws/guardduty/service/serviceName 存在,請設為 guardduty
(剖析器邏輯) target.asset.attribute.cloud.vpc.resource_type 如果 configurationItems.relationships[].resourceId 符合 vpc,請設為 VPC_NETWORK
(剖析器邏輯) target.resource.resource_type 如果存在 configurationItemconfigurationItems,請設為 VIRTUAL_MACHINE。如果未設定其他資源類型,請設為 UNSPECIFIED
(剖析器邏輯) target.asset.platform_software.platform 根據 configurationItem 訊息中是否有 Windows(Linux|LINUX),將值設為 WINDOWSLINUXconfigurationItems 是根據 configItem.tags.OSconfigItem.tags.Os 設定。
(剖析器邏輯) disambiguation_key 如果單一記錄項目產生多個事件,系統就會新增這項屬性。

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