맞춤 조직 정책 구성

이 페이지에서는 조직 정책 서비스 커스텀 제약조건을 사용하여 다음 Google Cloud 리소스에 대한 특정 작업을 제한하는 방법을 보여줍니다.

  • securitycenter.googleapis.com/BigQueryExport
  • securitycenter.googleapis.com/MuteConfig
  • securitycenter.googleapis.com/NotificationConfig
  • securitycenter.googleapis.com/ResourceValueConfig
  • securitycenter.googleapis.com/ContainerThreatDetectionSettings
  • securitycenter.googleapis.com/EventThreatDetectionSettings
  • securitycenter.googleapis.com/SecurityHealthAnalyticsSettings
  • securitycenter.googleapis.com/VirtualMachineThreatDetectionSettings
  • securitycenter.googleapis.com/WebSecurityScannerSettings
  • securitycentermanagement.googleapis.com/SecurityCenterService
  • securitycentermanagement.googleapis.com/SecurityHealthAnalyticsCustomModule
  • securitycentermanagement.googleapis.com/EventThreatDetectionCustomModule
  • websecurityscanner.googleapis.com/ScanConfig

조직 정책에 대한 자세한 내용은 커스텀 조직 정책을 참조하세요.

조직 정책 및 제약조건 정보

Google Cloud 조직 정책 서비스를 사용하면 조직 리소스를 중앙에서 프로그래매틱 방식으로 제어할 수 있습니다. 조직 정책 관리자Google Cloud 리소스 계층 구조에서Google Cloud 리소스 및 이러한 리소스의 하위 요소에 적용되는 제약조건이라는 제한사항 집합인 조직 정책을 정의할 수 있습니다. 조직, 폴더 또는 프로젝트 수준에서 조직 정책을 적용할 수 있습니다.

조직 정책은 다양한 Google Cloud 서비스에 내장된 관리형 제약조건을 제공합니다. 그러나 조직 정책에서 제한되는 특정 필드를 보다 세부적으로 맞춤설정 가능한 방식으로 제어하려면 커스텀 제약조건을 만들고 조직 정책에 이러한 커스텀 제약조건을 사용할 수 있습니다.

정책 상속

기본적으로 조직 정책은 정책을 적용하는 리소스의 하위 요소에 상속됩니다. 예를 들어 폴더에 정책을 적용하면 Google Cloud 가 폴더의 모든 프로젝트에 정책을 적용합니다. 이 동작 및 이를 변경하는 방법에 대한 자세한 내용은 계층 구조 평가 규칙을 참조하세요.

시작하기 전에

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  8. Make sure that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 조직 ID를 알고 있어야 합니다.
  13. 필요한 역할

    커스텀 조직 정책을 관리하는 데 필요한 권한을 얻으려면 관리자에게 조직 리소스에 대한 조직 정책 관리자(roles/orgpolicy.policyAdmin) IAM 역할을 부여해 달라고 요청하세요. 역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

    커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.

    커스텀 제약조건 만들기

    커스텀 제약조건은 조직 정책을 적용하는 서비스에서 지원되는 리소스, 메서드, 조건, 작업을 사용하여 YAML 파일에서 정의됩니다. 커스텀 제약조건의 조건은 Common Expression Language(CEL)를 사용하여 정의됩니다. CEL을 사용해서 커스텀 제약조건에서 조건을 빌드하는 방법은 커스텀 제약조건 만들기 및 관리의 CEL 섹션을 참조하세요.

    커스텀 제약조건을 만들려면 다음 형식을 사용하여 YAML 파일을 만듭니다.

    name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
    resourceTypes:
    - RESOURCE_NAME
    methodTypes:
    - CREATE
    - UPDATE
    condition: "CONDITION"
    actionType: ACTION
    displayName: DISPLAY_NAME
    description: DESCRIPTION
    

    다음을 바꿉니다.

    • ORGANIZATION_ID: 조직 ID입니다(예: 123456789).

    • CONSTRAINT_NAME: 새 커스텀 제약조건에 사용하려는 이름입니다. 커스텀 제약조건은 custom.으로 시작해야 하며 대문자, 소문자 또는 숫자만 포함할 수 있습니다. 예를 들면 custom.SccNotificationConfig입니다. 이 필드의 최대 길이는 70자입니다.

    • RESOURCE_NAME: 제한하려는 객체 및 필드가 포함된Google Cloud 리소스의 정규화된 이름. 예를 들면 securitycenter.googleapis.com/NotificationConfig입니다.

    • CONDITION: 지원되는 서비스 리소스의 표현에 대해 작성된 CEL 조건. 이 필드의 최대 길이는 1000자(영문 기준)입니다. 조건을 작성하는 데 사용할 수 있는 리소스에 대한 자세한 내용은 지원되는 리소스를 참조하세요. 예를 들면 "resource.pubsubTopic != 'projects/PROJECT_ID/topics/TOPIC_ID'"입니다.

    • ACTION: condition이 충족될 때 수행할 작업. 가능한 값은 ALLOWDENY입니다.

    • DISPLAY_NAME: 제약조건에 대한 사용자 친화적인 이름. 이 필드의 최대 길이는 200자(영문 기준)입니다.

    • DESCRIPTION: 정책을 위반할 때 오류 메시지로 표시할 제약조건에 대한 사용자 친화적인 설명. 이 필드의 최대 길이는 2,000자(영문 기준)입니다.

    커스텀 제약조건을 만드는 방법에 대한 자세한 내용은 커스텀 제약조건 정의를 참조하세요.

    커스텀 제약조건 설정

    새 커스텀 제약조건의 YAML 파일을 만든 후에는 조직에서 조직 정책에 사용할 수 있도록 설정해야 합니다. 커스텀 제약조건을 설정하려면 gcloud org-policies set-custom-constraint 명령어를 사용합니다.
    gcloud org-policies set-custom-constraint CONSTRAINT_PATH
    CONSTRAINT_PATH를 커스텀 제약조건 파일의 전체 경로로 바꿉니다. 예를 들면 /home/user/customconstraint.yaml입니다. 완료되면 Google Cloud 조직 정책 목록에서 조직 정책으로 커스텀 제약조건을 사용할 수 있습니다. 커스텀 제약조건이 존재하는지 확인하려면 gcloud org-policies list-custom-constraints 명령어를 사용합니다.
    gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
    ORGANIZATION_ID를 조직 리소스 ID로 바꿉니다. 자세한 내용은 조직 정책 보기를 참조하세요.

    커스텀 조직 정책 적용

    제약조건을 참조하는 조직 정책을 만들고 해당 조직 정책을 Google Cloud 리소스에 적용하여 제약조건을 적용할 수 있습니다.

    콘솔

    1. Google Cloud 콘솔에서 조직 정책 페이지로 이동합니다.

      조직 정책으로 이동

    2. 프로젝트 선택 도구에서 조직 정책을 설정할 프로젝트를 선택합니다.
    3. 조직 정책 페이지의 목록에서 제약조건을 선택하여 해당 제약조건의 정책 세부정보 페이지를 봅니다.
    4. 이 리소스의 조직 정책을 구성하려면 정책 관리를 클릭합니다.
    5. 정책 수정 페이지에서 상위 정책 재정의를 선택합니다.
    6. 규칙 추가를 클릭합니다.
    7. 적용 섹션에서 이 조직 정책 적용을 사용 설정할지 여부를 선택합니다.
    8. (선택사항) 태그로 조직 정책을 조건부로 만들려면 조건 추가를 클릭합니다. 조건부 규칙을 조직 정책에 추가하면 비조건부 규칙을 최소 하나 이상 추가해야 합니다. 그렇지 않으면 정책을 저장할 수 없습니다. 자세한 내용은 태그를 사용하여 조직 정책 설정을 참조하세요.
    9. 변경사항 테스트를 클릭하여 조직 정책의 효과를 시뮬레이션합니다. 기존 관리형 제약조건에는 정책 시뮬레이션을 사용할 수 없습니다. 자세한 내용은 정책 시뮬레이터로 조직 정책 변경사항 테스트를 참조하세요.
    10. 조직 정책을 완료하고 적용하려면 정책 설정을 클릭합니다. 정책이 적용되는 데 최대 15분이 소요됩니다.

    gcloud

    불리언 규칙이 있는 조직 정책을 만들려면 제약조건을 참조하는 정책 YAML 파일을 만듭니다.

          name: projects/PROJECT_ID/policies/CONSTRAINT_NAME
          spec:
            rules:
            - enforce: true
        

    다음을 바꿉니다.

    • PROJECT_ID: 제약조건을 적용할 프로젝트
    • CONSTRAINT_NAME: 커스텀 제약조건에 대해 정의된 이름. 예를 들면 custom.SccNotificationConfig입니다.

    제약조건이 포함된 조직 정책을 적용하려면 다음 명령어를 실행합니다.

        gcloud org-policies set-policy POLICY_PATH
        

    POLICY_PATH를 조직 정책 YAML 파일의 전체 경로로 바꿉니다. 정책이 적용되는 데 최대 15분이 소요됩니다.

    커스텀 조직 정책 테스트

    다음 예시에서는 securitycenter.googleapis.com/NotificationConfig 리소스에 대한 커스텀 제약조건을 만듭니다. 이 제약조건에 따라 사용자는 지정된 Pub/Sub 주제를 구독하는 알림 구성만 만들거나 수정할 수 있습니다.

    시작하기 전에 다음 사항을 알아야 합니다.

    • 조직 ID
    • 프로젝트 ID
    • Pub/Sub 주제 ID

    제약조건 만들기

    1. 커스텀 제약조건을 정의하는 notificationConfig_constraint.yaml이라는 YAML 파일을 만듭니다.

       name: organizations/ORGANIZATION_ID/customConstraints/custom.SccNotificationConfig
       resourceTypes:
       - securitycenter.googleapis.com/NotificationConfig
       methodTypes:
       - CREATE
       - UPDATE
       condition: "resource.pubsubTopic != 'projects/PROJECT_ID/topics/TOPIC_ID'"
       actionType: DENY
       displayName: Only let users create or modify notification configs that
         are subscribed to a specific Pub/Sub topic.
       description: "Can't create or modify notification configs that are subscribed
         to the specified Pub/Sub topic."
      
    2. 제약조건을 적용합니다.

      gcloud org-policies set-custom-constraint ~/notificationConfig_constraint.yaml
      
    3. 제약조건이 있는지 확인합니다.

      gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
      --filter="RESOURCE_TYPES='securitycenter.googleapis.com/NotificationConfig'"
      

    정책 만들기

    1. 조직 정책을 정의하는 notificationConfig_policy.yaml이라는 YAML 파일을 만듭니다.

       name: projects/PROJECT_ID/policies/custom.SccNotificationConfig
       spec:
         rules:
         - enforce: true
      
    2. 정책을 적용합니다.

      gcloud org-policies set-policy ~/notificationConfig_policy.yaml
      
    3. 정책이 있는지 확인합니다.

      gcloud org-policies list --organization=ORGANIZATION_ID
      --filter="constraint:custom.SccNotificationConfig"
      

    정책 테스트

    조직 정책을 위반하는 알림 구성을 만들어 봅니다.

      gcloud scc notifications create NOTIFICATION_CONFIG_ID \
      --pubsub-topic=projects/PROJECT_ID/topics/example_topic \
      --project=PROJECT_ID  \
      --filter="state=\"ACTIVE\""
    

    출력은 다음과 같습니다.

      Operation denied by custom org policies:
      ["customConstraints/SccNotificationConfig": "Can't create or modify
      notification configs that are subscribed to the specified Pub/Sub
      topic."]
    

    일반적인 사용 사례의 커스텀 조직 정책 예시

    다음 표에는 일반적인 사용 사례에 대한 몇 가지 커스텀 제약조건의 구문이 나와 있습니다.

    설명 제약조건 구문
    사용자가 특정 Pub/Sub 주제를 구독하는 알림 구성만 만들거나 수정하도록 허용합니다.
          name: organizations/ORGANIZATION_ID/customConstraints/custom.SccNotificationConfig
          resourceTypes:
          - securitycenter.googleapis.com/NotificationConfig
          methodTypes:
          - CREATE
          - UPDATE
          condition: "resource.pubsubTopic != 'projects/PROJECT_ID/topics/TOPIC_ID'"
          actionType: DENY
          displayName: Only let users create or modify notification configs
            that are subscribed to a specific Pub/Sub topic.
          description: "Can't create or modify notification configs that are subscribed
          to the specified Pub/Sub topic."
          
    사용자가 특정 BigQuery 데이터 세트만 내보내도록 허용합니다.
          name: organizations/ORGANIZATION_ID/customConstraints/custom.SccBigQueryExport
          resourceTypes:
          - securitycenter.googleapis.com/BigQueryExport
          methodTypes:
          - CREATE
          - UPDATE
          condition: "resource.dataset != 'projects/PROJECT_ID/datasets/DATASET_ID'"
          actionType: DENY
          displayName: Only let users export a specific BigQuery dataset.
          description: "Can't export the specified BigQuery dataset."
          
    사용자가 Container Threat Detection 설정 리소스의 서비스 사용 설정 상태를 변경하지 못하도록 합니다. 이 사용 사례는 Event Threat Detection, Security Health Analytics, VM Threat Detection, Web Security Scanner 설정 리소스에도 적용됩니다.
          name: organizations/ORGANIZATION_ID/customConstraints/custom.SccKtdSettings
          resourceTypes:
          - securitycenter.googleapis.com/securitycenter.googleapis.com/ContainerThreatDetectionSettings
          methodTypes:
          - CREATE
          - UPDATE
          condition: "resource.serviceEnablementState != ENABLED"
          actionType: DENY
          displayName: Prevent users from changing the Container Threat Detection service
            enablement state.
          description: "Can't change the Container Threat Detection service enablement
            state."
          
    사용자가 Security Health Analytics 커스텀 모듈 리소스의 사용 설정 상태를 변경하지 못하도록 합니다. 이 사용 사례는 Event Threat Detection 커스텀 모듈 리소스에도 적용됩니다.
          name: organizations/ORGANIZATION_ID/customConstraints/custom.SccShaCustomModule
          resourceTypes:
          - securitycentermanagement.googleapis.com/SecurityHealthAnalyticsCustomModule
          methodTypes:
          - CREATE
          - UPDATE
          condition: "resource.serviceEnablementState != ENABLED"
          actionType: DENY
          displayName: Prevent users from changing the Security Health Analytics custom
            module enablement state.
          description: "Can't change the Security Health Analytics custom module enablement
            state."
          
    사용자가 최대 QPS 제한이 10을 초과하는 Web Security Scanner 스캔 구성을 만들거나 수정하지 못하도록 합니다.
          name: organizations/ORGANIZATION_ID/customConstraints/custom.WssScanConfig
          resourceTypes:
          - websecurityscanner.googleapis.com/ScanConfig
          methodTypes:
          - CREATE
          - UPDATE
          condition: "resource.maxQps > 10"
          actionType: DENY
          displayName: Only let users create or modify scan configs with a maximum
            QPS limit of 10 or less.
          description: "Can't create or modify scan configs that have a maximum QPS
            limit greater than 10."
          

    Security Command Center 지원 리소스

    다음 표에서는 커스텀 제약조건에서 참조할 수 있는 Security Command Center 리소스를 보여줍니다.

    리소스 필드
    securitycenter.googleapis.com/BigQueryExport resource.dataset
    resource.description
    resource.name
    securitycenter.googleapis.com/ContainerThreatDetectionSettings resource.modules[*].moduleEnablementState
    resource.name
    resource.serviceEnablementState
    securitycenter.googleapis.com/EventThreatDetectionSettings resource.modules[*].moduleEnablementState
    resource.name
    resource.serviceEnablementState
    securitycenter.googleapis.com/MuteConfig resource.description
    resource.expiryTime
    resource.name
    resource.type
    securitycenter.googleapis.com/NotificationConfig resource.description
    resource.name
    resource.pubsubTopic
    securitycenter.googleapis.com/ResourceValueConfig resource.cloudProvider
    resource.description
    resource.name
    resource.resourceLabelsSelector
    resource.resourceType
    resource.resourceValue
    resource.scope
    resource.tagValues
    securitycenter.googleapis.com/SecurityHealthAnalyticsSettings resource.modules[*].moduleEnablementState
    resource.name
    resource.serviceEnablementState
    securitycenter.googleapis.com/VirtualMachineThreatDetectionSettings resource.modules[*].moduleEnablementState
    resource.name
    resource.serviceEnablementState
    securitycenter.googleapis.com/WebSecurityScannerSettings resource.modules[*].moduleEnablementState
    resource.name
    resource.serviceEnablementState
    securitycentermanagement.googleapis.com/EventThreatDetectionCustomModule resource.description
    resource.displayName
    resource.enablementState
    resource.name
    resource.type
    securitycentermanagement.googleapis.com/SecurityCenterService resource.intendedEnablementState
    resource.modules[*].intendedEnablementState
    resource.name
    securitycentermanagement.googleapis.com/SecurityHealthAnalyticsCustomModule resource.customConfig.customOutput.properties.name
    resource.customConfig.description
    resource.customConfig.recommendation
    resource.customConfig.resourceSelector.resourceTypes
    resource.customConfig.severity
    resource.displayName
    resource.enablementState
    resource.name
    websecurityscanner.googleapis.com/ScanConfig resource.authentication.customAccount.loginUrl
    resource.authentication.customAccount.password
    resource.authentication.customAccount.username
    resource.authentication.googleAccount.password
    resource.authentication.googleAccount.username
    resource.authentication.iapCredential.iapTestServiceAccountInfo.targetAudienceClientId
    resource.blacklistPatterns
    resource.displayName
    resource.exportToSecurityCommandCenter
    resource.ignoreHttpStatusErrors
    resource.managedScan
    resource.maxQps
    resource.name
    resource.riskLevel
    resource.schedule.intervalDurationDays
    resource.schedule.scheduleTime
    resource.startingUrls
    resource.staticIpScan
    resource.targetPlatforms
    resource.userAgent

    다음 단계