Fastly WAF ログを収集する
概要
このパーサーは、Fastly WAF JSON ログからフィールドを抽出し、変換して名前を変更し、UDM にマッピングします。さまざまなデータ型を処理し、重大度レベルを変換し、利用可能な IP 情報とホスト名情報に基づいてイベントを分類します。また、解析の失敗の可能性を処理し、形式が正しくないログエントリを削除します。
始める前に
次の前提条件を満たしていることを確認します。
- Google SecOps インスタンス。
- WAF 設定を構成する権限を持つ Fastly アカウント。
フィードを設定する
フィードを構成する手順は次のとおりです。
- [SIEM Settings] > [Feeds] に移動します。
- [Add New Feed] をクリックします。
- 次のページで [単一のフィードを設定] をクリックします。
- [Feed name] フィールドに、フィードの名前を入力します(例: Fastly WAF ログ)。
- [Source type] として [Webhook] を選択します。
- [Log type] として [Fastly WAF] を選択します。
- [次へ] をクリックします。
- 省略可: 次の入力パラメータの値を指定します。
- Split delimiter: ログ行を区切るために使用される区切り文字(\nなど)。
 
- Split delimiter: ログ行を区切るために使用される区切り文字(
- [次へ] をクリックします。
- [Finalize] 画面でフィードの設定を確認し、[Submit] をクリックします。
- [秘密鍵を生成する] をクリックして、このフィードを認証するためのシークレット キーを生成します。
- 秘密鍵をコピーして保存します。この秘密鍵を再び表示することはできません。必要に応じて、新しい秘密鍵を再生成できますが、この操作により以前の秘密鍵は無効になります。
- [詳細] タブで、[エンドポイント情報] フィールドから、フィードのエンドポイント URL をコピーします。このエンドポイント URL をクライアント アプリケーション内で指定する必要があります。
- [完了] をクリックします。
Webhook フィード用の API キーを作成する
- Google Cloud コンソール > [認証情報] に移動します。 
- [認証情報を作成] をクリックして [API キー] を選択します。 
- API キーのアクセスを Google Security Operations API に制限します。 
エンドポイント URL を指定する
- クライアント アプリケーション内で、Webhook フィードで提供される HTTPS エンドポイント URL を指定します。
- 次の形式でカスタム ヘッダーの一部として API キーと秘密鍵を指定して、認証を有効にします。 - X-goog-api-key = API_KEY X-Webhook-Access-Key = SECRET- 推奨事項: API キーは URL 内で指定するのではなくヘッダーとして指定してください。 
- Webhook クライアントがカスタム ヘッダーをサポートしていない場合は、次の形式のクエリ パラメータを使用して API キーと秘密鍵を指定できます。 - ENDPOINT_URL?key=API_KEY&secret=SECRET- 以下を置き換えます。 - ENDPOINT_URL: フィード エンドポイントの URL。
- API_KEY: Google Security Operations に対する認証に使用する API キー。
- SECRET: フィードの認証用に生成した秘密鍵。
 
Fastly で Webhook を構成する
- Fastly にログインします。
- 省略可: [Sites] メニューでサイトを選択します(サイトが複数ある場合)。
- [Manage] > [Site Integrations] を選択します。
- [Add site integration] をクリックします。
- [Generic Webhook] を選択します。
- Webhook URL: Google SecOps の ENDPOINT_URL の後に API_KEY と SECRET を入力します。
- Alert Placement: [All activity] または [Specific activity] を選択します。
- 省略可: [Specific activity] を選択した場合は、[Activity menu] に移動して、Webhook で送信するアクティビティ タイプを選択します。
- [Create site integration] をクリックします。
UDM マッピング テーブル
| ログフィールド | UDM マッピング | 論理 | 
|---|---|---|
| anomaly_score | security_result.detection_fields[].key: "anomaly"security_result.detection_fields[].value:anomaly_score | waf.score.anomalyが 0 または空で、anomaly_scoreが空でも 0 でもない場合、anomaly_score値を使用して、security_result.detection_fields配列に「anomaly」キーとanomaly_scoreフィールドの値が入力されます。 | 
| cache_status | additional.fields[].key: "cache_status"additional.fields[].value.string_value:cache_status | cache_status値を使用して、additional.fields配列に「cache_status」キーとcache_statusフィールドの値が入力されます。 | 
| client_ip | principal.ip:client_ip | client_ipフィールドはprincipal.ipにマッピングされます。 | 
| connection.fastly_is_edge | additional.fields[].key: "fastly_is_edge"additional.fields[].value.bool_value:connection.fastly_is_edge | connection.fastly_is_edge値を使用して、additional.fields配列に「fastly_is_edge」キーとconnection.fastly_is_edgeフィールドの値が入力されます。 | 
| connection.fastly_is_shield | additional.fields[].key: "fastly_is_shield"additional.fields[].value.bool_value:connection.fastly_is_shield | connection.fastly_is_shield値を使用して、additional.fields配列に「fastly_is_shield」キーとconnection.fastly_is_shieldフィールドの値が入力されます。 | 
| connection.request_tls_version | network.tls.version:connection.request_tls_version | connection.request_tls_versionフィールドはnetwork.tls.versionにマッピングされます。 | 
| fastly.server | target.hostname:fastly.server | fastly.serverフィールドはtarget.hostnameにマッピングされます。 | 
| fastly.service_id | additional.fields[].key: "service_id"additional.fields[].value.string_value:fastly.service_id | fastly.service_id値を使用して、additional.fields配列に「service_id」キーとfastly.service_idフィールドの値が入力されます。 | 
| geo.city | principal.location.city:geo.city | geo.cityフィールドはprincipal.location.cityにマッピングされます。 | 
| geo.country | principal.location.country_or_region:geo.country | geo.countryフィールドはprincipal.location.country_or_regionにマッピングされます。 | 
| geo.location | principal.location.region_latitude:geo.locationから抽出principal.location.region_longitude:geo.locationから抽出 | 緯度と経度は、正規表現を使用して geo.locationフィールドから抽出され、それぞれprincipal.location.region_latitudeとprincipal.location.region_longitudeにマッピングされます。 | 
| geo.region | principal.location.state:geo.region | geo.regionフィールドはprincipal.location.stateにマッピングされます。 | 
| host | principal.hostname:host | hostフィールドはprincipal.hostnameにマッピングされます。 | 
| request_headers.accept_charset | additional.fields[].key: "accept_charset"additional.fields[].value.string_value:request_headers.accept_charset | request_headers.accept_charset値を使用して、additional.fields配列に「accept_charset」キーとrequest_headers.accept_charsetフィールドの値が入力されます。 | 
| request_headers.accept_language | additional.fields[].key: "accept_language"additional.fields[].value.string_value:request_headers.accept_language | request_headers.accept_language値を使用して、additional.fields配列に「accept_language」キーとrequest_headers.accept_languageフィールドの値が入力されます。 | 
| request_headers.referer | network.http.referral_url:request_headers.referer | request_headers.refererフィールドはnetwork.http.referral_urlにマッピングされます。 | 
| request_headers.user_agent | network.http.user_agent:request_headers.user_agent | request_headers.user_agentフィールドはnetwork.http.user_agentにマッピングされます。 | 
| request_id | metadata.product_log_id:request_id | request_idフィールドはmetadata.product_log_idにマッピングされます。 | 
| request_method | network.http.method:request_method | request_methodフィールドはnetwork.http.methodにマッピングされます。 | 
| response_headers.cache_control | additional.fields[].key: "cache_control"additional.fields[].value.string_value:response_headers.cache_control | response_headers.cache_control値を使用して、additional.fields配列に「cache_control」キーとresponse_headers.cache_controlフィールドの値が入力されます。 | 
| response_headers.content_type | additional.fields[].key: "content_type"additional.fields[].value.string_value:response_headers.content_type | response_headers.content_type値を使用して、additional.fields配列に「content_type」キーとresponse_headers.content_typeフィールドの値が入力されます。 | 
| response_state | additional.fields[].key: "response_state"additional.fields[].value.string_value:response_state | response_state値を使用して、additional.fields配列に「response_state」キーとresponse_stateフィールドの値が入力されます。 | 
| response_status | network.http.response_code:response_status | statusフィールドが空の場合、response_statusフィールドはnetwork.http.response_codeにマッピングされます。 | 
| rule_id | security_result.rule_id:rule_id | waf.rule_idが空の場合、rule_id値を使用してsecurity_result.rule_idが入力されます。 | 
| severity | waf.severity:severity | severityフィールドの値はwaf.severityにコピーされます。 | 
| size_bytes.request_header | network.sent_bytes:size_bytes.request_header | size_bytes.request_headerフィールドはnetwork.sent_bytesにマッピングされます。 | 
| size_bytes.response_header | network.received_bytes:size_bytes.response_header | size_bytes.response_headerフィールドはnetwork.received_bytesにマッピングされます。 | 
| status | network.http.response_code:status | statusフィールドはnetwork.http.response_codeにマッピングされます。 | 
| timestamp | metadata.event_timestamp:timestamp | timestampフィールドが解析され、metadata.event_timestampにマッピングされます。 | 
| url | target.url:url | urlフィールドはtarget.urlにマッピングされます。 | 
| waf.blocked | security_result.action: derived | waf.blockedが false の場合、security_result.actionは「ALLOW」に設定されます。waf.blockedが true の場合、security_result.actionは「BLOCK」に設定されます。 | 
| waf.executed | security_result.detection_fields[].key: "executed"security_result.detection_fields[].value:waf.executed | waf.executed値を使用して、security_result.detection_fields配列に「executed」キーとwaf.executedフィールドの値が入力されます。 | 
| waf.failures | security_result.detection_fields[].key: "failures"security_result.detection_fields[].value:waf.failures | waf.failures値を使用して、security_result.detection_fields配列に「failures」キーとwaf.failuresフィールドの値が入力されます。 | 
| waf.logged | security_result.detection_fields[].key: "logged"security_result.detection_fields[].value:waf.logged | waf.logged値を使用して、security_result.detection_fields配列に「logged」キーとwaf.loggedフィールドの値が入力されます。 | 
| waf.message | metadata.description:waf.message | waf.messageが空でない場合、metadata.descriptionにマッピングされます。 | 
| waf.rule_id | security_result.rule_id:waf.rule_id | waf.rule_idが空でない場合、security_result.rule_idにマッピングされます。 | 
| waf.score.anomaly | security_result.detection_fields[].key: "anomaly"security_result.detection_fields[].value:waf.score.anomaly | waf.score.anomalyが 0 でも空でもない場合、その値を使用して、security_result.detection_fields配列に「anomaly」キーとwaf.score.anomalyフィールドの値が入力されます。 | 
| waf.score.http_violation | security_result.detection_fields[].key: "http_violation"security_result.detection_fields[].value:waf.score.http_violation | waf.score.http_violationが 0 でも空でもない場合、その値を使用してsecurity_result.detection_fields配列が入力されます。 | 
| waf.score.lfi | security_result.detection_fields[].key: "lfi"security_result.detection_fields[].value:waf.score.lfi | waf.score.http_violationと同様のロジック。 | 
| waf.score.php_injection | security_result.detection_fields[].key: "php_injection"security_result.detection_fields[].value:waf.score.php_injection | waf.score.http_violationと同様のロジック。 | 
| waf.score.rce | security_result.detection_fields[].key: "rce"security_result.detection_fields[].value:waf.score.rce | waf.score.http_violationと同様のロジック。 | 
| waf.score.rfi | security_result.detection_fields[].key: "rfi"security_result.detection_fields[].value:waf.score.rfi | waf.score.http_violationと同様のロジック。 | 
| waf.score.session_fixation | security_result.detection_fields[].key: "session_fixation"security_result.detection_fields[].value:waf.score.session_fixation | waf.score.http_violationと同様のロジック。 | 
| waf.score.sql_injection | security_result.detection_fields[].key: "sql_injection"security_result.detection_fields[].value:waf.score.sql_injection | waf.score.http_violationと同様のロジック。 | 
| waf.score.xss | security_result.detection_fields[].key: "xss"security_result.detection_fields[].value:waf.score.xss | waf.score.http_violationと同様のロジック。 | 
| waf.severity | security_result.severity: derivedsecurity_result.severity_details:waf.severity | waf.severityが空でない場合、範囲(3 以下: 高、3~6: 中、6~8: 低、それ以外: UNKNOWN_SEVERITY)に基づいてsecurity_result.severityの値が決定されます。元のwaf.severity値もsecurity_result.severity_detailsにマッピングされます。 | 
| waf_message | metadata.description:waf_message | waf.messageが空で、waf_messageが空でない場合、metadata.descriptionにマッピングされます。client_ipまたはhostとfastly.serverが空でない場合、metadata.event_typeは「NETWORK_HTTP」に設定されます。それ以外の場合、client_ipまたはhostが空でない場合は、metadata.event_typeが「STATUS_UPDATE」に設定されます。それ以外の場合は、「GENERIC_EVENT」に設定されます。ハードコードされた値。ハードコードされた値。ハードコードされた値。 | 
さらにサポートが必要な場合 コミュニティ メンバーや Google SecOps のプロフェッショナルから回答を得ることができます。