收集 Proofpoint Web Browser Isolation 記錄

支援的國家/地區:

本文說明如何使用 Google Cloud Storage V2,將 Proofpoint Web Browser Isolation 記錄檔擷取至 Google Security Operations。

Proofpoint Web Browser Isolation 是一項遠端瀏覽器隔離服務,可透過在安全的雲端環境中算繪網頁內容,防止惡意程式碼到達端點,保護使用者免於網路威脅。並透過 Proofpoint TAP SIEM API 提供瀏覽活動記錄。剖析器會從隔離事件資料中擷取欄位,並對應至統合式資料模型 (UDM),擷取網址分類、使用者動作、安全性處置和瀏覽工作階段中繼資料。

事前準備

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

  • Google SecOps 執行個體
  • 已啟用 Cloud Storage API 的 GCP 專案
  • 建立及管理 GCS bucket 的權限
  • 管理 Google Cloud Storage 值區 IAM 政策的權限
  • 建立 Cloud Run 服務、Pub/Sub 主題和 Cloud Scheduler 工作的權限
  • 使用 TAP SIEM API 憑證 (服務主體和 API 密鑰) 取得 Proofpoint 的特殊權限

建立 Google Cloud Storage bucket

  1. 前往 Google Cloud 控制台
  2. 選取專案或建立新專案。
  3. 在導覽選單中,依序前往「Cloud Storage」>「Bucket」
  4. 按一下「建立值區」
  5. 請提供下列設定詳細資料:

    設定
    為 bucket 命名 輸入全域不重複的名稱 (例如 proofpoint-wbi-logs)
    位置類型 根據需求選擇 (區域、雙區域、多區域)
    位置 選取位置 (例如 us-central1)
    儲存空間級別 標準 (建議用於經常存取的記錄)
    存取控管 統一 (建議)
    保護工具 選用:啟用物件版本管理或資料保留政策
  6. 點選「建立」

收集 Proofpoint TAP SIEM API 憑證

取得 API 憑證

  1. 登入 Proofpoint TAP 資訊主頁
  2. 依序前往「設定」>「已連結的應用程式」
  3. 按一下「建立新憑證」 (或使用現有的 SIEM API 憑證)。
  4. 複製並妥善儲存下列憑證:

    • 服務主體:複製這個值
    • API 密鑰:複製這個值

驗證權限

如要確認 API 憑證是否具備必要權限,請按照下列步驟操作:

  1. 登入 Proofpoint TAP 資訊主頁。
  2. 依序前往「設定」>「已連結的應用程式」
  3. 確認憑證已列出,且狀態為「有效」
  4. 確認憑證已啟用 SIEM API 存取權。

測試 API 存取權

  • 請先測試憑證,再繼續進行整合:

    # Replace with your actual credentials
    SERVICE_PRINCIPAL="<your-service-principal>"
    API_SECRET="<your-api-secret>"
    
    # Test TAP SIEM API access - fetch events from last hour
    curl -v -u "${SERVICE_PRINCIPAL}:${API_SECRET}" \
      "https://tap-api-v2.proofpoint.com/v2/siem/all?format=json&sinceSeconds=3600"
    

為 Cloud Run 函式建立服務帳戶

Cloud Run 函式需要具備 GCS bucket 寫入權限,且可由 Pub/Sub 叫用的服務帳戶。

建立服務帳戶

  1. GCP 控制台中,依序前往「IAM & Admin」(IAM 與管理) >「Service Accounts」(服務帳戶)
  2. 按一下「Create Service Account」(建立服務帳戶)
  3. 請提供下列設定詳細資料:
    • 服務帳戶名稱:輸入 proofpoint-wbi-collector-sa
    • 服務帳戶說明:輸入 Service account for Cloud Run function to collect Proofpoint Web Browser Isolation logs
  4. 按一下「建立並繼續」
  5. 在「將專案存取權授予這個服務帳戶」部分,新增下列角色:
    1. 按一下「選擇角色」
    2. 搜尋並選取「Storage 物件管理員」
    3. 點選「+ 新增其他角色」
    4. 搜尋並選取「Cloud Run Invoker」
    5. 點選「+ 新增其他角色」
    6. 搜尋並選取「Cloud Functions Invoker」(Cloud Functions 叫用者)
  6. 按一下「繼續」
  7. 按一下 [完成]

這些角色適用於:

  • Storage 物件管理員:將記錄檔寫入 GCS bucket,並管理狀態檔案
  • Cloud Run 叫用者:允許 Pub/Sub 叫用函式
  • Cloud Functions 叫用者:允許函式叫用

授予 GCS 值區的 IAM 權限

將 GCS bucket 的寫入權限授予服務帳戶:

  1. 依序前往「Cloud Storage」>「Buckets」
  2. 點按 bucket 名稱 (例如 proofpoint-wbi-logs)。
  3. 前往「權限」分頁標籤。
  4. 按一下「授予存取權」
  5. 請提供下列設定詳細資料:
    • 新增主體:輸入服務帳戶電子郵件地址 (例如 proofpoint-wbi-collector-sa@PROJECT_ID.iam.gserviceaccount.com)
    • 指派角色:選取「Storage 物件管理員」
  6. 按一下 [儲存]

建立 Pub/Sub 主題

建立 Pub/Sub 主題,Cloud Scheduler 會將訊息發布至該主題,而 Cloud Run 函式會訂閱該主題。

  1. GCP Console 中,前往「Pub/Sub」>「Topics」(主題)
  2. 按一下「建立主題」
  3. 請提供下列設定詳細資料:
    • 主題 ID:輸入 proofpoint-wbi-trigger
    • 其他設定保留預設值
  4. 點選「建立」

建立 Cloud Run 函式來收集記錄

Cloud Run 函式會由 Cloud Scheduler 的 Pub/Sub 訊息觸發,從 Proofpoint TAP SIEM API 擷取瀏覽器隔離事件,並將這些事件寫入 GCS。

  1. 前往 GCP Console 的「Cloud Run」
  2. 按一下「Create service」(建立服務)
  3. 選取「函式」 (使用內嵌編輯器建立函式)。
  4. 在「設定」部分,提供下列設定詳細資料:

    設定
    服務名稱 proofpoint-wbi-collector
    區域 選取與 GCS bucket 相符的區域 (例如 us-central1)
    執行階段 選取 Python 3.12 以上版本
  5. 在「Trigger (optional)」(觸發條件 (選用)) 專區:

    1. 按一下「+ 新增觸發條件」
    2. 選取「Cloud Pub/Sub」
    3. 在「選取 Cloud Pub/Sub 主題」中,選擇 Pub/Sub 主題 (proofpoint-wbi-trigger)。
    4. 按一下 [儲存]
  6. 在「Authentication」(驗證) 部分:

    1. 選取「需要驗證」
    2. 檢查 Identity and Access Management (IAM)
  7. 向下捲動並展開「容器」、「網路」和「安全性」

  8. 前往「安全性」分頁:

    • 服務帳戶:選取服務帳戶 (proofpoint-wbi-collector-sa)
  9. 前往「容器」分頁:

    1. 按一下「變數與密鑰」
    2. 針對每個環境變數,按一下「+ 新增變數」
    變數名稱 範例值 說明
    GCS_BUCKET proofpoint-wbi-logs GCS bucket 名稱
    GCS_PREFIX wbi-logs 記錄檔的前置字串
    STATE_KEY wbi-logs/state.json 狀態檔案路徑
    SERVICE_PRINCIPAL your-service-principal Proofpoint TAP 服務主體
    API_SECRET your-api-secret Proofpoint TAP API 密鑰
    LOOKBACK_SECONDS 3600 回溯期 (以秒為單位,預設為 1 小時)
  10. 在「變數與密鑰」部分,向下捲動至「要求」

    • 要求逾時:輸入 600 秒 (10 分鐘)
  11. 前往「設定」分頁:

    • 在「資源」部分:
      • 記憶體:選取 512 MiB 以上
      • CPU:選取 1
  12. 在「修訂版本資源調度」部分:

    • 執行個體數量下限:輸入 0
    • 執行個體數量上限:輸入 100 (或根據預期負載調整)
  13. 點選「建立」

  14. 等待服務建立完成 (1 到 2 分鐘)。

  15. 服務建立完成後,系統會自動開啟內嵌程式碼編輯器

新增函式程式碼

  1. 在「進入點」欄位中輸入「main」
  2. 在內嵌程式碼編輯器中建立兩個檔案:

    • 第一個檔案 - main.py:

      import functions_framework
      from google.cloud import storage
      import json
      import os
      import urllib3
      from datetime import datetime, timezone, timedelta
      import time
      import base64
      
      # Initialize HTTP client with timeouts
      http = urllib3.PoolManager(
        timeout=urllib3.Timeout(connect=5.0, read=60.0),
        retries=False,
      )
      
      # Initialize Storage client
      storage_client = storage.Client()
      
      # Environment variables
      GCS_BUCKET = os.environ.get('GCS_BUCKET')
      GCS_PREFIX = os.environ.get('GCS_PREFIX', 'wbi-logs')
      STATE_KEY = os.environ.get('STATE_KEY', 'wbi-logs/state.json')
      SERVICE_PRINCIPAL = os.environ.get('SERVICE_PRINCIPAL')
      API_SECRET = os.environ.get('API_SECRET')
      LOOKBACK_SECONDS = int(os.environ.get('LOOKBACK_SECONDS', '3600'))
      
      TAP_API_BASE = "https://tap-api-v2.proofpoint.com/v2/siem"
      
      def parse_datetime(value: str) -> datetime:
        """Parse ISO datetime string to datetime object."""
        if value.endswith("Z"):
          value = value[:-1] + "+00:00"
        return datetime.fromisoformat(value)
      
      @functions_framework.cloud_event
      def main(cloud_event):
        """
        Cloud Run function triggered by Pub/Sub to fetch Proofpoint
        Web Browser Isolation events via TAP SIEM API and write to GCS.
      
        Args:
          cloud_event: CloudEvent object containing Pub/Sub message
        """
      
        if not all([GCS_BUCKET, SERVICE_PRINCIPAL, API_SECRET]):
          print('Error: Missing required environment variables')
          return
      
        try:
          # Get GCS bucket
          bucket = storage_client.bucket(GCS_BUCKET)
      
          # Load state
          state = load_state(bucket, STATE_KEY)
      
          now = datetime.now(timezone.utc)
      
          # Determine since_seconds from state
          since_seconds = LOOKBACK_SECONDS
          if isinstance(state, dict) and state.get("last_event_time"):
            try:
              last_time = parse_datetime(state["last_event_time"])
              elapsed = (now - last_time).total_seconds()
              # Add 120 seconds overlap to catch delayed events
              since_seconds = int(elapsed) + 120
              # TAP API maximum is 1 hour (3600 seconds)
              since_seconds = min(since_seconds, 3600)
            except Exception as e:
              print(f"Warning: Could not parse last_event_time: {e}")
      
          print(f"Fetching events from last {since_seconds} seconds")
      
          # Build auth header (Basic auth)
          auth_string = f"{SERVICE_PRINCIPAL}:{API_SECRET}"
          auth_bytes = auth_string.encode('utf-8')
          auth_b64 = base64.b64encode(auth_bytes).decode('utf-8')
      
          # Fetch all SIEM events
          records = fetch_siem_events(
            auth_b64=auth_b64,
            since_seconds=since_seconds,
          )
      
          if not records:
            print("No new events found.")
            save_state(bucket, STATE_KEY, now.isoformat())
            return
      
          # Write to GCS as NDJSON
          timestamp = now.strftime('%Y%m%d_%H%M%S')
          object_key = f"{GCS_PREFIX}/logs_{timestamp}.ndjson"
          blob = bucket.blob(object_key)
      
          ndjson = '\n'.join([json.dumps(record, ensure_ascii=False) for record in records]) + '\n'
          blob.upload_from_string(ndjson, content_type='application/x-ndjson')
      
          print(f"Wrote {len(records)} records to gs://{GCS_BUCKET}/{object_key}")
      
          # Update state
          save_state(bucket, STATE_KEY, now.isoformat())
      
          print(f"Successfully processed {len(records)} records")
      
        except Exception as e:
          print(f'Error processing logs: {str(e)}')
          raise
      
      def load_state(bucket, key):
        """Load state from GCS."""
        try:
          blob = bucket.blob(key)
          if blob.exists():
            state_data = blob.download_as_text()
            return json.loads(state_data)
        except Exception as e:
          print(f"Warning: Could not load state: {e}")
      
        return {}
      
      def save_state(bucket, key, last_event_time_iso: str):
        """Save the last event timestamp to GCS state file."""
        try:
          state = {'last_event_time': last_event_time_iso}
          blob = bucket.blob(key)
          blob.upload_from_string(
            json.dumps(state, indent=2),
            content_type='application/json'
          )
          print(f"Saved state: last_event_time={last_event_time_iso}")
        except Exception as e:
          print(f"Warning: Could not save state: {e}")
      
      def fetch_siem_events(auth_b64: str, since_seconds: int):
        """
        Fetch events from the Proofpoint TAP SIEM API.
      
        The TAP SIEM API returns all event types (clicks, messages, isolation)
        in a single response. The sinceSeconds parameter controls the lookback window
        (maximum 3600 seconds / 1 hour).
      
        Args:
          auth_b64: Base64-encoded Service Principal:API Secret for Basic auth
          since_seconds: Fetch events from the last N seconds (max 3600)
      
        Returns:
          List of event records
        """
        headers = {
          'Authorization': f'Basic {auth_b64}',
          'Accept': 'application/json',
          'User-Agent': 'GoogleSecOps-ProofpointWBICollector/1.0',
        }
      
        url = f"{TAP_API_BASE}/all?format=json&sinceSeconds={since_seconds}"
        backoff = 1.0
        max_retries = 3
      
        for attempt in range(max_retries):
          try:
            response = http.request('GET', url, headers=headers)
      
            # Handle rate limiting with exponential backoff
            if response.status == 429:
              retry_after = int(response.headers.get('Retry-After', str(int(backoff))))
              print(f"Rate limited (429). Retrying after {retry_after}s...")
              time.sleep(retry_after)
              backoff = min(backoff * 2, 30.0)
              continue
      
            if response.status != 200:
              print(f"HTTP Error: {response.status}")
              response_text = response.data.decode('utf-8')
              print(f"Response body: {response_text}")
              return []
      
            data = json.loads(response.data.decode('utf-8'))
      
            # TAP SIEM API returns events grouped by type
            all_events = []
      
            # Collect all event types
            for key in ['clicksPermitted', 'clicksBlocked', 'messagesDelivered', 'messagesBlocked']:
              events = data.get(key, [])
              if events:
                for event in events:
                  event['_tap_event_type'] = key
                all_events.extend(events)
                print(f"Retrieved {len(events)} {key} events")
      
            print(f"Total events retrieved: {len(all_events)}")
            return all_events
      
          except Exception as e:
            print(f"Error fetching SIEM events (attempt {attempt + 1}): {e}")
            if attempt < max_retries - 1:
              time.sleep(backoff)
              backoff = min(backoff * 2, 30.0)
      
        return []
      
    • 第二個檔案 - requirements.txt:

      functions-framework==3.*
      google-cloud-storage==2.*
      urllib3>=2.0.0
      
  3. 點選「部署」即可儲存並部署函式。

  4. 等待部署作業完成 (2 到 3 分鐘)。

建立 Cloud Scheduler 工作

Cloud Scheduler 會定期將訊息發布至 Pub/Sub 主題,觸發 Cloud Run 函式。

  1. 前往 GCP 主控台的「Cloud Scheduler」
  2. 點選「建立工作」
  3. 請提供下列設定詳細資料:

    設定
    名稱 proofpoint-wbi-collector-hourly
    區域 選取與 Cloud Run 函式相同的區域
    頻率 0 * * * * (每小時整點)
    時區 選取時區 (建議使用世界標準時間)
    目標類型 Pub/Sub
    主題 選取 Pub/Sub 主題 (proofpoint-wbi-trigger)
    郵件內文 {} (空白 JSON 物件)
  4. 點選「建立」

排程頻率選項

根據記錄檔量和延遲時間要求選擇頻率:

頻率 Cron 運算式 用途
每 5 分鐘 */5 * * * * 大量、低延遲
每 15 分鐘 */15 * * * * 中等
每小時 0 * * * * 標準 (建議)

測試整合項目

  1. Cloud Scheduler 控制台中找出您的工作。
  2. 按一下「強制執行」即可手動觸發工作。
  3. 稍等幾秒鐘。
  4. 前往「Cloud Run」>「Services」
  5. 按一下函式名稱 (proofpoint-wbi-collector)。
  6. 按一下 [Logs] (記錄) 分頁標籤。
  7. 確認函式是否已順利執行。請注意以下事項:

    Fetching events from last 3600 seconds
    Retrieved X clicksPermitted events
    Retrieved X messagesDelivered events
    Total events retrieved: X
    Wrote X records to gs://proofpoint-wbi-logs/wbi-logs/logs_YYYYMMDD_HHMMSS.ndjson
    Successfully processed X records
    
  8. 依序前往「Cloud Storage」>「Buckets」

  9. 按一下 bucket 名稱 (proofpoint-wbi-logs)。

  10. 前往前置字元資料夾 (wbi-logs/)。

  11. 確認是否已建立新的 .ndjson 檔案,且檔案名稱包含目前的時間戳記。

如果記錄中顯示錯誤:

  • HTTP 401:檢查環境變數中的服務主體和 API 密鑰
  • HTTP 403:確認憑證具有 SIEM API 存取權,且訂閱方案包含瀏覽器隔離事件
  • HTTP 429:頻率限制 - 函式會自動重試,並延遲一段時間
  • 缺少環境變數:檢查是否已設定所有必要變數

擷取 Google SecOps 服務帳戶

Google SecOps 會使用專屬服務帳戶,從 GCS bucket 讀取資料。您必須授予這個服務帳戶值區存取權。

取得服務帳戶電子郵件地址

  1. 依序前往「SIEM 設定」>「動態饋給」
  2. 按一下「新增動態消息」
  3. 按一下「設定單一動態饋給」
  4. 在「動態饋給名稱」欄位中輸入動態饋給名稱 (例如 Proofpoint Web Browser Isolation Logs)。
  5. 選取「Google Cloud Storage V2」做為「來源類型」
  6. 選取「Proofpoint Web Browser Isolation」做為「記錄類型」
  7. 按一下「取得服務帳戶」
  8. 系統會顯示專屬服務帳戶電子郵件地址,例如:

    chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com
    
  9. 複製這個電子郵件地址,以便在下一步中使用。

  10. 點選「下一步」

  11. 指定下列輸入參數的值:

    • 儲存空間 bucket URL:輸入 GCS bucket URI,並加上前置路徑:

      gs://proofpoint-wbi-logs/wbi-logs/
      
      • 取代:
        • proofpoint-wbi-logs:您的 GCS bucket 名稱。
        • wbi-logs:儲存記錄的選用前置字元/資料夾路徑 (如為根目錄,請留空)。
    • 來源刪除選項:根據偏好設定選取刪除選項:

      • 永不:移轉後一律不刪除任何檔案 (建議用於測試)。
      • 刪除已轉移的檔案:成功轉移檔案後刪除檔案。
      • 刪除已轉移的檔案和空白目錄:成功轉移後刪除檔案和空白目錄。

    • 檔案存在時間上限:包含在過去天數內修改的檔案 (預設為 180 天)

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

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

  12. 點選「下一步」

  13. 在「Finalize」(完成) 畫面中檢查新的動態饋給設定,然後按一下「Submit」(提交)

將 IAM 權限授予 Google SecOps 服務帳戶

Google SecOps 服務帳戶需要 GCS bucket 的「Storage 物件檢視者」角色。

  1. 依序前往「Cloud Storage」>「Buckets」
  2. 點按 bucket 名稱 (例如 proofpoint-wbi-logs)。
  3. 前往「權限」分頁標籤。
  4. 按一下「授予存取權」
  5. 請提供下列設定詳細資料:
    • 新增主體:貼上 Google SecOps 服務帳戶電子郵件地址
    • 指派角色:選取「Storage 物件檢視者」
  6. 按一下 [儲存]

UDM 對應表

記錄欄位 UDM 對應 邏輯
metadata.event_type 活動類型
類別 metadata.product_event_type 產品專屬事件類型
parentPageURL metadata.url_back_to_product 可連結回產品的網址
區域 principal.location.country_or_region 主要負責人所在國家/地區
可用區 principal.location.name 主體位置的名稱
userId principal.user.product_object_id 使用者的產品專屬 ID
userName principal.user.userid 使用者 ID
security_result security_result 安全性結果詳細資料
disposition security_result.action 採取的安全措施
disposition security_result.action_details 安全性動作的詳細資料
將內容分類 security_result.detection_fields 偵測相關欄位
網址 target.url 目標資源的網址
metadata.product_name 產品名稱
metadata.vendor_name 供應商名稱

變更記錄

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

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