Security Command Center の検出結果では、組織のアセットの潜在的なセキュリティ リスクがモデル化されます。検出結果は常に Security Command Center の特定のアセットに関連付けられます。
このガイドでは、Security Command Center クライアント ライブラリを使用して組織の検出結果にアクセスする方法について説明します。各検出結果は 1 つのソースに属します。ほとんどの検出項目または検索プロバイダで、同じソースの検出結果が生成されます。
始める前に
ソースを設定する前に、以下の手順を完了しておく必要があります。
ページサイズ
Security Command Center の list API はすべてページ分けされています。各レスポンスは結果のページと、次のページを返すトークンを返します。ページサイズは構成可能です。デフォルトの pageSize は 10 で、最小値は 1、最大値は 1,000 に設定可能です。
検出結果の保持
検出結果には、スキャン中に関連する脆弱性や脅威が発見されるたびに、検出の状態とプロパティをキャプチャした一連の event_time
スナップショットが含まれています。
Security Command Center は、event_time
またはイベントが発生した時刻から 13 か月間の検出結果のスナップショットを格納します。13 か月後、検出結果のスナップショットとそれらのデータは Security Command Center データベースから削除され、復元できなくなります。これにより、検出結果のスナップショットが削減され、検出結果の履歴と時系列変化を表示する機能が制限されます。
13 か月以内の event_time
のスナップショットが少なくとも 1 つ含まれている限り、検出結果は Security Command Center に残ります。検出結果とそのデータのすべてをより長期間保持するには、別のストレージの場所にエクスポートします。手順については、Security Command Center データのエクスポートをご覧ください。
組織内のすべての検出結果の一覧表示
gcloud
# ORGANIZATION_ID=organization-id gcloud scc findings list $ORGANIZATION_ID
他の例については、次のコマンドを実行します。
gcloud scc findings list --help
Python
Java
Go
Node.js
各検出結果の出力は次のようになります。
finding:
category: 'Persistence: IAM Anomalous Grant'
createTime: '2020-09-13T12:30:10.248Z'
eventTime: '2020-09-13T12:30:09.528Z'
name: organizations/organization-id/sources/source-id/findings/finding-id
parent: organizations/organization-id/sources/source-id
resourceName: //cloudresourcemanager.googleapis.com/projects/project-number
securityMarks:
name: organizations/organization-id/sources/source-id/findings/finding-id/securityMarks
sourceProperties:
affectedResources:
- gcpResourceName: //cloudresourcemanager.googleapis.com/projects/project-number
detectionCategory:
indicator: audit_log
ruleName: iam_anomalous_grant
subRuleName: service_account_granted_sensitive_role_to_member
technique: persistence
detectionPriority: HIGH
evidence:
- sourceLogId:
insertId: insert-id
projectId: project-id
timestamp:
nanos: 183000000
seconds: '1600000206'
findingId: finding-id
properties:
sensitiveRoleGrant:
bindingDeltas:
- action: ADD
member: user:user-email@gmail.com
role: roles/editor
members:
- user:user-email@gmail.com
principalEmail: principal-email.iam.gserviceaccount.com
sourceId:
customerOrganizationNumber: 'organization-id'
projectNumber: 'project-number'
state: ACTIVE
resource:
name: //cloudresourcemanager.googleapis.com/projects/project-number
parentDisplayName: organization-name
parentName: //cloudresourcemanager.googleapis.com/folders/folder-id
projectDisplayName: project-id
projectName: //cloudresourcemanager.googleapis.com/projects/project-number
検出結果のフィルタリング
組織には検出結果が多数含まれている可能性があります。上記の例ではフィルタが使用されていないため、すべての検出レコードが返されます。Security Command Center を使用すると、検出フィルタを使用して必要な検出結果の情報のみを取得し、親を特定のソースに限定できます。
検出フィルタは、SQL ステートメントの「WHERE」句に似ていますが、列の代わりに API によって返されるオブジェクトに適用されます。
カテゴリ「MEDIUM_RISK_ONE
」を含む検出結果のみを一覧表示する例を以下に示します。特定のカテゴリが変更される可能性があるため、検出プロバイダのドキュメントを参照して、使用するカテゴリを決定する必要があります。
gcloud
# ORGANIZATION_ID=organization-id # SOURCE_ID="source-id" FILTER="category=\"MEDIUM_RISK_ONE\"" gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID --filter="$FILTER"
他の例については、次のコマンドを実行します。
gcloud scc findings list --help
Python
Java
Go
Node.js
Security Command Center では、潜在的なプロパティ タイプとして完全な JSON 配列とオブジェクトもサポートされています。以下に基づいてフィルタできます。
- 配列の要素
- オブジェクト内で文字列が部分的に一致する完全な JSON オブジェクト
- JSON オブジェクトのサブフィールド
サブフィールドは数値、文字列、ブール値にする必要があり、次の演算子を使用する必要があります。
- 文字列:
- 完全な等式:
=
:
に一致する部分文字列
- 完全な等式:
- 数字:
- 不等式
<
、>
、<=
、>=
- 等式
=
- 不等式
- ブール値:
- 等式
=
- 等式
このページの後の例では、次の JSON オブジェクトが、検出のソース プロパティであることを前提としています。
{
"outer_object": {
"middle_object": {
"deeply_nested_object": {
"x": 123,
},
"y": "some-string-value",
},
"z": "some-other-string-value",
"u": ["list-element-1", "list-element-2", "list-element-3", ],
},
}
検出結果のフィルタリングの例
この例では、前の JSON オブジェクトは検出の my_property
というソース プロパティです。次の例には、オブジェクトをプロパティとして持つ検出結果に対するクエリが含まれています。また、クエリで AND
と OR
を使用して他のフィルタとともに、これらのフィルタを使用することもできます。
# ORGANIZATION_ID=organization-id
# SOURCE_ID="source-id"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.middle_object.deeply_nested_object.x = 123"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.middle_object.y = \"some-string-value\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.middle_object.y : \"string-value\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.z = \"some-other-string-value\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.z : \"other-string-value\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.u : \"list-element-1\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.u : \"list-element-2\""
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--filter="source_properties.my_property.outer_object.u : \"list-element-3\""
検出結果の並べ替えの例
検出結果は、文字列、数値、ブール値などのプリミティブ型の厳格なサブフィールドで並べ替えることが可能です。この例では、前の JSON オブジェクトは検出の my_property
というソース プロパティです。次の例では、検出結果フィールドを並べ替えるクエリを示します。
# ORGANIZATION_ID=organization-id
# SOURCE_ID="source-id"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.middle_object.deeply_nested_object.x DESC"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.middle_object.deeply_nested_object.x"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.middle_object.y DESC"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.middle_object.y"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.z DESC"
gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID \
--order-by="source_properties.my_property.outer_object.z"
ポイントインタイム クエリ
Security Command Center を使用すると、特定のスナップショット時間の検出結果を最大で 13 か月前まで遡って一覧表示できます。詳細については、検出結果の保持をご覧ください。
gcloud
# ORGANIZATION_ID=organization-id # SOURCE_ID="source-id" # READ_TIME follows the format YYYY-MM-DDThh:mm:ss.ffffffZ READ_TIME=2019-02-28T07:00:06.861Z gcloud scc findings list $ORGANIZATION_ID --source=$SOURCE_ID --read-time=$READ_TIME
他の例については、次のコマンドを実行します。
gcloud scc findings list --help
Python
Java
Go
Node.js
フィルタの例
次に、便利な検出フィルタをいくつか紹介します。
ポイントインタイムの後に発生する検出結果
これらのサンプル フィルタは、2019 年 6 月 5 日水曜日の、午後 10 時 12 分 5 秒(GMT)後に直近で発生した検出と一致します。event_time
フィルタを使用すると、次の形式とタイプを使用して時間を表すことができます。
整数リテラルとしての Unix 時間(ミリ秒単位)
"event_time > 1559772725000"
文字列リテラルとしての RFC 3339
"event_time > \"2019-06-05T22:34:40+00:00\""