Proofpoint TAP Forensics ログを収集する
このドキュメントでは、Google Cloud Storage V2 を使用して Proofpoint TAP Forensics ログを Google Security Operations に取り込む方法について説明します。
Proofpoint Targeted Attack Protection(TAP)は、悪意のある添付ファイルや URL など、メールを介して配信される標的型攻撃を検出、分析、ブロックする高度なメール セキュリティ プラットフォームです。TAP Forensics API は、サンドボックス分析結果、行動指標、ネットワーク アクティビティ、ファイル システムの変更、プロセス実行データなど、環境内で観察された個々の脅威やキャンペーンに関する詳細なフォレンジック証拠を提供します。これらのフォレンジック指標は、ホストの侵害の確認、セキュリティ インテリジェンス ソースの強化、セキュリティ エンドポイントの更新のオーケストレーションに使用できます。
始める前に
次の前提条件を満たしていることを確認してください。
- Google SecOps インスタンス
- Cloud Storage API が有効になっている GCP プロジェクト
- GCS バケットを作成、管理する権限
- Cloud Run サービス、Pub/Sub トピック、Cloud Scheduler ジョブを作成する権限
- Threat Insight ダッシュボードにアクセスできる Proofpoint TAP サブスクリプション
- SIEM API と Forensics API へのアクセス権限を持つ TAP API サービス認証情報(サービス プリンシパルとシークレット)
Proofpoint TAP API サービスの認証情報を生成する
- Proofpoint TAP Threat Insight ダッシュボードにログインします。
- [Settings] > [Connected Applications] > [Service Credentials] に移動します。
- [Create New Credential] をクリックします。
[Generated Service Credential] ダイアログで、次の情報をコピーして安全に保存します。
- サービス プリンシパル: API 認証に使用されるプリンシパル識別子
- Secret: API 認証に使用される秘密鍵
API アクセスを確認する
統合に進む前に、認証情報をテストします。
PRINCIPAL="your-service-principal" SECRET="your-secret" # Test SIEM API access (fetch last 5 minutes of events) curl -s "https://tap-api-v2.proofpoint.com/v2/siem/all?format=json&sinceSeconds=300" \ --user "${PRINCIPAL}:${SECRET}" # Test Forensics API access (requires a valid threatId) # curl -s "https://tap-api-v2.proofpoint.com/v2/forensics?threatId=<threatId>" \ # --user "${PRINCIPAL}:${SECRET}"
SIEM API レスポンスが成功すると、messagesBlocked、messagesDelivered、clicksBlocked、clicksPermitted 配列を含む JSON オブジェクトが返されます。
401エラーが発生した場合は、サービス プリンシパルと Secret が正しいことを確認します。403エラーが発生した場合は、アカウントで TAP API アクセスが有効になっていることを確認してください。
Google Cloud Storage バケットを作成する
- Google Cloud コンソールに移動します。
- プロジェクトを選択するか、新しいプロジェクトを作成します。
- ナビゲーション メニューで、[Cloud Storage] > [バケット] に移動します。
- [バケットを作成] をクリックします。
次の構成情報を提供してください。
設定 値 バケットに名前を付ける グローバルに一意の名前( proofpoint-tap-forensics-logsなど)を入力します。ロケーション タイプ ニーズに応じて選択します(リージョン、デュアルリージョン、マルチリージョン)。 ロケーション ロケーションを選択します(例: us-central1)。ストレージ クラス Standard(頻繁にアクセスされるログに推奨) アクセス制御 均一(推奨) 保護ツール 省略可: オブジェクトのバージョニングまたは保持ポリシーを有効にする [作成] をクリックします。
Cloud Run functions のサービス アカウントを作成する
Cloud Run functions の関数には、GCS バケットへの書き込み権限と Pub/Sub による呼び出し権限を持つサービス アカウントが必要です。
サービス アカウントを作成する
- GCP コンソールで、[IAM と管理] > [サービス アカウント] に移動します。
- [サービス アカウントを作成] をクリックします。
- 次の構成情報を指定します。
- サービス アカウント名: 「
tap-forensics-collector-sa」と入力します。 - サービス アカウントの説明: 「
Service account for Cloud Run function to collect Proofpoint TAP Forensics logs」と入力します。
- サービス アカウント名: 「
- [作成して続行] をクリックします。
- [このサービス アカウントにプロジェクトへのアクセスを許可する] セクションで、次のロールを追加します。
- [ロールを選択] をクリックします。
- [Storage オブジェクト管理者] を検索して選択します。
- [+ 別のロールを追加] をクリックします。
- [Cloud Run 起動元] を検索して選択します。
- [+ 別のロールを追加] をクリックします。
- [Cloud Functions 起動元] を検索して選択します。
- [続行] をクリックします。
- [完了] をクリックします。
これらのロールは、次の操作に必要です。
- ストレージ オブジェクト管理者: フォレンジック証拠データを GCS バケットに書き込み、状態ファイルを管理します。
- Cloud Run 起動元: Pub/Sub が関数を呼び出せるようにします。
- Cloud Functions 起動元: 関数の呼び出しを許可します。
GCS バケットに対する IAM 権限を付与する
GCS バケットに対する書き込み権限をサービス アカウントに付与します。
- [Cloud Storage] > [バケット] に移動します。
- バケット名をクリックします。
- [権限] タブに移動します。
- [アクセス権を付与] をクリックします。
- 次の構成情報を指定します。
- プリンシパルを追加: サービス アカウントのメールアドレス(例:
tap-forensics-collector-sa@PROJECT_ID.iam.gserviceaccount.com)を入力します。 - ロールを割り当てる: [Storage オブジェクト管理者] を選択します。
- プリンシパルを追加: サービス アカウントのメールアドレス(例:
- [保存] をクリックします。
Pub/Sub トピックの作成
Cloud Scheduler がパブリッシュし、Cloud Run functions の関数がサブスクライブする Pub/Sub トピックを作成します。
- GCP コンソールで、[Pub/Sub] > [トピック] に移動します。
- [トピックを作成] をクリックします。
- 次の構成情報を指定します。
- トピック ID: 「
tap-forensics-collector-trigger」と入力します。 - その他の設定はデフォルトのままにします。
- トピック ID: 「
- [作成] をクリックします。
フォレンジック証拠を収集する Cloud Run functions の関数を作成する
Cloud Run functions の関数は、Cloud Scheduler からの Pub/Sub メッセージによってトリガーされ、Proofpoint TAP SIEM API から脅威イベントを取得し、Forensics API を使用して一意の脅威ごとにフォレンジック証拠を取得して、結果を GCS に書き込みます。
- GCP Console で Cloud Run に移動します。
- [サービスを作成] をクリックします。
- [関数](インライン編集を使用して関数を作成する)を選択します。
[構成] セクションで、次の構成の詳細を指定します。
設定 値 サービス名 tap-forensics-collectorリージョン GCS バケットに一致するリージョンを選択します(例: us-central1)。ランタイム [Python 3.12] 以降を選択します。 [トリガー(省略可)] セクションで、次の操作を行います。
- [+ トリガーを追加] をクリックします。
- [Cloud Pub/Sub] を選択します。
- [Cloud Pub/Sub トピックを選択してください] で、トピック
tap-forensics-collector-triggerを選択します。 - [保存] をクリックします。
[認証] セクションで、次の操作を行います。
- [認証が必要] を選択します。
- Identity and Access Management(IAM)を確認します。
下にスクロールして、[コンテナ、ネットワーキング、セキュリティ] を開きます。
[セキュリティ] タブに移動します。
- サービス アカウント: サービス アカウント
tap-forensics-collector-saを選択します。
- サービス アカウント: サービス アカウント
[コンテナ] タブに移動します。
- [変数とシークレット] をクリックします。
- 環境変数ごとに [+ 変数を追加] をクリックします。
変数名 値の例 説明 GCS_BUCKETproofpoint-tap-forensics-logsGCS バケット名 GCS_PREFIXtap-forensicsログファイルの接頭辞 STATE_KEYtap-forensics/state.json状態ファイルのパス TAP_PRINCIPALyour-service-principalTAP API サービス プリンシパル TAP_SECRETyour-secretTAP API Secret LOOKBACK_HOURS1初期ルックバック期間(時間単位、最大 7 日間) MAX_THREATS5001 回の実行でフォレンジックを取得する一意の脅威の最大数 [変数とシークレット] セクションで [リクエスト] まで下にスクロールします。
- リクエスト タイムアウト: 「
540」秒(9 分)と入力します。
- リクエスト タイムアウト: 「
[設定] タブに移動します。
- [リソース] セクションで、次の操作を行います。
- メモリ: 512 MiB 以上を選択します。
- CPU: 1 を選択します。
- [リソース] セクションで、次の操作を行います。
[リビジョン スケーリング] セクションで、次の操作を行います。
- [インスタンスの最小数]: 「
0」と入力します。 - [インスタンスの最大数]: 「
100」と入力します(または、予想される負荷に基づいて調整します)。
- [インスタンスの最小数]: 「
[作成] をクリックします。
サービスが作成されるまで待ちます(1 ~ 2 分)。
サービスが作成されると、インライン コードエディタが自動的に開きます。
関数コードを追加する
- [エントリ ポイント] フィールドに「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=10.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', 'tap-forensics').strip('/') STATE_KEY = os.environ.get('STATE_KEY') or f"{GCS_PREFIX}/state.json" TAP_PRINCIPAL = os.environ.get('TAP_PRINCIPAL') TAP_SECRET = os.environ.get('TAP_SECRET') LOOKBACK_HOURS = int(os.environ.get('LOOKBACK_HOURS', '1')) MAX_THREATS = int(os.environ.get('MAX_THREATS', '500')) API_BASE = 'https://tap-api-v2.proofpoint.com' def get_auth_header(): """Build HTTP Basic Authentication header.""" auth_string = f"{TAP_PRINCIPAL}:{TAP_SECRET}" auth_bytes = auth_string.encode('utf-8') auth_b64 = base64.b64encode(auth_bytes).decode('utf-8') return f"Basic {auth_b64}" @functions_framework.cloud_event def main(cloud_event): """ Cloud Run function triggered by Pub/Sub to fetch Proofpoint TAP forensic evidence and write to GCS. The function first queries the SIEM API to discover threat IDs, then calls the Forensics API for each unique threat to retrieve detailed forensic evidence (sandbox results, behavioral indicators, network activity, file changes, and process data). Args: cloud_event: CloudEvent object containing Pub/Sub message """ if not all([GCS_BUCKET, TAP_PRINCIPAL, TAP_SECRET]): print('Error: Missing required environment variables') return try: bucket = storage_client.bucket(GCS_BUCKET) # Load state state = load_state(bucket, STATE_KEY) # Determine time window now = datetime.now(timezone.utc) last_time = None if isinstance(state, dict) and state.get('last_event_time'): try: last_time = parse_datetime(state['last_event_time']) # Overlap by 2 minutes to catch delayed events last_time = last_time - timedelta(minutes=2) except Exception as e: print(f"Warning: Could not parse last_event_time: {e}") if last_time is None: last_time = now - timedelta(hours=LOOKBACK_HOURS) # TAP SIEM API allows max 1 hour per request and max 7 days lookback if (now - last_time) > timedelta(days=7): last_time = now - timedelta(days=7) print("Warning: Lookback capped to 7 days (TAP API limit)") print(f"Fetching threats from {last_time.isoformat()} to {now.isoformat()}") # Step 1: Fetch threat IDs from the SIEM API threat_ids = fetch_threat_ids(last_time, now) if not threat_ids: print("No threats found in the specified time window.") save_state(bucket, STATE_KEY, now.isoformat()) return print(f"Found {len(threat_ids)} unique threat IDs") # Step 2: Fetch forensic evidence for each threat forensic_records = fetch_forensics_for_threats(threat_ids) if not forensic_records: print("No forensic evidence retrieved.") 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}/tap_forensics_{timestamp}.ndjson" blob = bucket.blob(object_key) ndjson = '\n'.join( [json.dumps(record, ensure_ascii=False) for record in forensic_records] ) + '\n' blob.upload_from_string(ndjson, content_type='application/x-ndjson') print(f"Wrote {len(forensic_records)} records to gs://{GCS_BUCKET}/{object_key}") # Update state save_state(bucket, STATE_KEY, now.isoformat()) print(f"Successfully processed forensics for {len(threat_ids)} threats") except Exception as e: print(f'Error processing TAP forensics: {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): """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 parse_datetime(value): """Parse ISO datetime string to datetime object.""" if value.endswith('Z'): value = value[:-1] + '+00:00' return datetime.fromisoformat(value) def fetch_threat_ids(start_time, end_time): """ Fetch unique threat IDs from the TAP SIEM API by querying in 1-hour intervals within the specified time window. Args: start_time: Start of the time window (datetime) end_time: End of the time window (datetime) Returns: Set of unique threat ID strings """ headers = { 'Authorization': get_auth_header(), 'Accept': 'application/json', 'User-Agent': 'GoogleSecOps-TAPForensicsCollector/1.0', } threat_ids = set() current_start = start_time backoff = 1.0 while current_start < end_time: # TAP SIEM API allows max 1 hour per request current_end = min(current_start + timedelta(hours=1), end_time) interval = ( f"{current_start.strftime('%Y-%m-%dT%H:%M:%SZ')}" f"/{current_end.strftime('%Y-%m-%dT%H:%M:%SZ')}" ) url = f"{API_BASE}/v2/siem/all?format=json&interval={interval}" try: response = http.request('GET', url, headers=headers) 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, 60.0) continue backoff = 1.0 if response.status != 200: print(f"SIEM API HTTP Error: {response.status}") response_text = response.data.decode('utf-8') print(f"Response body: {response_text[:500]}") current_start = current_end continue data = json.loads(response.data.decode('utf-8')) # Extract threat IDs from all event types for key in ['messagesBlocked', 'messagesDelivered']: for msg in data.get(key, []): for threat_info in msg.get('threatsInfoMap', []): tid = threat_info.get('threatID') if tid: threat_ids.add(tid) for key in ['clicksBlocked', 'clicksPermitted']: for click in data.get(key, []): tid = click.get('threatID') if tid: threat_ids.add(tid) event_count = sum( len(data.get(k, [])) for k in [ 'messagesBlocked', 'messagesDelivered', 'clicksBlocked', 'clicksPermitted', ] ) print( f"Interval {interval}: {event_count} events, " f"{len(threat_ids)} unique threats so far" ) except Exception as e: print(f"Error fetching SIEM events: {e}") current_start = current_end if len(threat_ids) >= MAX_THREATS: print(f"Reached max threats limit ({MAX_THREATS})") break return threat_ids def fetch_forensics_for_threats(threat_ids): """ Fetch forensic evidence for each threat ID from the Forensics API. Args: threat_ids: Set of threat ID strings Returns: List of forensic report dictionaries """ headers = { 'Authorization': get_auth_header(), 'Accept': 'application/json', 'User-Agent': 'GoogleSecOps-TAPForensicsCollector/1.0', } records = [] backoff = 1.0 processed = 0 skipped = 0 for threat_id in list(threat_ids)[:MAX_THREATS]: url = ( f"{API_BASE}/v2/forensics" f"?threatId={threat_id}" f"&includeCampaignForensics=true" ) try: response = http.request('GET', url, headers=headers) 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, 60.0) # Retry the same threat continue backoff = 1.0 if response.status == 204: skipped += 1 processed += 1 continue if response.status != 200: print( f"Forensics API error for {threat_id}: " f"HTTP {response.status}" ) skipped += 1 processed += 1 continue data = json.loads(response.data.decode('utf-8')) reports = data.get('reports', []) if reports: # Add the threat ID to each report for correlation for report in reports: report['_threatId'] = threat_id records.extend(reports) processed += 1 if processed % 50 == 0: print( f"Progress: {processed}/{len(threat_ids)} threats, " f"{len(records)} forensic reports collected" ) except Exception as e: print(f"Error fetching forensics for {threat_id}: {e}") skipped += 1 processed += 1 print( f"Forensics collection complete: {processed} threats processed, " f"{skipped} skipped, {len(records)} reports collected" ) return records2 つ目のファイル - requirements.txt:
functions-framework==3.* google-cloud-storage==2.* urllib3>=2.0.0
[デプロイ] をクリックして関数を保存し、デプロイします。
デプロイが完了するまで待ちます(2 ~ 3 分)。
Cloud Scheduler ジョブを作成する
Cloud Scheduler は、定期的に Pub/Sub トピックにメッセージをパブリッシュし、Cloud Run 関数をトリガーします。
- GCP Console で、[Cloud Scheduler] に移動します。
- [ジョブを作成] をクリックします。
次の構成情報を提供してください。
設定 値 名前 tap-forensics-collector-hourlyリージョン Cloud Run functions の関数と同じリージョンを選択します。 周波数 0 * * * *(1 時間ごと、毎正時)タイムゾーン タイムゾーンを選択(UTC を推奨) ターゲット タイプ Pub/Sub トピック トピック tap-forensics-collector-triggerを選択します。メッセージ本文 {}(空の JSON オブジェクト)[作成] をクリックします。
スケジュール頻度のオプション
ログの量とレイテンシの要件に基づいて頻度を選択します。
| 頻度 | CRON 式 | ユースケース |
|---|---|---|
| 15 分ごと | */15 * * * * |
多くの脅威が存在する大量の環境 |
| 1 時間ごと | 0 * * * * |
標準(推奨) |
| 6 時間ごと | 0 */6 * * * |
少量の環境 |
統合をテストする
- Cloud Scheduler コンソールで、ジョブを見つけます。
- [強制実行] をクリックして、ジョブを手動でトリガーします。
- 数秒待ちます。
- [Cloud Run] > [サービス] に移動します。
- 関数名
tap-forensics-collectorをクリックします。 - [ログ] タブをクリックします。
関数が正常に実行されたことを確認します。以下のものを探します。
Fetching threats from YYYY-MM-DDTHH:MM:SS+00:00 to YYYY-MM-DDTHH:MM:SS+00:00 Interval .../...: X events, Y unique threats so far Found Z unique threat IDs Forensics collection complete: Z threats processed, 0 skipped, N reports collected Wrote N records to gs://proofpoint-tap-forensics-logs/tap-forensics/tap_forensics_YYYYMMDD_HHMMSS.ndjson Successfully processed forensics for Z threats[Cloud Storage] > [バケット] に移動します。
バケット名をクリックします。
接頭辞フォルダ
tap-forensics/に移動します。現在のタイムスタンプで新しい
.ndjsonファイルが作成されたことを確認します。
ログにエラーが表示される場合:
- HTTP 401: 環境変数の TAP_PRINCIPAL と TAP_SECRET を確認します。サービス プリンシパルと Secret が正しいことを確認します。
- HTTP 403: TAP アカウントで API アクセスが有効になっていることを確認します。
- HTTP 429: レート制限 - 関数はバックオフを使用して自動的に再試行します。スケジュールの頻度を減らすことを検討してください。
- 脅威は見つかりませんでした: 期間内に脅威が検出されなかった場合は、これが正常な状態です。TAP は、URL Defense または Attachment Defense によって特定された脅威のみを報告します。
- 環境変数が設定されていない: 必要な変数がすべて設定されていることを確認します。
Proofpoint TAP Forensics のログを取り込むように Google SecOps でフィードを構成する
- [設定] > [データ管理] > [フィード] に移動します。SIEM のみのプラットフォームを使用している場合は、[設定] > [フィード] に移動します。
- [Add New Feed] をクリックします。
- [単一フィードを設定] をクリックします。
- [フィード名] フィールドに、フィードの名前を入力します(例:
Proofpoint TAP Forensics)。 - [Source type] として [Google Cloud Storage V2] を選択します。
- [ログタイプ] として [Proofpoint Tap Forensics] を選択します。
[サービス アカウントを取得する] をクリックします。一意のサービス アカウントのメールアドレスが表示されます。例:
chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.comこのメールアドレスをコピーして、次のステップで使用します。
[次へ] をクリックします。
次の入力パラメータの値を指定します。
ストレージ バケットの URL: 接頭辞パスを含む GCS バケット URI を入力します。
gs://proofpoint-tap-forensics-logs/tap-forensics/- 次のように置き換えます。
proofpoint-tap-forensics-logs: GCS バケット名。tap-forensics: ログが保存されるオプションの接頭辞 / フォルダパス(ルートの場合は空のままにします)。
- 次のように置き換えます。
Source deletion option: 必要に応じて削除オプションを選択します。
- なし: 転送後にファイルを削除しません(テストに推奨)。
- 転送されたファイルを削除する: 転送が完了した後にファイルを削除します。
- 転送されたファイルと空のディレクトリを削除する: 転送が成功した後にファイルと空のディレクトリを削除します。
ファイルの最長存続期間: 過去数日間に変更されたファイルを含めます(デフォルトは 180 日)。
Asset namespace: アセットの名前空間。
Ingestion labels: このフィードのイベントに適用されるラベル。
[次へ] をクリックします。
[Finalize] 画面で新しいフィードの設定を確認し、[送信] をクリックします。
Google SecOps サービス アカウントに IAM 権限を付与する
Google SecOps サービス アカウントには、GCS バケットに対する Storage オブジェクト閲覧者のロールが必要です。
- [Cloud Storage] > [バケット] に移動します。
- バケット名をクリックします。
- [権限] タブに移動します。
- [アクセス権を付与] をクリックします。
- 次の構成情報を指定します。
- プリンシパルを追加: Google SecOps サービス アカウントのメールアドレスを貼り付けます。
- ロールを割り当てる: [Storage オブジェクト閲覧者] を選択します。
[保存] をクリックします。
UDM マッピング テーブル
| ログフィールド | UDM マッピング | ロジック |
|---|---|---|
malicious_label |
additional.fields |
統合済み |
threat_type_label |
additional.fields |
統合済み |
generated |
metadata.event_timestamp |
ISO8601 として解析 |
has_principal |
metadata.event_type |
マッピング済み: true → STATUS_UPDATE |
protocol |
network.ip_protocol |
直接マッピングされます。 |
prin_ip |
principal.asset.ip |
統合済み |
domain |
principal.domain.name |
直接マッピングされます。 |
path |
principal.file.full_path |
直接マッピングされます。 |
file_hash_sha256 |
principal.file.sha256 |
直接マッピングされます。 |
prin_ip |
principal.ip |
統合済み |
port |
principal.port |
直接マッピングされます。 |
url |
principal.url |
直接マッピングされます。 |
_security_result |
security_result |
統合済み |
| なし | metadata.event_type |
定数: STATUS_UPDATE |
| なし | metadata.product_event_type |
定数: Forensic Reports |
| なし | metadata.product_name |
定数: TAP Forensics |
| なし | metadata.vendor_name |
定数: Proofpoint |
| なし | principal.asset.platform_software.platform |
定数: WINDOWS |
変更ログ
さらにサポートが必要な場合 コミュニティ メンバーや Google SecOps のプロフェッショナルから回答を得ることができます。