Security Command Center에서 발견 항목 숨기기

이 페이지에서는 발견 항목을 숨겨 Security Command Center에서 수신하는 발견 항목의 수를 줄이는 방법을 설명합니다.

개요

발견 항목을 숨기면 Google Cloud 콘솔의 발견 항목 기본 뷰에서 숨겨집니다. 발견 항목을 수동 또는 프로그래매틱 방식으로 숨기고 필터를 만들어 지정한 기준에 따라 현재 및 이후의 발견 항목을 자동으로 숨길 수 있습니다.

Security Command Center에서 발견 항목 제공자는 Google Cloud 배포에 대한 포괄적인 보안 평가를 제공하지만 일부 발견 항목은 조직 또는 프로젝트에 적합하지 않거나 관련이 없을 수 있습니다. 또한 발견 항목이 너무 많으면 보안 분석가가 가장 중요한 위험 요소를 효과적으로 식별하고 처리하기 어려울 수 있습니다. 발견 항목 숨기기는 허용 가능한 비즈니스 매개변수 내에 포함되거나 격리된 애셋의 보안 발견 항목을 검토하거나 이에 대응하는 시간을 줄여줍니다.

발견 항목 숨기기 및 허용 목록 비교

발견 항목 숨기기는 기존 볼륨 관리 솔루션과 다르게 작동합니다. Security Health Analytics를 사용하면 전용 보안 표시를 사용해서 허용 목록에 자산을 추가하여 검색기가 특정 애셋에 대해 보안 발견 항목을 만들지 못하도록 방지할 수 있습니다. 또한 Security Command Center를 사용하여 검색기를 사용 중지할 수도 있습니다.

하지만 발견 항목 숨기기는 허용 목록 및 감지기 중지에 비해 몇 가지 장점이 있습니다.

  • 기본 애셋을 찾을 필요 없이 발견 항목을 숨길 수 있습니다.
  • 리소스에 연결되지 않은 발견 항목을 숨길 수 있습니다.
  • 커스텀 필터를 만들어 숨기기 기능을 세부 조정할 수 있습니다.
  • 발견 항목을 숨겨도 기본 애셋 검사가 중지되지 않습니다. 발견 항목이 계속 생성되지만 표시하도록 결정할 때까지는 숨겨진 상태로 유지됩니다.

권한

발견 항목 숨기기를 사용하려면 조직, 폴더, 프로젝트 수준에서 다음 Identity and Access Management(IAM) 역할 중 하나가 필요합니다.

  • 숨기기 규칙 보기:
    • 보안 센터 관리자 뷰어(roles/securitycenter.adminViewer)
    • 보안 센터 설정 뷰어(roles/securitycenter.settingsViewer)
    • 보안 센터 숨기기 구성 뷰어(roles/securitycenter.muteConfigsViewer)
  • 숨기기 규칙 보기, 만들기, 업데이트, 삭제:
    • 보안 센터 관리자(roles/securitycenter.admin)
    • 보안 센터 관리자 편집자(roles/securitycenter.adminEditor)
    • 보안 센터 설정 편집자(roles/securitycenter.settingsEditor)
    • 보안 센터 숨기기 구성 편집자(roles/securitycenter.muteConfigsEditor)
  • 수동으로 발견 항목 숨기기:
    • 보안 센터 발견 항목 편집자(roles/securitycenter.findingsEditor)

또한 커스텀 역할을 만들고 다음 권한 중 일부 또는 전체를 부여할 수 있습니다.

  • 숨기기 규칙 읽기 권한
    • securitycenter.muteconfigs.get
    • securitycenter.muteconfigs.list
  • 숨기기 규칙 쓰기 권한
    • securitycenter.muteconfigs.create
    • securitycenter.muteconfigs.update
    • securitycenter.muteconfigs.delete
  • 발견 항목 쓰기 권한
    • securitycenter.findings.setMute
    • securitycenter.findings.bulkMuteUpdate

조직, 폴더, 프로젝트 수준에서 부여된 역할에 따라 발견 항목을 숨길 수 있습니다. 사용자가 특정 폴더 또는 프로젝트에서 발견 항목을 숨기고 부여된 액세스 권한에 따라 다른 사람이 발견 항목을 숨기지 못하도록 제한할 수 있습니다. 예를 들어 단일 프로젝트에 대해 액세스 권한이 있으면 해당 프로젝트에서만 발견 항목을 숨길 수 있습니다. 폴더에 액세스할 수 있으면 해당 폴더 안의 프로젝트 또는 하위 폴더에서 발견 항목을 숨길 수 있습니다.

Security Command Center 역할에 대해 자세히 알아보려면 액세스 제어를 참조하세요.

발견 항목 숨기기

개별 발견 항목을 수동으로 숨기거나, 대량 숨기기 필터를 사용해서 여러 발견 항목을 한 번에 숨기거나, 정의한 필터를 기준으로 이후에 발생하는 발견 항목을 자동으로 숨기는 숨기기 규칙을 만들 수 있습니다.

발견 항목에는 MUTED 또는 UNMUTED로 설정될 수 있는 mute 속성이 있습니다. 발견 항목을 숨기거나 숨김을 취소하면 이 속성의 값이 변경됩니다. 자세한 내용은 발견 항목 숨기기 속성을 참조하세요.

발견 항목 숨기기는 다음을 비롯한 많은 사용 사례에 사용될 수 있습니다.

  • 보다 엄격한 요구 사항이 적용되지 않을 수 있는 비프로덕션 환경의 애셋
  • 중요 데이터를 포함하지 않는 프로젝트에서 고객 관리 암호화 키를 사용할 때의 권장사항
  • Datastore에 포괄적인 액세스 권한을 부여하여 의도적으로 일반에 공개하거나 공개 정보를 전파하는 경우
  • 회사 정책에 따라 조직 또는 프로젝트에 관련되지 않은 발견 항목

숨겨진 발견 항목은 감사 및 규정 준수 목적으로 계속 로깅되며, 필요에 따라 확인할 수 있습니다. 하지만 기본적으로 Google Cloud 콘솔에는 표시되지 않습니다. 또한 Pub/Sub 알림 및 Security Command Center API 호출에서 해당 발견 항목의 mute 속성을 사용해서 숨겨진 발견 항목을 필터링할 수도 있습니다.

개별 발견 항목 숨기기

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 개별 발견 항목을 숨길 수 있습니다.

발견 항목을 숨기는 샘플 코드는 발견 항목 숨기기를 참조하세요.

개별 발견 항목을 숨기려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔에서 Security Command Center 발견 항목 페이지로 이동합니다.

    발견 항목으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다. 프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 발견 항목의 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 발견 항목 쿼리 결과 패널에 숨기려는 발견 항목이 표시되지 않으면 빠른 필터 패널의 카테고리 섹션에서 발견 항목 카테고리를 선택하세요.

  5. 숨기려는 발견 항목 옆에 있는 체크박스를 선택합니다. 하나 이상의 발견 항목을 선택할 수 있습니다.

  6. 발견 항목 쿼리 결과 작업 모음에서 숨기기 옵션을 클릭한 후 숨기기를 선택합니다.

    선택한 발견 항목의 mute 속성이 MUTED로 설정되고 발견 항목 쿼리 결과 패널에서 발견 항목이 삭제됩니다.

또는 세부정보 패널에서 발견 항목을 숨길 수 있습니다.

  1. 발견 항목 페이지의 발견 항목 쿼리 결과 패널에 있는 카테고리 열에서 개별 발견 항목 이름을 클릭합니다. 발견 항목의 세부정보 패널이 열립니다.
  2. 조치 취하기를 클릭합니다.
  3. 조치 취하기 메뉴에서 숨기기를 선택합니다.

    대신 이와 같은 발견 항목 숨기기를 선택하면 숨기기 규칙 만들기 페이지가 열리고, 이 페이지에서 동일한 유형의 발견 항목, 또는 동일한 Indicator 속성을 포함한 발견 항목에 대해 숨기기 규칙을 만들 수 있습니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 발견 항목의 숨기기 상태를 MUTED로 설정하고 gcloud CLI에서 set-mute 명령어를 사용합니다.

    gcloud scc findings set-mute FINDING_ID \
     --PARENT=PARENT_ID \
     --location=LOCATION --source=SOURCE_ID \
     --mute=MUTED
    

    다음을 바꿉니다.

    • FINDING_ID: 숨기려는 발견 항목의 ID입니다.

      발견 항목 ID를 찾으려면 Security Command Center API를 사용해서 발견 항목을 나열합니다. 발견 항목 ID는 canonicalName 속성의 마지막 부분입니다. 예를 들면 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9입니다.

    • PARENT: 상위 리소스(project, folder, organization)입니다. 대소문자를 구분합니다.

    • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.

    • LOCATION: 데이터 상주가 사용 설정된 경우 발견 항목이 저장되는 Security Command Center 위치를 지정합니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 통해 발견 항목이 숨겨지고 플래그에 유효한 유일한 값은 global입니다.

    • SOURCE_ID: 소스 ID입니다.

      소스 ID 가져오기에 대한 안내는 소스 ID 가져오기를 참조하세요.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// setMute mutes an individual finding.
// If a finding is already muted, muting it again has no effect.
// Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
func setMute(w io.Writer, findingPath string) error {
	// findingPath: The relative resource name of the finding. See:
	// https://cloud.google.com/apis/design/resource_names#relative_resource_name
	// Use any one of the following formats:
	//  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
	//  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
	//  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
	// findingPath := fmt.Sprintf("projects/%s/sources/%s/finding/%s", "your-google-cloud-project-id", "source", "finding-id")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.SetMuteRequest{
		Name: findingPath,
		Mute: securitycenterpb.Finding_MUTED}

	finding, err := client.SetMute(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to set the specified mute value: %w", err)
	}
	fmt.Fprintf(w, "Mute value for the finding: %s is %s", finding.Name, finding.Mute)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.Finding;
import com.google.cloud.securitycenter.v1.Finding.Mute;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import com.google.cloud.securitycenter.v1.SetMuteRequest;
import java.io.IOException;

public class SetMuteFinding {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}

    // findingPath: The relative resource name of the finding. See:
    // https://cloud.google.com/apis/design/resource_names#relative_resource_name
    // Use any one of the following formats:
    //  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
    //  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
    //  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
    String findingPath = "{path-to-the-finding}";
    setMute(findingPath);
  }

  // Mute an individual finding.
  // If a finding is already muted, muting it again has no effect.
  // Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
  public static Finding setMute(String findingPath) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      SetMuteRequest setMuteRequest =
          SetMuteRequest.newBuilder().setName(findingPath).setMute(Mute.MUTED).build();

      Finding finding = client.setMute(setMuteRequest);
      System.out.println(
          "Mute value for the finding " + finding.getName() + " is: " + finding.getMute());
      return finding;
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def set_mute_finding(finding_path: str) -> None:
    """
      Mute an individual finding.
      If a finding is already muted, muting it again has no effect.
      Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
    Args:
        finding_path: The relative resource name of the finding. See:
        https://cloud.google.com/apis/design/resource_names#relative_resource_name
        Use any one of the following formats:
        - organizations/{organization_id}/sources/{source_id}/finding/{finding_id},
        - folders/{folder_id}/sources/{source_id}/finding/{finding_id},
        - projects/{project_id}/sources/{source_id}/finding/{finding_id}.
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.SetMuteRequest()
    request.name = finding_path
    request.mute = securitycenter.Finding.Mute.MUTED

    finding = client.set_mute(request)
    print(f"Mute value for the finding: {finding.mute.name}")

REST API

Security Command Center API에서 setMute 메서드를 사용하여 발견 항목을 숨깁니다. 요청 본문은 발견 상목 숨기기 상태를 나타내는 enum입니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 setMute를 호출합니다.


POST https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/sources/SOURCE_ID/findings/FINDING_ID:setMute

{
  "mute": "MUTED"
}

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 setMute를 호출합니다.

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/sources/SOURCE_ID/locations/LOCATION/findings/FINDING_ID:setMute

{
  "mute": "MUTED"
}

다음을 바꿉니다.

  • PARENT: 상위 리소스(organizations, folders, projects)입니다.
  • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 발견 항목이 저장되는 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • SOURCE_ID: 소스의 숫자 ID입니다.

    소스 ID 가져오기에 대한 안내는 소스 ID 가져오기를 참조하세요.

  • FINDING_ID: 숨기려는 발견 항목의 ID입니다.

    발견 항목 ID를 찾으려면 Security Command Center API를 사용해서 발견 항목을 나열합니다. 발견 항목 ID는 canonicalName 속성의 마지막 부분입니다. 예를 들면 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9입니다.

발견 항목을 숨기면 mute 속성이 MUTED로 설정됩니다.

발견 항목을 숨겨도 활성화 여부에는 영향을 주지 않습니다. 활성 발견 항목을 숨겨도 state 속성은 변경되지 않습니다(state="ACTIVE"). 발견 항목이 숨겨지지만 취약점, 구성 오류, 위협이 해결될 때까지 활성 상태로 유지됩니다.

숨기기 규칙에 대한 자세한 내용은 숨기기 규칙 만들기를 참조하세요.

Google Cloud Console에서 숨겨진 발견 항목 보기

발견 항목 쿼리를 수정하여 mute="MUTED" 속성 값이 포함된 발견 항목을 선택하면 Google Cloud console에서 숨겨진 발견 항목을 볼 수 있습니다.

예를 들어 다음 발견 항목 쿼리는 숨겨진 활성 발견 항목만 표시합니다.

state="ACTIVE"
AND mute="MUTED"

숨김 및 숨기기 취소된 모든 활성 발견 항목을 표시하려면 쿼리에서 mute 속성을 완전히 생략합니다.

state="ACTIVE"

기본적으로 Google Cloud Console의 발견 항목 쿼리는 숨겨지지 않은 발견 항목만 표시합니다.

발견 항목 쿼리 수정에 대한 자세한 내용은 대시보드에서 발견 항목 쿼리 만들기 또는 수정을 참조하세요.

개별 발견 항목 숨기기 취소

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 개별 발견 항목 숨기기를 취소할 수 있습니다.

발견 항목 숨기기를 취소하는 샘플 코드는 발견 항목 숨기기 취소를 참조하세요.

개별 발견 항목 숨기기를 취소하려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔에서 Security Command Center 발견 항목 페이지로 이동합니다.

    발견 항목으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다. 프로젝트 선택기

    발견 항목 페이지가 열리고 쿼리 미리보기 섹션에 기본 쿼리가 표시됩니다. 기본 쿼리는 숨겨진 발견 항목을 필터링하므로 숨겨진 발견 항목이 발견 항목 쿼리 결과 패널에 표시되기 전에 쿼리를 수정해야 합니다.

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 발견 항목의 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 쿼리 미리보기 섹션의 오른쪽에서 쿼리 수정을 클릭하여 쿼리 편집기를 엽니다.

  5. 쿼리 편집기 필드에서 기존 숨기기 문을 다음으로 바꿉니다.

    mute="MUTED"
  6. 적용을 클릭합니다. 숨겨진 발견 항목만 포함하도록 발견 항목 쿼리 결과 패널의 발견 항목이 업데이트됩니다.

  7. 필요한 경우 숨겨진 다른 발견 항목을 필터링합니다. 예를 들어 카테고리빠른 필터 패널에서 숨기기 취소해야 하는 발견 항목의 이름을 선택하여 다른 모든 발견 항목 카테고리를 필터링합니다.

  8. 숨기기를 취소하려는 발견 항목 옆에 있는 체크박스를 선택합니다. 하나 이상의 발견 항목을 선택할 수 있습니다.

  9. 발견 항목 쿼리 결과 작업 모음에서 숨기기 옵션을 클릭한 후 숨기기 취소를 선택합니다.

    선택한 발견 항목의 mute 속성이 UNMUTED로 설정되고 발견 항목 쿼리 결과 패널에서 발견 항목이 삭제됩니다.

또는 세부정보 패널에서 발견 항목을 숨기기 취소할 수 있습니다.

  1. 발견 항목 페이지의 발견 항목 쿼리 결과 패널에 있는 카테고리 열에서 개별 발견 항목 이름을 클릭합니다. 발견 항목의 세부정보 패널이 열립니다.
  2. 조치 취하기를 클릭합니다.
  3. 조치 취하기 메뉴에서 숨기기 취소를 선택합니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 발견 항목의 숨기기 상태를 UNMUTED로 설정하고 gcloud CLI에서 set-mute 명령어를 사용합니다.

    gcloud scc findings set-mute FINDING_ID \
     --PARENT=PARENT_ID \
     --location=LOCATION --source=SOURCE_ID \
     --mute=UNMUTED
    

    다음을 바꿉니다.

    • FINDING_ID: 숨기려는 발견 항목의 ID입니다.

      발견 항목 ID를 찾으려면 Security Command Center API를 사용해서 발견 항목을 나열합니다. 발견 항목 ID는 canonicalName 속성의 마지막 부분입니다. 예를 들면 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9입니다.

    • PARENT: 상위 리소스(project, folder, organization)입니다. 대소문자를 구분합니다.

    • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.

    • LOCATION: 데이터 상주가 사용 설정된 경우 발견 항목이 저장되는 Security Command Center 위치를 지정합니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 발견 항목이 숨기기 취소되며 플래그에 유효한 유일한 값은 global입니다.

    • SOURCE_ID: 소스 ID입니다.

      소스 ID 가져오기에 대한 안내는 소스 ID 가져오기를 참조하세요.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// setUnmute unmutes an individual finding.
// Unmuting a finding that isn't muted has no effect.
// Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
func setUnmute(w io.Writer, findingPath string) error {
	// findingPath: The relative resource name of the finding. See:
	// https://cloud.google.com/apis/design/resource_names#relative_resource_name
	// Use any one of the following formats:
	//  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
	//  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
	//  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
	// findingPath := fmt.Sprintf("projects/%s/sources/%s/finding/%s", "your-google-cloud-project-id", "source", "finding-id")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.SetMuteRequest{
		Name: findingPath,
		Mute: securitycenterpb.Finding_UNMUTED}

	finding, err := client.SetMute(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to set the specified mute value: %w", err)
	}
	fmt.Fprintf(w, "Mute value for the finding: %s is %s", finding.Name, finding.Mute)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.Finding;
import com.google.cloud.securitycenter.v1.Finding.Mute;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import com.google.cloud.securitycenter.v1.SetMuteRequest;
import java.io.IOException;

public class SetUnmuteFinding {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}

    // findingPath: The relative resource name of the finding. See:
    // https://cloud.google.com/apis/design/resource_names#relative_resource_name
    // Use any one of the following formats:
    //  - organizations/{organization_id}/sources/{source_id}/finding/{finding_id}
    //  - folders/{folder_id}/sources/{source_id}/finding/{finding_id}
    //  - projects/{project_id}/sources/{source_id}/finding/{finding_id}
    String findingPath = "{path-to-the-finding}";
    setUnmute(findingPath);
  }

  // Unmute an individual finding.
  // Unmuting a finding that isn't muted has no effect.
  // Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
  public static Finding setUnmute(String findingPath) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      SetMuteRequest setMuteRequest =
          SetMuteRequest.newBuilder().setName(findingPath).setMute(Mute.UNMUTED).build();

      Finding finding = client.setMute(setMuteRequest);
      System.out.println(
          "Mute value for the finding " + finding.getName() + " is: " + finding.getMute());
      return finding;
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def set_unmute_finding(finding_path: str) -> None:
    """
      Unmute an individual finding.
      Unmuting a finding that isn't muted has no effect.
      Various mute states are: MUTE_UNSPECIFIED/MUTE/UNMUTE.
    Args:
        finding_path: The relative resource name of the finding. See:
        https://cloud.google.com/apis/design/resource_names#relative_resource_name
        Use any one of the following formats:
        - organizations/{organization_id}/sources/{source_id}/finding/{finding_id},
        - folders/{folder_id}/sources/{source_id}/finding/{finding_id},
        - projects/{project_id}/sources/{source_id}/finding/{finding_id}.
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.SetMuteRequest()
    request.name = finding_path
    request.mute = securitycenter.Finding.Mute.UNMUTED

    finding = client.set_mute(request)
    print(f"Mute value for the finding: {finding.mute.name}")

REST API

Security Command Center API에서 setMute 메서드를 사용하여 발견 항목 숨기기를 취소합니다. 요청 본문은 발견 상목 숨기기 상태를 나타내는 enum입니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 setMute를 호출합니다.

POST https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/sources/SOURCE_ID/findings/FINDING_ID:setMute

{
  "mute": "UNMUTED"
}

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 setMute를 호출합니다.

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/sources/SOURCE_ID/locations/LOCATION/findings/FINDING_ID:setMute

{
  "mute": "UNMUTED"
}

다음을 바꿉니다.

  • PARENT: 상위 리소스(organizations, folders, projects)입니다.
  • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 발견 항목이 저장되는 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • SOURCE_ID: 소스의 숫자 ID입니다.

    소스 ID 가져오기에 대한 안내는 소스 ID 가져오기를 참조하세요.

  • FINDING_ID: 숨기려는 발견 항목의 ID입니다.

    발견 항목 ID를 찾으려면 Security Command Center API를 사용해서 발견 항목을 나열합니다. 발견 항목 ID는 canonicalName 속성의 마지막 부분입니다. 예를 들면 projects/123456789012/sources/1234567890123456789/findings/5ee30aa342e799e4e1700826de053aa9입니다.

선택한 발견 항목이 더 이상 숨겨져 있지 않으면 발견 항목의 mute 속성이 UNMUTED로 설정됩니다.

숨기기 취소된 발견 항목이 숨기기 규칙 재정의

사용자가 발견 항목을 숨기기 취소하면 기존 숨기기 규칙에 맞는 발견 항목이 발견되더라도 계속 숨기기 취소된 상태로 유지됩니다. 실제로 사용자가 숨기기 취소를 수행하면 숨기기 규칙이 재정의됩니다.

숨기기 취소된 발견 항목은 사용자가 발견 항목을 수동으로 숨기거나 Google Cloud 콘솔에서 이것과 일치하는 숨기기 규칙을 새로 만들 때만 다시 숨겨집니다. gcloud CLI 또는 Security Command Center API를 통해 생성된 숨기기 규칙은 사용자가 숨기기 취소한 발견 항목에 영향을 주지 않습니다.

여러 기존 발견 항목 숨기기

gcloud scc findings bulk-mute gcloud CLI 명령어 또는 Security Command Center API의 bulkMute 메서드를 사용하여 여러 기존 발견 항목을 일괄적으로 숨길 수 있습니다. 이후에도 비슷한 발견 항목을 숨기려면 숨기기 규칙을 만드세요.

발견 항목 필터를 정의하여 숨기려는 발견 항목 집합을 지정합니다. 대량 숨기기 필터에서는 일부 발견 항목 속성이 지원되지 않습니다. 지원되지 않는 속성 목록은 숨기기 규칙에 지원되지 않는 발견 항목 속성을 참조하세요.

Security Command Center에 데이터 상주가 사용 설정된 경우 대량 숨기기 작업은 해당 작업이 실행되는 Security Command Center 위치로 제한됩니다.

발견 항목을 일괄적으로 숨기는 샘플 코드는 발견 항목 대량 숨기기를 참조하세요.

발견 항목을 일괄적으로 숨기려면 사용하려는 절차의 탭을 클릭합니다.

Console

Google Cloud 콘솔에서는 숨기기 규칙을 만들어 발견 항목만 일괄로 숨길 수 있습니다. Google Cloud 콘솔에서 숨기기 규칙을 만들면 기존 및 이후 발견 항목이 숨겨집니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 발견 항목 여러 개를 일괄적으로 숨기려면 gcloud scc findings bulk-mute 명령어를 실행합니다.

    gcloud scc findings bulk-mute --PARENT=PARENT_ID \
    --location=LOCATION --filter="FILTER" \
    

    다음을 바꿉니다.

    • PARENT: 숨기기 규칙이 적용되는 리소스 계층 구조의 범위(organization, folder, project)입니다.
    • PARENT_ID: organizations/123, folders/456, projects/789 형식으로 지정된 상위 조직, 폴더 또는 프로젝트의 ID입니다.
    • LOCATION: 데이터 상주가 사용 설정된 경우 발견 항목을 대량으로 숨길 Security Command Center 위치를 지정합니다. 이 위치의 발견 항목만 숨겨집니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 발견 항목이 숨겨지고 플래그에 유효한 유일한 값은 global입니다.

    • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다.

    예를 들어 internal-test 프로젝트에서 심각도가 낮은 기존의 모든 OPEN_FIREWALLPUBLIC_IP_ADDRESS 발견 항목을 숨기려면 "category=\"OPEN_FIREWALL\" OR category=\"PUBLIC_IP_ADDRESS\" AND severity=\"LOW\" AND resource.project_display_name=\"internal-test\"" 필터를 사용할 수 있습니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// bulkMute kicks off a long-running operation (LRO) to bulk mute findings for a parent based on a filter.
// The parent can be either an organization, folder, or project. The findings
// matched by the filter will be muted after the LRO is done.
func bulkMute(w io.Writer, parent string, muteRule string) error {
	// parent: Use any one of the following options:
	//             - organizations/{organization_id}
	//             - folders/{folder_id}
	//             - projects/{project_id}
	// parent := fmt.Sprintf("projects/%s", "your-google-cloud-project-id")
	// muteRule: Expression that identifies findings that should be muted.
	// To create mute rules, see:
	// https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
	// muteRule := "filter-condition"
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.BulkMuteFindingsRequest{
		Parent: parent,
		Filter: muteRule,
	}

	op, err := client.BulkMuteFindings(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to bulk mute findings: %w", err)
	}
	response, err := op.Wait(ctx)
	if err != nil {
		return fmt.Errorf("failed to bulk mute findings: %w", err)
	}
	fmt.Fprintf(w, "Bulk mute findings completed successfully! %s", response)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.BulkMuteFindingsRequest;
import com.google.cloud.securitycenter.v1.BulkMuteFindingsResponse;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import java.io.IOException;
import java.util.concurrent.ExecutionException;

public class BulkMuteFindings {

  public static void main(String[] args) {
    // TODO: Replace the variables within {}

    // parentPath: Use any one of the following options:
    //             - organizations/{organization_id}
    //             - folders/{folder_id}
    //             - projects/{project_id}
    String parentPath = String.format("projects/%s", "your-google-cloud-project-id");

    // muteRule: Expression that identifies findings that should be muted.
    // eg: "resource.project_display_name=\"PROJECT_ID\""
    String muteRule = "{filter-condition}";

    bulkMute(parentPath, muteRule);
  }

  // Kicks off a long-running operation (LRO) to bulk mute findings for a parent based on a filter.
  // The parent can be either an organization, folder, or project. The findings
  // matched by the filter will be muted after the LRO is done.
  public static void bulkMute(String parentPath, String muteRule) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      BulkMuteFindingsRequest bulkMuteFindingsRequest =
          BulkMuteFindingsRequest.newBuilder()
              .setParent(parentPath)
              // To create mute rules, see:
              // https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
              .setFilter(muteRule)
              .build();

      // ExecutionException is thrown if the below call fails.
      BulkMuteFindingsResponse response =
          client.bulkMuteFindingsAsync(bulkMuteFindingsRequest).get();
      System.out.println("Bulk mute findings completed successfully! " + response);
    } catch (IOException | InterruptedException | ExecutionException e) {
      System.out.println("Bulk mute findings failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def bulk_mute_findings(parent_path: str, mute_rule: str) -> None:
    """
      Kicks off a long-running operation (LRO) to bulk mute findings for a parent based on a filter.
      The parent can be either an organization, folder, or project. The findings
      matched by the filter will be muted after the LRO is done.
    Args:
        parent_path: use any one of the following options:
                     - organizations/{organization}
                     - folders/{folder}
                     - projects/{project}
        mute_rule: Expression that identifies findings that should be updated.
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.BulkMuteFindingsRequest()
    request.parent = parent_path
    # To create mute rules, see:
    # https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
    request.filter = mute_rule

    response = client.bulk_mute_findings(request)
    print(f"Bulk mute findings completed successfully! : {response}")

REST API

Security Command Center API에서 bulkMute 메서드를 사용하여 여러 기존 발견 항목을 숨깁니다. 요청 본문에는 발견 항목을 필터링하는 데 사용되는 표현식이 포함되어 있습니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 bulkMute를 호출합니다.

POST https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/findings:bulkMute -d

{
  "filter": "FILTER"
}

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 bulkMute를 호출합니다.

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/findings:bulkMute -d

{
  "filter": "FILTER"
}

다음을 바꿉니다.

  • PARENT: 상위 리소스(organizations, folders, projects)입니다.
  • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 발견 항목이 저장되는 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다.

    예를 들어 internal-test 프로젝트에서 심각도가 낮은 기존의 모든 OPEN_FIREWALLPUBLIC_IP_ADDRESS 발견 항목을 숨기려면 "category=\"OPEN_FIREWALL\" OR category=\"PUBLIC_IP_ADDRESS\" AND severity=\"LOW\" AND resource.project_display_name=\"internal-test\"" 필터를 사용할 수 있습니다.

선택한 리소스에 있는 모든 기존 발견 항목 그리고 필터와 정확하게 일치하는 발견 항목이 숨겨집니다. 발견 항목의 mute 속성은 MUTED로 설정됩니다.

발견 항목을 숨겨도 발견 항목 상태가 변경되지 않습니다. 활성 발견 항목을 숨기면 발견 항목이 숨겨지더라도 기본 취약점, 잘못된 구성, 위협이 해결될 때까지 활성 상태로 유지됩니다.

숨기기 규칙 만들기

숨기기 규칙은 지정한 기준에 따라 이후의 발견 항목을 자동으로 숨기기 위해 만든 필터가 사용되는 Security Command Center 구성입니다. 숨기기 필터와 일치하는 새 발견 항목은 계속해서 자동으로 숨겨집니다. 비슷한 기존 발견 항목도 숨기려면 동일한 필터를 사용하여 발견 항목을 대량으로 숨길 수 있습니다.

숨기기 규칙의 범위

필터를 만들 때 숨기기 규칙의 범위를 고려하세요.

예를 들어 필터가 Project A의 발견 항목을 숨기도록 작성되었지만 필터 자체가 Project B에서 작성된 경우에는 해당 필터로 어떤 발견 항목도 일치하지 않을 수 있습니다.

마찬가지로 데이터 상주가 사용 설정되면 숨기기 규칙의 범위가 숨기기 규칙이 생성되는 Security Command Center 위치로 제한됩니다. 예를 들어 미국(us)에서 숨기기 규칙을 만든 경우 이 숨기기 규칙은 유럽 연합(eu) 또는 전역(global)에 저장된 발견 항목을 숨기지 않습니다. 데이터 상주 및 숨기기 규칙에 대한 자세한 내용은 숨기기 규칙, 지속적 내보내기, 데이터 상주를 참조하세요.

필터 만들기에 대한 자세한 내용은 필터 알림을 참조하세요.

숨기기 규칙 제한사항

숨기기 규칙에서는 일부 발견 항목 속성이 지원되지 않습니다. 숨기기 규칙이 지원하지 않는 속성 목록은 숨기기 규칙에 지원되지 않는 발견 항목 속성을 참조하세요.

조직은 최대 1,000개까지 숨기기 규칙을 만들 수 있습니다.

데이터 상주 및 숨기기 규칙

데이터 상주가 사용 설정된 경우 숨기기 규칙을 정의하는 구성(muteConfig 리소스)에 데이터 상주 제어가 적용되며 선택한 Security Command Center 위치에 저장됩니다.

Security Command Center 위치의 발견 항목에 숨기기 규칙을 적용하려면 적용되는 발견 항목과 동일한 위치에 숨기기 규칙을 만들어야 합니다.

숨기기 규칙에 사용되는 필터는 상주 제어가 적용되는 데이터를 포함할 수 있으므로 만들기 전에 올바른 위치를 지정해야 합니다. Security Command Center는 숨기기 규칙 또는 스트리밍 내보내기를 만들 위치를 제한하지 않습니다.

숨기기 규칙은 생성된 위치에만 저장되며 다른 위치에서 보거나 수정할 수 없습니다.

숨기기 규칙을 만든 후에는 위치를 변경할 수 없습니다. 위치를 변경하려면 숨기기 규칙을 삭제하고 새 위치에 다시 만들어야 합니다.

Google Cloud 콘솔에서 숨기기 규칙을 보려면 먼저 Google Cloud 콘솔 뷰를 생성된 위치로 설정해야 합니다.

숨기기 규칙 MuteConfig의 API 표현에도 동일한 규칙이 적용됩니다.

API 호출을 사용하여 MuteConfig를 검색하려면 MuteConfig의 전체 리소스 이름에서 위치를 지정해야 합니다. 예를 들면 다음과 같습니다.

GET https://securitycenter.googleapis.com/v2/{name=organizations/123/locations/eu/muteConfigs/my-mute-rule-01}

마찬가지로 gcloud CLI를 사용하여 muteConfig를 검색하려면 --locations 플래그를 사용하여 위치를 지정하면 됩니다. 예를 들면 다음과 같습니다.

gcloud scc muteconfigs list --organizations=123
--location=us

숨기기 규칙 만들기

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 숨기기 규칙을 만들 수 있습니다.

숨기기 규칙을 만드는 샘플 코드는 숨기기 규칙 만들기를 참조하세요.

숨기기 규칙을 만들려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔에서 Security Command Center 발견 항목 페이지로 이동합니다.

    발견 항목으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다.

    프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 숨기기 규칙을 만들 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 숨기기 옵션을 클릭한 후 숨기기 규칙 만들기를 선택합니다.

  5. 숨기기 규칙 ID를 입력합니다. 이 값은 필수 항목입니다.

  6. 발견 항목이 숨겨진 이유에 대한 컨텍스트를 제공하는 숨기기 규칙 설명을 입력합니다. 이 값은 선택사항이지만 권장됩니다.

  7. 상위 리소스는 숨기기 규칙이 생성되고 적용되는 범위를 나타냅니다.

  8. 발견 항목 쿼리 필드에서 필터 추가를 클릭하여 쿼리 문을 빌드합니다. 또는 쿼리 문을 수동으로 입력할 수 있습니다.

    필터 선택 대화상자에서는 지원되는 발견 항목 속성 및 값을 선택할 수 있습니다. 쿼리 필터 대화상자

    1. 발견 항목 속성 검색 상자에서 발견 항목 속성을 선택하거나 해당 이름을 입력합니다. 사용 가능한 하위 속성 목록이 표시됩니다.
    2. 하위 속성을 선택합니다. 평가 옵션의 선택 필드가 발견 항목 쿼리 결과 패널의 발견 항목에 있는 하위 속성 값 목록 위에 표시됩니다.
    3. 선택한 하위 속성의 값에 대한 평가 옵션을 선택합니다. 평가 옵션과 여기에 사용되는 연산자 및 함수에 대한 자세한 내용은 필터 추가 메뉴의 쿼리 연산자를 참조하세요.
    4. 적용을 선택합니다.

      대화상자가 닫히고 쿼리가 업데이트됩니다.

    5. 발견 항목 쿼리에 원하는 모든 속성이 포함될 때까지 반복합니다.
  9. 필터가 정확한지 검토합니다. 변경이 필요하면 필요에 따라 속성 및 필터 값을 삭제 또는 추가합니다.

  10. 일치하는 발견 항목 미리보기를 클릭합니다.

    테이블에 쿼리와 일치하는 발견 항목이 표시됩니다.

  11. 저장을 클릭합니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 숨기기 규칙을 만들려면 gcloud scc muteconfigs create 명령어를 실행합니다.

    gcloud scc muteconfigs create CONFIG_ID \
    --PARENT=PARENT_ID \
    --location=LOCATION
    --description="RULE_DESCRIPTION" \
    --filter="FILTER"
    

    다음을 바꿉니다.

    • CONFIG_ID: 숨기기 규칙의 이름입니다. ID는 영숫자 문자와 하이픈을 사용해야 하며 1~63자여야 합니다.
    • PARENT: 숨기기 규칙이 적용되는 리소스 계층 구조의 범위(organization, folder, project)입니다.
    • PARENT_ID: organizations/123, folders/456, projects/789 형식으로 지정된 상위 조직, 폴더 또는 프로젝트의 ID입니다.
    • LOCATION: 데이터 상주가 사용 설정된 경우 숨기기 규칙을 만들 Security Command Center 위치를 지정합니다. 숨기기 규칙 구성이 저장되어 이 위치의 발견 항목에만 적용됩니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 숨기기 규칙이 생성되고 플래그에 유효한 유일한 값은 global입니다.

    • RULE_DESCRIPTION: 1,024자 이하의 숨기기 규칙에 대한 설명입니다.

    • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다. 예를 들어 OPEN_FIREWALL 발견 항목을 숨기려면 FILTER="category=\"OPEN_FIREWALL\"" 필터를 사용할 수 있습니다.

    응답에는 숨기기 규칙 관리에 설명된 대로 숨기기 규칙을 확인, 업데이트, 삭제하기 위해 사용할 수 있는 숨기기 규칙 ID가 포함되어 있습니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// createMuteRule: Creates a mute configuration under a given scope that will mute
// all new findings that match a given filter.
// Existing findings will not be muted.
func createMuteRule(w io.Writer, parent string, muteConfigId string) error {
	// parent: Use any one of the following options:
	//             - organizations/{organization_id}
	//             - folders/{folder_id}
	//             - projects/{project_id}
	// parent := fmt.Sprintf("projects/%s", "your-google-cloud-project-id")
	// muteConfigId: Set a random id; max of 63 chars.
	// muteConfigId := "random-mute-id-" + uuid.New().String()
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	muteConfig := &securitycenterpb.MuteConfig{
		Description: "Mute low-medium IAM grants excluding 'compute' ",
		// Set mute rule(s).
		// To construct mute rules and for supported properties, see:
		// https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
		Filter: "severity=\"LOW\" OR severity=\"MEDIUM\" AND " +
			"category=\"Persistence: IAM Anomalous Grant\" AND " +
			"-resource.type:\"compute\"",
	}

	req := &securitycenterpb.CreateMuteConfigRequest{
		Parent:       parent,
		MuteConfigId: muteConfigId,
		MuteConfig:   muteConfig,
	}

	response, err := client.CreateMuteConfig(ctx, req)
	if err != nil {
		return fmt.Errorf("failed to create mute rule: %w", err)
	}
	fmt.Fprintf(w, "Mute rule created successfully: %s", response.Name)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.CreateMuteConfigRequest;
import com.google.cloud.securitycenter.v1.MuteConfig;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import java.io.IOException;
import java.util.UUID;

public class CreateMuteRule {

  public static void main(String[] args) {
    // TODO: Replace the variables within {}

    // parentPath: Use any one of the following options:
    //             - organizations/{organization_id}
    //             - folders/{folder_id}
    //             - projects/{project_id}
    String parentPath = String.format("projects/%s", "your-google-cloud-project-id");

    // muteConfigId: Set a random id; max of 63 chars.
    String muteConfigId = "random-mute-id-" + UUID.randomUUID();
    createMuteRule(parentPath, muteConfigId);
  }

  // Creates a mute configuration under a given scope that will mute
  // all new findings that match a given filter.
  // Existing findings will not be muted.
  public static void createMuteRule(String parentPath, String muteConfigId) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      MuteConfig muteConfig =
          MuteConfig.newBuilder()
              .setDescription("Mute low-medium IAM grants excluding 'compute' ")
              // Set mute rule(s).
              // To construct mute rules and for supported properties, see:
              // https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
              .setFilter(
                  "severity=\"LOW\" OR severity=\"MEDIUM\" AND "
                      + "category=\"Persistence: IAM Anomalous Grant\" AND "
                      + "-resource.type:\"compute\"")
              .build();

      CreateMuteConfigRequest request =
          CreateMuteConfigRequest.newBuilder()
              .setParent(parentPath)
              .setMuteConfigId(muteConfigId)
              .setMuteConfig(muteConfig)
              .build();

      // ExecutionException is thrown if the below call fails.
      MuteConfig response = client.createMuteConfig(request);
      System.out.println("Mute rule created successfully: " + response.getName());
    } catch (IOException e) {
      System.out.println("Mute rule creation failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.



def create_mute_rule(parent_path: str, mute_config_id: str) -> None:
    """
    Creates a mute configuration under a given scope that will mute
    all new findings that match a given filter.
    Existing findings will NOT BE muted.
    Args:
        parent_path: use any one of the following options:
                     - organizations/{organization_id}
                     - folders/{folder_id}
                     - projects/{project_id}
        mute_config_id: Set a unique id; max of 63 chars.
    """

    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    mute_config = securitycenter.MuteConfig()
    mute_config.description = "Mute low-medium IAM grants excluding 'compute' "
    # Set mute rule(s).
    # To construct mute rules and for supported properties, see:
    # https://cloud.google.com/security-command-center/docs/how-to-mute-findings#create_mute_rules
    mute_config.filter = (
        'severity="LOW" OR severity="MEDIUM" AND '
        'category="Persistence: IAM Anomalous Grant" AND '
        '-resource.type:"compute"'
    )

    request = securitycenter.CreateMuteConfigRequest()
    request.parent = parent_path
    request.mute_config_id = mute_config_id
    request.mute_config = mute_config

    mute_config = client.create_mute_config(request=request)
    print(f"Mute rule created successfully: {mute_config.name}")

REST API

Security Command Center API에서 muteConfigs create 메서드를 사용하여 숨기기 규칙을 만듭니다. 요청 본문은 MuteConfig의 인스턴스입니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 버전 1 엔드포인트를 사용하여 muteConfigs create를 호출합니다. 요청 본문에서 버전 1 MuteConfig 정의를 사용합니다.

POST https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/muteConfigs?muteConfigId=MUTE_CONFIG_ID -d

  {
    "description": "RULE_DESCRIPTION",
    "filter": FILTER
  }

Security Command Center API v2를 사용하는 경우 버전 2 엔드포인트를 사용하여 muteConfigs create를 호출합니다. 요청 본문에서 버전 2 MuteConfig 정의를 사용합니다.

POST https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/muteConfigs?muteConfigId=MUTE_CONFIG_ID -d

  {
    "description": "RULE_DESCRIPTION",
    "filter": FILTER
    "type": "STATIC"
  }

다음을 바꿉니다.

  • PARENT: 숨기기 규칙의 상위 리소스입니다(organizations, folders, projects).
  • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 숨기기 규칙이 적용되는 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • MUTE_CONFIG_ID: 숨기기 규칙의 이름입니다(1~63자).
  • RULE_DESCRIPTION: 숨기기 규칙에 대한 설명입니다(최대 1,024자).
  • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다.

    예를 들어 OPEN_FIREWALL 발견 항목을 숨기려면 "category=\"OPEN_FIREWALL\"" 필터를 사용할 수 있습니다.

응답에는 숨기기 규칙 관리에 설명된 대로 숨기기 규칙을 확인, 업데이트, 삭제하기 위해 사용할 수 있는 숨기기 구성 ID가 포함되어 있습니다.

필터와 정확하게 일치하는 새 발견 항목이 숨겨지고 이 발견 항목의 mute 속성이 MUTED로 설정됩니다.

숨기기 규칙에 지원되지 않는 발견 항목 속성

숨기기 규칙에서는 필터의 모든 발견 항목 속성이 지원되지 않습니다. 다음 속성은 숨기기 규칙 필터에서 지원되지 않습니다.

  • createTime
  • eventTime
  • mute
  • mute_initiator
  • mute_update_time
  • name
  • parent
  • security_marks
  • source_properties
  • state

발견 항목 숨기기 속성

이 섹션에서는 발견 항목 숨기기 속성을 보여주고 숨기기 작업으로 어떤 영향을 받는지 설명합니다.

  • mute: 발견 항목이 생성되고 다음 시나리오에서 변경될 때 UNDEFINED로 설정됩니다.
    • MUTED: 수동으로 또는 숨기기 규칙에 따라 발견 항목이 숨겨집니다.
    • UNMUTED: 사용자가 발견 항목을 숨기기 취소합니다.
  • mute_update_time: 발견 항목이 숨겨지거나 숨기기 취소되는 시간입니다.
  • mute_initiator: 발견 항목을 숨긴 주 구성원 또는 숨기기 규칙의 식별자입니다.

숨겨진 발견 항목에 대한 알림 중지

발견 항목 알림을 사용 설정하면 여전히 알림 필터와 일치하는 숨겨진 발견 항목에 따라 Pub/Sub에서 알림이 트리거됩니다.

숨겨진 발견 항목에 대해 알림을 중지하려면 mute 속성을 사용하여 NotificationConfig 필터로 숨겨진 발견 항목을 제외합니다. 예를 들어 다음 필터는 숨겨지지 않았거나 숨기기 속성이 설정되지 않은 활성 발견 항목에 대해서만 알림을 전송합니다.

FILTER="state=\"ACTIVE\" AND -mute=\"MUTED\""

숨기기 규칙 관리

IAM 역할의 범위를 기준으로 숨기기 규칙을 확인, 업데이트, 삭제할 수 있습니다. 조직 수준 역할이 있으면 조직 내 모든 폴더 및 프로젝트에 대한 숨기기 규칙을 볼 수 있습니다. 폴더 수준 역할이 있으면 특정 폴더 및 해당 폴더 내의 모든 하위 폴더 및 프로젝트에 대해 규칙을 액세스하고 관리할 수 있습니다. 프로젝트 수준 역할이 있으면 특정 프로젝트에서 숨기기 규칙을 관리할 수 있습니다.

Security Command Center 프리미엄은 조직, 폴더, 프로젝트 수준에서 역할 부여를 지원합니다. Security Command Center 표준은 조직 수준에서 역할 부여만 지원합니다. 자세한 내용은 액세스 제어를 참조하세요.

숨기기 규칙 나열

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 조직, 폴더, 프로젝트의 숨기기 규칙을 나열할 수 있습니다.

특정 범위의 숨기기 규칙을 나열하는 기능은 IAM 역할에 부여된 권한에 따라 다릅니다.

Security Command Center에 데이터 상주가 사용 설정된 경우 list 명령어 범위도 선택된 Security Command Center 위치로 제한됩니다.

숨기기 규칙을 나열하는 샘플 코드는 숨기기 규칙 나열을 참조하세요.

조직, 폴더 또는 프로젝트의 숨기기 규칙을 나열하려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔의 Security Command Center 설정 페이지에서 숨기기 규칙 탭으로 이동합니다.

    숨기기 규칙으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다.

    프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 숨기기 규칙이 저장된 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 숨기기 규칙 섹션에 다음을 포함한 활성 숨기기 규칙의 세부정보가 표시됩니다.

    • 이름: 숨기기 규칙 ID입니다.
    • 상위 리소스: 숨기기 규칙이 있는 리소스입니다.
    • 설명: 사용 가능한 경우 숨기기 규칙에 대한 설명입니다.
    • 최종 업데이트 수행자: 규칙을 마지막으로 업데이트한 주 구성원입니다.
    • 최종 업데이트 시간: 규칙이 마지막으로 업데이트된 날짜 및 시간입니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 숨기기 규칙을 나열하려면 gcloud scc muteconfigs list 명령어를 실행합니다.

    gcloud scc muteconfigs list --PARENT=PARENT_ID --location=LOCATION
    

    다음을 바꿉니다.

    • PARENT: 숨기기 규칙을 나열할 상위 organization, folder, project입니다.
    • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
    • LOCATION: 데이터 상주가 사용 설정된 경우 숨기기 규칙을 나열할 Security Command Center 위치를 지정합니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 숨기기 규칙이 나열되고 플래그에 유효한 유일한 값은 global입니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
	"google.golang.org/api/iterator"
)

// listMuteRules lists mute configs at the organization level will return all the configs
// at the org, folder, and project levels.
// Similarly, listing configs at folder level will list all the configs
// at the folder and project levels.
func listMuteRules(w io.Writer, parent string) error {
	// Use any one of the following resource paths to list mute configurations:
	//         - organizations/{organization_id}
	//         - folders/{folder_id}
	//         - projects/{project_id}
	// parent := fmt.Sprintf("projects/%s", "your-google-cloud-project-id")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.ListMuteConfigsRequest{Parent: parent}

	// List all mute configs present in the resource.
	it := client.ListMuteConfigs(ctx, req)
	for {
		muteconfig, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			return fmt.Errorf("it.Next: %w", err)
		}
		fmt.Fprintf(w, "Muteconfig Name: %s, ", muteconfig.Name)
	}
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.ListMuteConfigsRequest;
import com.google.cloud.securitycenter.v1.MuteConfig;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import java.io.IOException;

public class ListMuteRules {

  public static void main(String[] args) {
    // TODO: Replace variables enclosed within {}

    // parent: Use any one of the following resource paths to list mute configurations:
    //         - organizations/{organization_id}
    //         - folders/{folder_id}
    //         - projects/{project_id}
    String parentPath = String.format("projects/%s", "your-google-cloud-project-id");
    listMuteRules(parentPath);
  }

  // Listing mute configs at the organization level will return all the configs
  // at the org, folder, and project levels.
  // Similarly, listing configs at folder level will list all the configs
  // at the folder and project levels.
  public static void listMuteRules(String parent) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      ListMuteConfigsRequest listMuteConfigsRequest =
          ListMuteConfigsRequest.newBuilder().setParent(parent).build();

      // List all mute configs present in the resource.
      for (MuteConfig muteConfig : client.listMuteConfigs(listMuteConfigsRequest).iterateAll()) {
        System.out.println(muteConfig.getName());
      }
    } catch (IOException e) {
      System.out.println("Listing Mute rule failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def list_mute_rules(parent: str) -> None:
    """
    Listing mute configs at organization level will return all the configs
    at the org, folder and project levels.
    Similarly, listing configs at folder level will list all the configs
    at the folder and project levels.
    Args:
        parent: Use any one of the following resource paths to list mute configurations:
                - organizations/{organization_id}
                - folders/{folder_id}
                - projects/{project_id}
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.ListMuteConfigsRequest()
    request.parent = parent

    # List all Mute Configs present in the resource.
    for mute_config in client.list_mute_configs(request):
        print(mute_config.name)

REST API

Security Command Center API에서 muteConfigs list 메서드를 사용하여 숨기기 규칙을 나열합니다. 요청 본문이 비어 있습니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 muteConfigs list를 호출합니다.

GET https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/muteConfigs

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 muteConfigs list를 호출합니다.

GET https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/muteConfigs

다음을 바꿉니다.

  • PARENT: 숨기기 규칙의 상위 리소스입니다(organizations, folders, projects).
  • PARENT_ID: 상위 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 숨기기 규칙을 나열할 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.

응답에는 숨기기 규칙에 대한 이름, 설명, 숨기기 구성 ID가 포함됩니다.

숨기기 규칙 구성 보기

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 숨기기 규칙 구성을 볼 수 있습니다.

숨기기 규칙 구성을 검색하는 샘플 코드는 숨기기 규칙 보기를 참조하세요.

숨기기 규칙 구성을 보려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔의 Security Command Center 설정 페이지에서 숨기기 규칙 탭으로 이동합니다.

    숨기기 규칙으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다.

    프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 숨기기 규칙의 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 숨기기 규칙 섹션에서 숨기기 규칙 목록을 확인합니다.

  5. 보려는 규칙의 이름을 클릭합니다.

    숨기기 규칙 구성이 포함된 페이지가 열립니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 숨기기 규칙의 구성을 보려면 gcloud scc muteconfigs get 명령어를 실행합니다.

    gcloud scc muteconfigs get MUTE_CONFIG_ID \
     --PARENT=PARENT_ID --location=LOCATION
    

    다음을 바꿉니다.

    • MUTE_CONFIG_ID: 숨기기 규칙의 ID입니다.
    • PARENT: 숨기기 규칙의 상위 리소스입니다(organization, folder, project).
    • PARENT_ID: 조직, 폴더, 프로젝트의 ID
    • LOCATION: 데이터 상주가 사용 설정된 경우 숨기기 규칙이 저장되는 Security Command Center 위치를 지정합니다. 기본값은 global입니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 숨기기 규칙을 가져오고 플래그에 유효한 유일한 값은 global입니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// getMuteRule retrieves a mute configuration given its resource name.
func getMuteRule(w io.Writer, parent string, muteConfigId string) error {
	// Use any one of the following resource paths to get mute configuration:
	//         - organizations/{organization_id}
	//         - folders/{folder_id}
	//         - projects/{project_id}
	// parent := fmt.Sprintf("projects/%s", "your-google-cloud-project-id")
	//
	// Name of the mute config to retrieve.
	// muteConfigId := "mute-config-id"
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.GetMuteConfigRequest{
		Name: fmt.Sprintf("%s/muteConfigs/%s", parent, muteConfigId),
	}

	muteconfig, err := client.GetMuteConfig(ctx, req)
	if err != nil {
		return fmt.Errorf("Failed to retrieve Muteconfig: %w", err)
	}
	fmt.Fprintf(w, "Muteconfig Name: %s ", muteconfig.Name)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.MuteConfig;
import com.google.cloud.securitycenter.v1.MuteConfigName;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import java.io.IOException;

public class GetMuteRule {

  public static void main(String[] args) {
    // TODO(Developer): Replace the following variables

    // parentPath: Use any one of the following options:
    //             - organizations/{organization_id}
    //             - folders/{folder_id}
    //             - projects/{project_id}
    String parentPath = String.format("projects/%s", "your-google-cloud-project-id");

    // muteConfigId: Name of the mute config to retrieve.
    String muteConfigId = "mute-config-id";

    getMuteRule(parentPath, muteConfigId);
  }

  // Retrieves a mute configuration given its resource name.
  public static void getMuteRule(String projectId, String muteConfigId) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Use appropriate MuteConfigName methods depending on the type of parent.
      // (org -> MuteConfigName.ofOrganizationMuteConfigName()
      // folder -> MuteConfigName.ofFolderMuteConfigName()
      // project -> MuteConfigName.ofProjectMuteConfigName)
      MuteConfig muteConfig =
          client.getMuteConfig(MuteConfigName.ofProjectMuteConfigName(projectId, muteConfigId));

      System.out.println("Retrieved the mute config: " + muteConfig);
    } catch (IOException e) {
      System.out.println("Mute rule retrieval failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def get_mute_rule(mute_config_name: str) -> None:
    """
    Retrieves a mute configuration given its resource name.
    Args:
        mute_config_name: Name of the mute config to retrieve.
                          Use any one of the following formats:
                          - organizations/{organization}/muteConfigs/{config_id}
                          - folders/{folder}/muteConfigs/{config_id}
                          - projects/{project}/muteConfigs/{config_id}
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.GetMuteConfigRequest()
    request.name = mute_config_name

    mute_config = client.get_mute_config(request)
    print(f"Retrieved the mute rule: {mute_config.name}")

REST API

Security Command Center API에서 muteConfigs get 메서드를 사용하여 숨기기 규칙의 구성을 반환합니다. 요청 본문이 비어 있습니다.

숨기기 규칙의 CONFIG_ID를 가져오려면 먼저 숨기기 규칙을 나열하는 API 호출을 수행합니다. 응답에는 반환된 숨기기 규칙의 구성 ID가 포함됩니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 muteConfigs get를 호출합니다.

GET https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/muteConfigs/CONFIG_ID

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 muteConfigs get를 호출합니다.

GET https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/muteConfigs/CONFIG_ID

다음을 바꿉니다.

  • PARENT: 숨기기 규칙의 상위 리소스입니다(organizations, folders, projects).
  • PARENT_ID: 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 숨기기 규칙이 저장된 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • CONFIG_ID: 숨기기 규칙의 숫자 ID입니다.

숨기기 규칙 업데이트

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 숨기기 규칙의 설명 또는 발견 항목 필터를 업데이트할 수 있습니다.

숨기기 규칙의 ID, 상위 조직, 폴더, 프로젝트, 위치를 변경할 수 없습니다. 이러한 값을 변경하려면 새 숨기기 규칙을 만들어야 합니다.

이전에 발견 항목을 숨기기 취소했지만 Google Cloud 콘솔에서 업데이트된 숨기기 규칙과 일치할 경우에는 다시 숨겨집니다. 자세한 내용은 숨기기 취소된 발견 항목이 숨기기 규칙 재정의를 참조하세요.

숨기기 규칙을 업데이트하는 샘플 코드는 숨기기 규칙 업데이트를 참조하세요.

숨기기 규칙을 업데이트하려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔의 Security Command Center 설정 페이지에서 숨기기 규칙 탭으로 이동합니다.

    숨기기 규칙으로 이동

  2. 수정하려는 숨기기 규칙의 상위 리소스인 Google Cloud 프로젝트 또는 조직을 선택합니다. 프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 숨기기 규칙의 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 수정하려는 숨기기 규칙의 이름을 클릭합니다.

    적절한 프로젝트 또는 조직을 선택하지 않았으면 숨기기 규칙을 수정할 수 있는 권한이 없다는 메시지가 표시될 수 있습니다.

  5. 새 설명을 입력한 후 저장을 클릭합니다.

  6. 필터를 업데이트하거나 변경합니다.

    자세한 내용은 숨기기 규칙 만들기를 참조하세요.

  7. 업데이트된 필터와 일치하는 발견 항목을 보려면 일치하는 발견 항목 미리보기를 클릭합니다.

    새 쿼리와 일치하는 발견 항목이 포함된 테이블이 로드됩니다.

  8. 저장을 클릭합니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 숨기기 규칙을 업데이트하려면 gcloud scc muteconfigs update 명령어를 실행합니다.

      gcloud scc muteconfigs update MUTE_CONFIG_ID \
        --PARENT=PARENT_ID \
        --location=LOCATION
        --description=RULE_DESCRIPTION \
        --filter=FILTER
    

    다음을 바꿉니다.

    • MUTE_CONFIG_ID: 숨기기 규칙의 ID입니다.
    • PARENT: 숨기기 규칙의 상위 리소스입니다(organization, folder, project).
    • PARENT_ID: 조직, 폴더, 프로젝트의 ID입니다.
    • LOCATION: 데이터 상주가 사용 설정된 경우 숨기기 규칙이 저장되는 Security Command Center 위치를 지정합니다. 기본값은 global입니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 숨기기 규칙 구성이 업데이트되고 플래그에 유효한 유일한 값은 global입니다.

    • RULE_DESCRIPTION: 숨기기 규칙에 대한 설명입니다(최대 1,024자).

    • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다.

      예를 들어 OPEN_FIREWALL 발견 항목을 숨기려면 FILTER="category=\"OPEN_FIREWALL\"" 필터를 사용할 수 있습니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
	"google.golang.org/protobuf/types/known/fieldmaskpb"
)

// updateMuteRule Updates an existing mute configuration.
// The following can be updated in a mute config: description and filter.
func updateMuteRule(w io.Writer, muteConfigName string) error {
	// Specify the name of the mute config to delete.
	// muteConfigName: Use any one of the following formats:
	//                 - organizations/{organization}/muteConfigs/{config_id}
	//                 - folders/{folder}/muteConfigs/{config_id}
	//                 - projects/{project}/muteConfigs/{config_id}
	// muteConfigName := fmt.Sprintf("projects/%s/muteConfigs/%s", "project-id", "mute-config")
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	updateMuteConfig := &securitycenterpb.MuteConfig{
		Name:        muteConfigName,
		Description: "Updated mute config description",
	}

	req := &securitycenterpb.UpdateMuteConfigRequest{
		MuteConfig: updateMuteConfig,
		// Set the update mask to specify which properties of the mute config should be
		// updated.
		// If empty, all mutable fields will be updated.
		// Make sure that the mask fields match the properties changed in 'updateMuteConfig'.
		// For more info on constructing update mask path, see the proto or:
		// https://cloud.google.com/security-command-center/docs/reference/rest/v1/folders.muteConfigs/patch?hl=en#query-parameters
		UpdateMask: &fieldmaskpb.FieldMask{
			Paths: []string{
				"description",
			},
		},
	}

	response, err := client.UpdateMuteConfig(ctx, req)
	if err != nil {
		return fmt.Errorf("mute rule update failed! %v", err)
	}
	fmt.Fprintf(w, "Mute rule updated %s", response.Name)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.MuteConfig;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import com.google.cloud.securitycenter.v1.UpdateMuteConfigRequest;
import com.google.protobuf.FieldMask;
import java.io.IOException;

public class UpdateMuteRule {

  public static void main(String[] args) {
    // TODO: Replace the variables within {}

    // Specify the name of the mute config to delete.
    // muteConfigName: Use any one of the following formats:
    //                 - organizations/{organization}/muteConfigs/{config_id}
    //                 - folders/{folder}/muteConfigs/{config_id}
    //                 - projects/{project}/muteConfigs/{config_id}
    String muteConfigName = "{any-one-of-the-above-formats}";
    updateMuteRule(muteConfigName);
  }

  // Updates an existing mute configuration.
  // The following can be updated in a mute config: description and filter.
  public static void updateMuteRule(String muteConfigName) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {

      MuteConfig updateMuteConfig =
          MuteConfig.newBuilder()
              .setName(muteConfigName)
              .setDescription("Updated mute config description")
              .build();

      UpdateMuteConfigRequest updateMuteConfigRequest =
          UpdateMuteConfigRequest.newBuilder()
              .setMuteConfig(updateMuteConfig)
              // Set the update mask to specify which properties of the mute config should be
              // updated.
              // If empty, all mutable fields will be updated.
              // Make sure that the mask fields match the properties changed in 'updateMuteConfig'.
              // For more info on constructing update mask path, see the proto or:
              // https://cloud.google.com/security-command-center/docs/reference/rest/v1/folders.muteConfigs/patch?hl=en#query-parameters
              .setUpdateMask(FieldMask.newBuilder().addPaths("description").build())
              .build();

      MuteConfig response = securityCenterClient.updateMuteConfig(updateMuteConfigRequest);
      System.out.println(response);
    } catch (IOException e) {
      System.out.println("Mute rule update failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def update_mute_rule(mute_config_name: str) -> None:
    """
    Updates an existing mute configuration.
    The following can be updated in a mute config: description, and filter/ mute rule.
    Args:
        mute_config_name: Specify the name of the mute config to delete.
                          Use any one of the following formats:
                          - organizations/{organization}/muteConfigs/{config_id}
                          - folders/{folder}/muteConfigs/{config_id}
                          - projects/{project}/muteConfigs/{config_id}
    """
    from google.cloud import securitycenter
    from google.protobuf import field_mask_pb2

    client = securitycenter.SecurityCenterClient()

    update_mute_config = securitycenter.MuteConfig()
    update_mute_config.name = mute_config_name
    update_mute_config.description = "Updated mute config description"

    field_mask = field_mask_pb2.FieldMask(paths=["description"])

    request = securitycenter.UpdateMuteConfigRequest()
    request.mute_config = update_mute_config
    # Set the update mask to specify which properties of the Mute Config should be updated.
    # If empty, all mutable fields will be updated.
    # Make sure that the mask fields match the properties changed in 'update_mute_config'.
    # For more info on constructing update mask path, see the proto or:
    # https://cloud.google.com/security-command-center/docs/reference/rest/v1/folders.muteConfigs/patch?hl=en#query-parameters
    request.update_mask = field_mask

    mute_config = client.update_mute_config(request)
    print(f"Updated mute rule : {mute_config}")

REST API

Security Command Center API에서 muteConfigs patch 메서드를 사용하여 숨기기 규칙을 업데이트합니다. 요청 본문은 MuteConfig의 인스턴스입니다.

숨기기 규칙의 CONFIG_ID를 가져오려면 숨기기 규칙을 나열하는 API 호출을 수행합니다. 응답에는 반환된 숨기기 규칙의 구성 ID가 포함됩니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 muteConfigs patch를 호출합니다.

PATCH https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/muteConfigs/CONFIG_ID

  {
    "description": "RULE_DESCRIPTION",
    "filter": "FILTER",
    "type": "STATIC"
  }

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 muteConfigs patch를 호출합니다.

PATCH https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/muteConfigs/CONFIG_ID

  {
    "description": "RULE_DESCRIPTION",
    "filter": "FILTER",
  }

다음을 바꿉니다.

  • PARENT: 숨기기 규칙의 상위 리소스입니다(organizations, folders, projects).
  • PARENT_ID: 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 숨기기 규칙이 저장된 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • CONFIG_ID: 숨기기 규칙의 숫자 ID입니다.
  • RULE_DESCRIPTION: 숨기기 규칙에 대한 설명입니다(최대 1,024자).
  • FILTER: 발견 항목을 필터링하기 위해 정의하는 표현식입니다.

    예를 들어 OPEN_FIREWALL 발견 항목을 숨기려면 "category=\"OPEN_FIREWALL\"" 필터를 사용할 수 있습니다.

필터와 정확하게 일치하는 새 발견 항목이 숨겨지고 이 발견 항목의 mute 속성이 MUTED로 설정됩니다.

숨기기 규칙을 업데이트해도 이전 규칙으로 숨겨진 모든 발견 항목이 자동으로 숨기기 취소되지는 않습니다. 수동으로 발견 항목을 숨기기 취소해야 합니다.

숨기기 규칙 삭제

Google Cloud 콘솔, gcloud CLI 또는 Security Command Center API를 사용하여 숨기기 규칙을 삭제할 수 있습니다.

숨기기 규칙을 삭제하려면 먼저 다음을 확인해야 합니다.

  • 삭제된 숨기기 규칙은 복구할 수 없습니다.
  • 숨기기 규칙을 삭제해도 숨겨진 발견 항목이 자동으로 숨기기 취소되지는 않습니다. 수동 또는 프로그래매틱 방식으로 발견 항목을 숨기기 취소해야 합니다.
  • 삭제된 숨기기 규칙의 필터와 일치하는 이후의 발견 항목은 숨겨지지 않습니다.

숨기기 규칙을 삭제하는 샘플 코드는 숨기기 규칙 삭제를 참조하세요.

숨기기 규칙을 삭제하려면 사용하려는 절차의 탭을 클릭합니다.

Console

  1. Google Cloud 콘솔의 Security Command Center 설정 페이지에서 숨기기 규칙 탭으로 이동합니다.

    숨기기 규칙으로 이동

  2. 필요한 경우 Google Cloud 프로젝트 또는 조직을 선택합니다.

    프로젝트 선택기

  3. Security Command Center에 데이터 상주가 사용 설정된 경우 프로젝트 선택기 바로 아래에 있는 위치 선택기를 사용하여 숨기기 규칙이 저장된 Security Command Center 위치를 선택합니다. 예를 들면 다음과 같습니다.

    위치 선택기 스크린샷

  4. 삭제하려는 숨기기 규칙의 이름을 클릭합니다.

  5. 삭제를 클릭합니다.

  6. 대화상자를 읽고 맞으면 삭제를 클릭합니다.

gcloud

  1. Google Cloud 콘솔에서 Cloud Shell을 활성화합니다.

    Cloud Shell 활성화

    Google Cloud 콘솔 하단에서 Cloud Shell 세션이 시작되고 명령줄 프롬프트가 표시됩니다. Cloud Shell은 Google Cloud CLI가 사전 설치된 셸 환경으로, 현재 프로젝트의 값이 이미 설정되어 있습니다. 세션이 초기화되는 데 몇 초 정도 걸릴 수 있습니다.

  2. 숨기기 규칙을 삭제하려면 gcloud scc muteconfigs delete 명령어를 실행합니다.

    gcloud scc muteconfigs delete MUTE_CONFIG_ID \
     --PARENT=PARENT_ID --location=LOCATION
    

    다음을 바꿉니다.

    • MUTE_CONFIG_ID: 숨기기 구성의 ID입니다.
    • PARENT: 숨기기 규칙의 상위 리소스입니다(organization, folder, project).
    • PARENT_ID: 조직, 폴더, 프로젝트의 ID입니다.
    • LOCATION: 데이터 상주가 사용 설정된 경우 숨기기 규칙 구성이 저장되는 Security Command Center 위치를 지정합니다. 기본값은 global입니다.

      데이터 상주가 사용 설정되지 않은 경우 --location 플래그를 지정하면 Security Command Center API v2를 사용하여 숨기기 규칙이 삭제되며 플래그에 유효한 유일한 값은 global입니다.

  3. 숨기기 규칙 삭제 요청을 확인합니다.

Go

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv1"
	"cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
)

// deleteMuteRule deletes a mute configuration given its resource name.
// Note: Previously muted findings are not affected when a mute config is deleted.
func deleteMuteRule(w io.Writer, parent string, muteConfigId string) error {
	// parent: Use any one of the following options:
	//             - organizations/{organization_id}
	//             - folders/{folder_id}
	//             - projects/{project_id}
	// parent := fmt.Sprintf("projects/%s", "your-google-cloud-project-id")
	//
	// muteConfigId: Specify the name of the mute config to delete.
	// muteConfigId := "mute-config-id"
	ctx := context.Background()
	client, err := securitycenter.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("securitycenter.NewClient: %w", err)
	}
	defer client.Close()

	req := &securitycenterpb.DeleteMuteConfigRequest{
		Name: fmt.Sprintf("%s/muteConfigs/%s", parent, muteConfigId),
	}

	if err := client.DeleteMuteConfig(ctx, req); err != nil {
		return fmt.Errorf("failed to delete Muteconfig: %w", err)
	}
	fmt.Fprintf(w, "Mute rule deleted successfully: %s", muteConfigId)
	return nil
}

Java

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.


import com.google.cloud.securitycenter.v1.MuteConfigName;
import com.google.cloud.securitycenter.v1.SecurityCenterClient;
import java.io.IOException;

public class DeleteMuteRule {

  public static void main(String[] args) {
    // TODO(Developer): Replace the following variables
    // parentPath: Use any one of the following options:
    //             - organizations/{organization_id}
    //             - folders/{folder_id}
    //             - projects/{project_id}
    String parentPath = String.format("projects/%s", "your-google-cloud-project-id");

    // muteConfigId: Specify the name of the mute config to delete.
    String muteConfigId = "mute-config-id";

    deleteMuteRule(parentPath, muteConfigId);
  }

  // Deletes a mute configuration given its resource name.
  // Note: Previously muted findings are not affected when a mute config is deleted.
  public static void deleteMuteRule(String projectId, String muteConfigId) {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Use appropriate MuteConfigName methods depending on the type of parent.
      // org -> MuteConfigName.ofOrganizationMuteConfigName()
      // folder -> MuteConfigName.ofFolderMuteConfigName()
      // project -> MuteConfigName.ofProjectMuteConfigName)
      client.deleteMuteConfig(MuteConfigName.ofProjectMuteConfigName(projectId, muteConfigId));

      System.out.println("Mute rule deleted successfully: " + muteConfigId);
    } catch (IOException e) {
      System.out.println("Mute rule deletion failed! \n Exception: " + e);
    }
  }
}

Python

다음 샘플은 v1 API를 사용합니다. v2의 샘플을 수정하려면 v1v2로 바꾸고 /locations/LOCATION을 리소스 이름에 추가합니다.

대부분의 리소스의 경우 /PARENT/PARENT_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 PARENTorganizations, folders 또는 projects입니다.

발견 항목의 경우 /sources/SOURCE_ID 뒤에 /locations/LOCATION을 리소스 이름에 추가합니다. 여기서 SOURCE_ID는 발견 항목을 실행한 Security Command Center 서비스의 ID입니다.

def delete_mute_rule(mute_config_name: str) -> None:
    """
    Deletes a mute configuration given its resource name.
    Note: Previously muted findings are not affected when a mute config is deleted.
    Args:
        mute_config_name: Specify the name of the mute config to delete.
                          Use any one of the following formats:
                          - organizations/{organization}/muteConfigs/{config_id}
                          - folders/{folder}/muteConfigs/{config_id} or
                          - projects/{project}/muteConfigs/{config_id}
    """
    from google.cloud import securitycenter

    client = securitycenter.SecurityCenterClient()

    request = securitycenter.DeleteMuteConfigRequest()
    request.name = mute_config_name

    client.delete_mute_config(request)
    print(f"Mute rule deleted successfully: {mute_config_name}")

REST API

Security Command Center API에서 muteConfigs delete 메서드를 사용하여 숨기기 규칙을 삭제합니다. 요청 본문이 비어 있습니다.

숨기기 규칙의 CONFIG_ID를 가져오려면 숨기기 규칙을 나열하는 API 호출을 수행합니다. 응답에는 반환된 숨기기 규칙의 구성 ID가 포함됩니다.

데이터 상주가 사용 설정되지 않았으면 Security Command Center API v1 또는 v2를 사용할 수 있습니다. API v2는 미리보기 출시 버전으로 제공됩니다. 데이터 상주가 사용 설정된 경우 API v2가 사용 가능한 유일한 API입니다.

Security Command Center API v1을 사용하는 경우 v1 엔드포인트를 사용하여 muteConfigs delete를 호출합니다.

DELETE https://securitycenter.googleapis.com/v1/PARENT/PARENT_ID/muteConfigs/CONFIG_ID

Security Command Center API v2를 사용하는 경우 v2 엔드포인트를 사용하여 muteConfigs delete를 호출합니다.

DELETE https://securitycenter.googleapis.com/v2/PARENT/PARENT_ID/locations/LOCATION/muteConfigs/CONFIG_ID

다음을 바꿉니다.

  • PARENT: 숨기기 규칙의 상위 리소스입니다(organizations, folders, projects).
  • PARENT_ID: 조직, 폴더, 프로젝트의 ID입니다.
  • LOCATION: v2의 경우에만 숨기기 규칙이 저장된 Security Command Center 위치를 지정합니다. 위치 필드가 생략된 경우 기본값은 global입니다.
  • CONFIG_ID: 숨기기 규칙의 숫자 ID입니다.

다음 단계

발견 항목 필터링 알림 자세히 알아보기

사용할 수 있는 필터 예시 자세히 살펴보기