通知のフィルタリング

このページでは、Security Command Center API の通知機能で使用できるフィルタの例と、Pub/Sub または BigQuery にエクスポートするメッセージについて説明します。次のいずれかの検出結果のフィールドで通知を絞り込むことができます。

  • parent
  • state
  • resource_name
  • category
  • source_properties
  • security_marks

フィルタ文字列の一部として、次の標準的な演算子を使用することもできます。

  • AND: 一連の値をすべて含むフィールドを含める
  • OR: 一連の値のいずれかを含むフィールドを含める
  • -: 特定の値を含むフィールドを除外する
  • かっこ: 一連の値をグループ化する。例:

    (category = \"BUCKET_LOGGING_DISABLED\" OR category = \"CLUSTER_LOGGING_DISABLED\") AND state = \"ACTIVE\"

ソースフィルタの設定

Security Command Center でのすべての検出結果には、セキュリティ ソース プロバイダのソース ID が含まれています。たとえば、Security Health Analytics での検出結果には、Security Health Analytics に固有のソース ID が含まれています。ソース ID は、通知 Pub/Sub トピックまたは BigQuery データセットに送信するプロバイダの検出結果を指定する NotificationConfig フィルタで使用されます。

手順 1: ソース ID を取得する

Google Cloud Console または Google Cloud CLI を使用して、プロバイダのソース ID を取得します。

コンソール

  1. Google Cloud コンソールで Security Command Center の [検出結果] ページに移動します。
    [検出結果] ページに移動
  2. 通知フィルタを作成する組織を選択します。[検出結果] ページが開きます。
  3. [クイック フィルタ] パネルで、[ソースの表示名] セクションまで下にスクロールし、通知結果のフィルタリングに使用するプロバイダの名前を選択します。
  4. [検出結果クエリの結果] パネルの [カテゴリ] 列で、いずれかの検出結果の名前をクリックして検出結果の詳細パネルを表示します。
  5. 検出結果の詳細パネルで、[JSON] タブをクリックします。検出結果の完全な JSON が表示されます。
  6. JSON で、parent 属性の値をコピーします。次に例を示します。

    "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID"

    ID は次のように表されます。

    • ORGANIZATION_ID: 親ソース プロバイダの組織の ID。
    • SOURCE_ID: 親ソース プロバイダの ID。

gcloud

ソース ID を取得するには、次のコマンドを実行します。

  gcloud scc sources describe ORGANIZATION_ID --source-display-name="SOURCE_NAME"

次のように置き換えます。

  • ORGANIZATION_ID: 組織の ID。
  • SOURCE_NAME: ソース ID を取得するサービスの名前。Security Command Center の組み込みサービス、Security Health Analytics、Web Security Scanner、Event Threat Detection、Container Threat Detection など、検出プロバイダの名前を使用します。

gcloud CLI コマンドの出力は次のようになり、ソース ID が含まれます。

  {
   "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
   "displayName": "example-source",
   "description": "A source that creates findings."
  }

次に、組織 ID とソース ID を使用して、通知フィルタを作成します。

手順 2: フィルタを作成する

通知フィルタを作成するには、新しい NotificationConfig作成します。

NotificationConfig ファイルにフィルタを追加して、特定のソースを含めるか、ソースから除外できます。

  • 検出結果をフィルタして、指定したソースからの通知のみを送信します。

      state = \"ACTIVE\" AND parent = \"organizations/$ORGANIZATION_ID/sources/$SOURCE_ID\"
    
  • 検出結果をフィルタして、指定したソースを除くすべてのソースから通知を送信します。

      state = \"ACTIVE\" AND -parent = \"organizations/$ORGANIZATION_ID/sources/$SOURCE_ID\"
    

使用できるフィルタのその他の例については、Security Command Center API を使用してセキュリティの検出結果を一覧表示するをご覧ください。

Pub/Sub トピックを使用する場合のカテゴリや状態による検出結果のフィルタリング

次のセクションでは、特定のソースと検出タイプのフィルタを作成する方法と、Pub/Sub トピックに送信する通知メッセージの例を示します。

Pub/Sub トピックの代わりに BigQuery データセットを使用する場合は、検出結果と関連フィールドについて、分析のために検出結果を BigQuery にエクスポートするをご覧ください。

Security Health Analytics

この Security Health Analytics の例では、次のフィルタを使用しています。

category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"

Security Health Analytics によって作成される検出結果の種類の詳細については、Security Health Analytics の検出ページをご覧ください。

Security Health Analytics でフィルタされた検出通知の Pub/Sub メッセージは次のようになります。

{
   "notificationConfigName": "organizations/ORGANIZATION_ID/notificationConfigs/security-health-analytics-active-findings",
   "finding": {
     "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
     "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
     "resourceName": "//compute.googleapis.com/projects/PROJECT_ID/global/firewalls/,
     "state": "ACTIVE",
     "category": "OPEN_FIREWALL",
     "externalUri": "https://console.cloud.google.com/networking/firewalls/details/default-allow-icmp?project\u003PROJECT_ID",
     "sourceProperties": {
       "ReactivationCount": 0.0,
       "Allowed": "[{\"ipProtocol\":\"icmp\"}]",
       "WhitelistInstructions": "Add the security mark \"allow_open_firewall_rule\" to the asset with a value of \"true\" to prevent this finding from being activated again.",
       "Recommendation": "Restrict the firewall rules at: https://console.cloud.google.com/networking/firewalls/details/default-allow-icmp?project\u003PROJECT_ID",
       "AllowedIpRange": "All",
       "ActivationTrigger": "Allows all IP addresses",
       "SourceRange": "[\"0.0.0.0/0\"]",
       "ScanRunId": "2019-04-06T08:50:58.832-07:00",
       "SeverityLevel": "High",
       "ProjectId": "PROJECT_ID",
       "AssetCreationTime": "2019-03-28t17:58:54.409-07:00",
       "ScannerName": "FIREWALL_SCANNER",
       "Explanation": "Firewall rules that allow connections from all IP addresses or on all ports may expose resources to attackers."
     },
     "securityMarks": {
       "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks",
       "marks": {
         "sccquery152cd5aa66ea4bc8a672d8186a125580": "true",
         "sccquerya3cf2270123f4e91b84a3e613d2cac67": "true"
       }
     },
     "eventTime": "2019-09-22T21:26:57.189Z",
     "createTime": "2019-03-29T15:51:26.435Z"
   }
 }

異常検出

この異常検出に関する通知の例では、次のフィルタを使用しています。

category = \"resource_involved_in_coin_mining\" AND state = \"ACTIVE\"

異常検出によって作成される検出結果の種類については、脆弱性と脅威の表示のページをご覧ください。

異常検出でフィルタされた検出通知の Pub/Sub メッセージは次のようになります。

{
   "notificationConfigName": "organizations/ORGANIZATION_ID/notificationConfigs/cloud-anomaly-detection-active-findings",
   "finding": {
     "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
     "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
     "resourceName": "//cloudresourcemanager.googleapis.com/projects/PROJECT_ID",
     "state": "ACTIVE",
     "category": "resource_involved_in_coin_mining",
     "sourceProperties": {
       "vm_ips": "35.231.191.191",
       "end_time_usec": "1569003180000000",
       "abuse_target_ips": "54.38.176.231",
       "end_datetime_UTC": "2019-09-20 18:13:00 UTC",
       "urls": "swap2.luckypool.io, bitcash.luckypool.io",
       "vm_host_and_zone_names": "ubuntu-1804-tp100-gminer:us-east1-b",
       "finding_type": "Abuse originating from a resource in your organization.",
       "start_time_usec": "1569002700000000",
       "action_taken": "Notification sent",
       "summary_message": "We have recently detected activity on your Google Cloud Platform/APIs project that violates our Terms of Service or Acceptable Use Policy.",
       "start_datetime_UTC": "2019-09-20 18:05:00 UTC"
     },
     "securityMarks": {
       "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks",
       "marks": {                                                                                                                                                                                             "triage": "required",
         "teste123": "true",
         "sccquery94c23b35ea0b4f8388268415a0dc6c1b": "true"
       }
     },
     "eventTime": "2019-09-20T18:59:00Z",
     "createTime": "2019-05-16T14:16:35.674Z"
   }
 }

Event Threat Detection

Event Threat Detection の例では、次のフィルタを使用しています。

category = \"Persistence: Iam Anomalous Grant\" AND state = \"ACTIVE\"

Event Threat Detection によって作成される検出結果の種類については、脆弱性と脅威の表示のページをご覧ください。

Event Threat Detection でフィルタされた検出通知の Pub/Sub メッセージは次のようになります。

{
  "notificationConfigName": "organizations/ORGANIZATION_ID/notificationConfigs/event-threat-detection-active-findings",
  "finding": {
    "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
    "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
    "resourceName": "//cloudresourcemanager.googleapis.com/organizations/ORGANIZATION_ID",
    "state": "ACTIVE",
    "category": "Persistence: IAM Anomalous Grant",
    "sourceProperties": {
      "sourceId": {
        "organizationNumber": "ORGANIZATION_ID",
        "customerOrganizationNumber": "ORGANIZATION_ID"
      },
      "detectionCategory": {
        "technique": "persistence",
        "indicator": "audit_log",
        "ruleName": "iam_anomalous_grant",
        "subRuleName": "external_member_added_to_policy"
      },
      "detectionPriority": "HIGH",
      "evidence": [{
        "sourceLogId": {
          "timestamp": {
            "seconds": "1601066317",
            "nanos": 4.63E8
          },
          "insertId": "INSERT_ID"
        }
      }],
      "properties": {
        "sensitiveRoleGrant": {
          "principalEmail": "PRINCIPAL_EMAIL@gmail.com",
          "bindingDeltas": [{
            "action": "ADD",
            "role": "roles/owner",
            "member": "user:USER_EMAIL@gmail.com"
          }, {
            "action": "REMOVE",
            "role": "roles/viewer",
            "member": "user:USER_EMAIL@gmail.com"
          }],
          "members": ["USER_EMAIL@gmail.com"]
        }
      },
      "findingId": "FINDING_ID"
    },
    "securityMarks": {
      "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks"
    },
    "eventTime": "2020-09-25T20:38:39.441Z",
    "createTime": "2020-09-25T20:38:40.667Z"
  }
}

Forseti Security

この Forseti の例では、次のフィルタを使用しています。

category = \"FIREWALL_BLACKLIST_VIOLATION\" AND state = \"ACTIVE\"

Forseti によって作成される検出結果の種類については、Forseti のウェブサイトをご覧ください)。

Forseti でフィルタされた検出通知の Pub/Sub メッセージは次のようになります。

{
  "notificationConfigName": "organizations/ORGANIZATION_ID/notificationConfigs/forseti-firewall-denylist-active-findings",
  "finding": {
    "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
    "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
    "resourceName": "organization/ORGANIZATION_ID/project/PROJECT_ID/firewall/firewall-id/",
    "state": "ACTIVE",
    "category": "FIREWALL_BLACKLIST_VIOLATION",
    "sourceProperties": {
      "scanner_index_id": 6554388765422,
      "resource_id": "PROJECT_ID",
      "db_source": "table:violations/id:10127",
      "inventory_index_id": 1569189610158079,
      "resource_type": "firewall",
      "rule_index": 1,
      "source": "FORSETI",
      "resource_data": "{\"allowed\": [{\"IPProtocol\": \"ah\"}, {\"IPProtocol\": \"esp\"}, {\"IPProtocol\": \"icmp\"}, {\"IPProtocol\": \"sctp\"}, {\"IPProtocol\": \"tcp\"}, {\"IPProtocol\": \"udp\"}], \"direction\": \"INGRESS\", \"name\": \"gke-range-cluster-890sad\", \"network\": \"https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/default\", \"priority\": 1000, \"sourceRanges\": [\"10.48.0.0/14\"], \"targetTags\": [\"gke-firing-range-cluster-73d1fcce-node\"]}",
      "rule_name": "disallow_all_ports",
      "violation_data": "{\"policy_names\": [\"gke-range-cluster-890sad\"], \"recommended_actions\": {\"DELETE_FIREWALL_RULES\": [\"gke-range-cluster-890sad\"]}}"
    },
    "securityMarks": {
      "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks",
      "marks": {
        "priority": "p1"
      }
    },
    "eventTime": "2019-09-22T22:03:58Z",
    "createTime": "2019-08-14T02:19:58.218Z"
  }
}

機密データの保護

この機密データの保護の例では、次のフィルタを使用します。

category = \"CREDIT_CARD_NUMBER\" AND state = \"ACTIVE\"

Event Threat Detection によって作成される検出結果の種類については、脆弱性と脅威の表示のページをご覧ください。

機密データの保護でフィルタされた検出通知の Pub/Sub メッセージは次のようになります。

{
   "notificationConfigName": "organizations/ORGANIZATION_ID/notificationConfigs/dlp-data-discovery-active-findings",
   "finding": {
     "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
     "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
     "resourceName": "//cloudresourcemanager.googleapis.com/projects/PROJECT_ID",
     "state": "ACTIVE",
     "category": "CREDIT_CARD_NUMBER",
     "externalUri": "https://console.cloud.google.com/dlp/projects/PROJECT_ID/dlpJobs/i-7536622736814356939;source\u003d5",
     "sourceProperties": {
       "COUNT": 2.0,
       "JOB_NAME": "projects/PROJECT_ID/dlpJobs/i-7536622736814356939",
       "FULL_SCAN": false
     },
     "securityMarks": {
       "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks",
       "marks": {
         "priority": "p1",
         "sccquerya3cf2270123f4e91b84a3e613d2cac67": "true"
       }
     },
     "eventTime": "2019-09-16T23:21:19.650Z",
     "createTime": "2019-04-22T23:18:17.731Z"
   }
 }

次のステップ