このページでは、セキュリティ ポスチャーのポリシーを定義するために作成する posture.yaml
ファイルの Key-Value ペアの概要について説明します。体制 YAML ファイルを作成して環境にデプロイするには、セキュリティ体制の管理をご覧ください。
Posture YAML ファイル構造
体制は、次の構造を持つ YAML ファイルです。
name: posture_name
state: posture_state
description: posture_description
policy_sets:
- policy_set_id: policy_set_ID
- description: policy_set_description
policies:
- policy_id: policy_id
compliance_standards:
- standard: policy_standards
- control: policy_control
- description: policy_description
# Definition for a organization policy
constraint:
org_policy_constraint:
canned_constraint_id: constraint_ID
policy_rules:
- org_policy_kind: org_policy_kind_value
- condition:
expression: org_policy_expression
title: org_policy_title
description: org_policy_description
location: org_policy_location
# Definition for a custom organization policy constraint
constraint:
org_policy_constraint_custom:
custom_constraint:
name: custom_org_constraint_name
resource_types: custom_org_resource_type
method_types: custom_org_method_type
condition: custom_org_condition
action_type: custom_org_action_type
display_name: custom_org_constraint_display_name
description: custom_org_constraint_description
policy_rules:
- org_policy_kind: org_policy_kind_value
- condition:
expression: org_policy_expression
title: org_policy_title
description: org_policy_description
location: org_policy_location
# Definition for a Security Health Analytics detector
constraint:
security_health_analytics_module:
module_name: sha_detector_name
module_enablement_state: sha_detector_enabled
# Definition for a custom Security Health Analytics detector
constraint:
security_health_analytics_custom_module:
display_name: sha_custom_detector_name
config:
predicate:
expression: sha_custom_detector_expression
title: sha_custom_detector_predicate_title
description: sha_custom_detector_predicate_description
location: sha_custom_detector_predicate_location
- custom_output:
- property:
name: sha_custom_detector_output_name
value_expression:
expression: sha_custom_detector_output_expression
title: sha_custom_detector_output_title
description: sha_custom_detector_output_description
location: sha_custom_detector_output_location
resource_selector:
- resource_types: sha_custom_detector_resource
severity: sha_custom_severity_level
description: sha_custom_detector_description
recommendation: sha_custom_detector_recommendation
module_enablement_state: sha_detector_enabled
Key-Value ペアの説明
次の表に、posture.yaml
ファイル内の Key-Value ペアの説明を示します。
Key-Value ペア | 説明 |
---|---|
name: posture_name |
体制名(文字で始まる)。この値はオプションです。gcloud scc postures create コマンドを実行するときに体制名を指定します。 |
state: posture_state |
ACTIVE 、DRAFT 、DEPRECATED に設定できる列挙型。体制状態の詳細については、体制の状態を変更するをご覧ください。 |
description: posture_description |
ポリシーの説明。この値はオプションです。 |
policy_set_id: policy_set_ID |
体制ファイル内で設定されたポリシーの一意の識別子。体制ファイルには、複数のポリシーセットを含めることができます。 |
description: policy_set_description |
ポリシーセットの説明。この値はオプションです。 |
policy_id: policy_id |
ポリシーセット内のポリシーの一意の識別子。ポリシーセットには複数のポリシーを含めることができます。 |
standard: policy_compliance_standard |
このポリシーでサポートされるコンプライアンス標準の名前。 |
control: policy_compliance_control |
このポリシーでサポートされるコンプライアンス標準内の特定の管理機能。 |
description: policy_compliance_description |
このポリシーでサポートされるコンプライアンス基準の説明。 |
canned_constraint_id: constraint_ID |
組織のポリシーの制約の名前。例: cloudbuild.allowedWorkerPools 。constraint_ID に接頭辞 constraints/ は含めないでください。 |
org_policy_kind |
リスト形式の組織ポリシーの値は、allow_all 、deny_all 、allowed_values 、denied_values です。ブール値の組織のポリシーの値は enforce です。 |
org_policy_kind_value |
allow_all 、deny_all 、enforce の種類の値は、true または false です。allowed_values と denied_values の種類の値はそれぞれ、許可される値または拒否される値のリストです。 |
condition: |
このルールをポリシーの評価で使用するかどうかを決定する条件。設定する場合、Expr の expression フィールドには、 || または && 演算子で結合された 1 ~ 10 個のサブ式を含める必要があります。各サブ式は resource.matchTag('ORG_ID/tag_key_short_name, 'tag_value_short_name') または resource.matchTagId('tagKeys/key_id', 'tagValues/value_id') の形式にする必要があります。ここで、key_name と value_name はラベルキーと値のリソース名です。これらの名前は、タグ マネージャー サービスから取得できます。式の例: resource.matchTag('123456789/environment, 'prod') または resource.matchTagId('tagKeys/123', 'tagValues/456') 。 |
expression: org_policy_expression |
Common Expression Language 構文による式のテキスト表現。この値はオプションです。 |
title: org_policy_title |
式の目的の説明。この値はオプションです。 |
description: org_policy_description |
式の説明。この値はオプションです。 |
location: org_policy_location |
エラーを報告する式の場所を示す文字列。たとえば、ファイル名とファイル内の位置を指定します。この値はオプションです。 |
name: custom_org_constraint_name |
カスタム制約の名前(organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME 形式)。たとえば、organizations/3589215982/customConstraints/custom.disableGkeAutoUpgrade のようにします。CONSTRAINT_NAME は 62 文字以下にする必要があります。接頭辞 organizations/{organization_id}/customConstraints/custom はカウントされません。対策ファイルでカスタム制約を定義すると、新しいカスタム制約が作成されます。 |
resource_types: custom_org_resource_type |
制限するオブジェクトとフィールドを含む Google Cloud REST リソースの完全修飾名。リソースタイプごとに最大 20 個のカスタム制約があります。 |
method_types: custom_org_method_type |
制約を適用する RESTful メソッドのリスト。 |
condition: custom_org_condition |
サポートされているサービス リソースを参照する CEL 条件。このフィールドの最大長は 1,000 文字です。 |
action_type: custom_org_action_type |
条件が満たされている場合に実行するアクション |
display_name: custom_org_constraint_display_name |
制約の名前。わかりやすい名前を入力してください。 このフィールドの最大長は 200 文字です。 |
description: custom_org_constraint_description |
ポリシー違反時にエラー メッセージとして表示される制約の説明。このフィールドの最大長は 2,000 文字です。 |
module_name: sha_detector_name |
Security Health Analytics 検出機能の名前。たとえば、BIGQUERY_TABLE_CMEK_DISABLED のようにします。 |
module_enablement_state: sha_detector_enabled |
Security Health Analytics 検出機能が有効になっているかどうか。ENABLED または DISABLED のいずれか。 |
display_name: sha_custom_detector_name |
Security Health Analytics のカスタム モジュールの名前。名前は 1~128 文字で、先頭は英小文字にします。それ以降は、英数字とアンダースコアのみを使用してください。 |
expression: sha_custom_detector_expression |
スキャンするリソースタイプのプロパティを確認する CEL 式。 |
title: sha_custom_detector_predicate_title |
Security Health Analytics のカスタム モジュールの述語プロパティの名前。 |
description: sha_custom_detector_predicate_description |
Security Health Analytics のカスタム モジュールの述語プロパティの説明。 |
location: sha_custom_detector_predicate_location |
述語プロパティが適用される場所。 |
name: sha_custom_detector_output_name |
custom_output プロパティの名前。 |
expression: sha_custom_detector_output_expression |
出力で返す式。 |
title: sha_custom_detector_output_title |
出力のタイトル。 |
description: sha_custom_detector_output_description |
Security Health Analytics のカスタム モジュールの出力の説明。 |
location: sha_custom_detector_output_location |
出力が適用される場所。 |
resource_types: sha_custom_detector_resource |
カスタム モジュールがスキャンするリソースタイプ。 |
severity: sha_custom_severity_level |
このモジュールによって作成される検出結果の重大度。 |
description: sha_custom_detector_description |
カスタム モジュールが検出する脆弱性または構成ミス。 |
recommendation: sha_custom_detector_recommendation |
検出された問題の修正方法の説明。 |
サンプル posture.yaml
createTime: '2024-04-01T15:27:27.188366349Z'
etag: h5ulCqzUqOcaIjKjxHFrOrrZpmneG8A0K1mdO-uHsLM
name: organizations/123/locations/global/postures/mixedcasposture
policySets:
- policies:
- constraint:
securityHealthAnalyticsModule:
moduleEnablementState: ENABLED
moduleName: BIGQUERY_TABLE_CMEK_DISABLED
description: enable BIGQUERY_TABLE_CMEK_DISABLED
policyId: SHA module BIGQUERY_TABLE_CMEK_DISABLED
- constraint:
orgPolicyConstraint:
cannedConstraintId: iam.allowServiceAccountCredentialLifetimeExtension
policyRules:
- allowAll: true
- condition:
expression: resource.matchTag("123/location", "us-east3")
title: policy for us-east3
description: apply policy to us-east3
policyId: test/123/policies/iam.allowServiceAccountCredentialLifetimeExtension
- constraint:
orgPolicyConstraintCustom:
customConstraint:
actionType: ALLOW
condition: resource.management.autoUpgrade == false
description: Only allow GKE NodePool resource to be created or updated if
AutoUpgrade is not enabled where this custom constraint is enforced.
displayName: Disable GKE auto upgrade
methodTypes:
- CREATE
name: organizations/123/customConstraints/custom.gke123
resourceTypes:
- container.googleapis.com/NodePool
policyRules:
- enforce: true
policyId: orgPolicycustomconstraint
- constraint:
securityHealthAnalyticsModule:
moduleEnablementState: DISABLED
moduleName: PUBLIC_BUCKET_ACL
description: PUBLIC_BUCKET_ACL disabled
policyId: sha module PUBLIC_BUCKET_ACL
- constraint:
securityHealthAnalyticsCustomModule:
config:
customOutput: {}
description: Test Custom Module
predicate:
expression: resource.rotationPeriod > duration('2592000s')
recommendation: Testing custom modules
resourceSelector:
resourceTypes:
- cloudkms.googleapis.com/CryptoKey
severity: CRITICAL
displayName: customSHA
moduleEnablementState: ENABLED
policyId: sha_custom_module
- constraint:
securityHealthAnalyticsCustomModule:
config:
customOutput: {}
description: Test Custom Module
predicate:
expression: resource.rotationPeriod > duration('2592000s')
recommendation: Testing custom modules
resourceSelector:
resourceTypes:
- cloudkms.googleapis.com/CryptoKey
severity: CRITICAL
displayName: customSHA2
moduleEnablementState: ENABLED
policyId: sha_custom_module_2
policySetId: PolicySetmix
- policy_set_id: BigQuery detective policy set
description: SHA module that new customers can automatically enable.
policies:
- policy_id: Public dataset
constraint:
securityHealthAnalyticsModule:
moduleEnablementState: ENABLED
moduleName: PUBLIC_DATASET
state: ACTIVE
例
例については、事前定義された対策テンプレートをご覧ください。
AWS と Google Cloud の Security Health Analytics 検出機能を含む対策ファイルは次のとおりです。
description: Posture to help make storage workloads more secure across Google Cloud and AWS.
state: ACTIVE
policy_sets:
- policy_set_id: Google Cloud policy set
description: Policy set containing organization policies and Security Health Analytics modules for securing Cloud Storage.
policies:
- policy_id: Enforce Public Access Prevention
compliance_standards:
- standard: NIST SP 800-53
control: AC-3
- standard: NIST SP 800-53
control: AC-17
- standard: NIST SP 800-53
control: AC-20
constraint:
org_policy_constraint:
canned_constraint_id: storage.publicAccessPrevention
policy_rules:
- enforce: true
description: This policy prevents access to existing and future resources via the public internet by disabling and blocking access control lists (ACLs) and IAM permissions that grant access to allUsers and allAuthenticatedUsers.
- policy_id: Bucket IAM not monitored
compliance_standards:
- standard: NIST 800-53 R5
control: AC-12
- standard: NIST 800-53 R5
control: AC-2
- standard: NIST 800-53 R5
control: AC-7
constraint:
securityHealthAnalyticsModule:
moduleEnablementState: ENABLED
moduleName: BUCKET_IAM_NOT_MONITORED
description: This detector logs metric filter and creates alerts for Cloud Storage IAM permission changes. By monitoring changes to Cloud Storage bucket permissions, this detector can help you identify over-privileged users or suspicious activity at early stages.
- policy_set_id: AWS policy set
description: Policy set containing AWS built-in Security Health Analytics modules for securing S3 buckets.
policies:
- policy_id: S3 bucket replication enabled
compliance_standards:
- standard: NIST 800-53 R5
control: SI-13(5)
constraint:
securityHealthAnalyticsModule:
moduleEnablementState: ENABLED
moduleName: S3_BUCKET_REPLICATION_ENABLED
description: This control checks whether an Amazon S3 bucket has cross-region replication enabled. The control fails if the bucket doesn't have cross-region replication enabled or if same-region replication is also enabled.
- policy_id: S3 bucket logging enabled
compliance_standards:
- standard: NIST 800-53 R5
control: SI-13(5)
- standard: PCI DSS 3.2.1
control: 10.3.1
constraint:
securityHealthAnalyticsModule:
moduleEnablementState: ENABLED
moduleName: S3_BUCKET_LOGGING_ENABLED
description: AWS S3 Server Access Logging feature records access requests to storage buckets which is useful for security audits. By default, server access logging is not enabled for S3 buckets.
次のステップ
- 体制 YAML ファイルを作成して環境にデプロイします。
- 制限事項など、Security Health Analytics 用のカスタム モジュールの詳細を確認する。
- カスタム組織のポリシーの制約について学習する。
- 体制用の Terraform リソースを作成する。