보안 상황 YAML 파일

이 페이지에서는 보안 상황의 정책 정의를 위해 만드는 posture.yaml 파일의 키-값 쌍에 대한 개요를 제공합니다. 상황 YAML 파일을 만들고 이를 환경에 배포하려면 보안 상황 관리를 참조하세요.

상황 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

키-값 쌍 설명

다음 표에서는 posture.yaml 파일의 키-값 쌍을 설명합니다.

키-값 쌍 설명
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_valuesdenied_values 종류의 값은 각각 허용되거나 거부되는 값의 목록입니다.
condition: 이 규칙을 정책 평가에 사용할지 여부를 결정하는 조건입니다. Exprexpression 필드에는 || 또는 && 연산자로 조인된 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 조건입니다. 이 필드의 최대 길이는 1000자(영문 기준)입니다.
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.

다음 단계