ניהול כללי השתקה

במאמר הזה מוסבר איך ליצור ולנהל כללי השתקה כדי להשתיק באופן אוטומטי ממצאים ב-Security Command Center.

התפקידים הנדרשים

כדי לקבל את ההרשאות שדרושות לניהול כללי השתקה, צריך לבקש מהאדמין להקצות לכם את תפקידי ה-IAM הבאים בארגון, בתיקייה או בפרויקט:

להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.

יצירת כלל להשתקת ממצאים

בארגון אפשר ליצור עד 1,000 כללים להשתקה.

מומלץ להשתמש בכללי השתקה דינמיים בלבד בהגדרות של כללי ההשתקה, כי הם גמישים יותר מכללי השתקה סטטיים. להשוואה בין סוגים של כללים להשתקת ממצאים, ראו סוגים של כללים להשתקת ממצאים.

כדי ליצור כלל להשתקה, לוחצים על הכרטיסייה של ההליך שרוצים להשתמש בו:

המסוף

הגדרת כלל להשתקת ממצאים

  1. נכנסים לדף Findings במסוף Google Cloud .

    כניסה לדף Findings

  2. בוחרים ארגון או פרויקט.

  3. לוחצים על אפשרויות השתקה ואז על ניהול כללי השתקה.

  4. לוחצים על יצירת כלל להשתקת ממצאים.

  5. מזינים מזהה של כלל להשתקת ממצאים.

  6. מומלץ: מזינים תיאור שמספק הקשר להשתקת הממצאים.

  7. כדי לאשר את היקף כלל להשתקת ממצאים, בודקים את הערך של משאב האב.

אופציונלי: הוספת תאריך תפוגה

אפשר להוסיף תאריך תפוגה לכללי השתקה דינמיים.

  1. בוחרים באפשרות השתקת ממצאים תואמים באופן זמני.
  2. כדי להגדיר את תאריך התפוגה של כלל להשתקת ממצאים הדינמי, לוחצים על לוח השנה ובוחרים תאריך ושעה בעתיד, לפחות 24 שעות קדימה.

    אחרי פקיעת התוקף, כלל להשתקת ממצאים לא ישפיע יותר.

אופציונלי: הגבלת כלל ההשתקה באמצעות שאילתה

אם מוסיפים שאילתה, כלל להשתקת ממצאים חל רק על ממצאים שתואמים לשאילתה.

כדי להגביל את כלל ההשתקה באמצעות שאילתה, בקטע Findings query (שאילתת ממצאים), לוחצים על Add filter (הוספת מסנן).

בתפריט הוספת מסנן אפשר לבחור מאפיינים וערכים נתמכים של ממצאים.

  1. בתפריט Select filter, בוחרים מאפיין של ממצא או מקלידים את השם שלו בתיבה Search finding attributes. תוצג רשימה של מאפייני המשנה הזמינים.
  2. בוחרים מאפיין משנה. מוצג שדה בחירה שבו אפשר ליצור את הצהרת השאילתה באמצעות מאפיין המשנה שבחרתם, אופרטור שאילתה וערך אחד או יותר למאפיין המשנה.
  3. בוחרים את האופרטור וערך אחד או יותר של מאפיין המשנה בחלונית. מידע נוסף על אופרטורים של שאילתות ועל הפונקציות שבהן הם משתמשים זמין במאמר בנושא אופרטורים של שאילתות בתפריט הוספת מסננים.

    אם רוצים להתחיל מחדש, לוחצים על איפוס.

  4. לוחצים על אישור.

    התפריט נסגר והשאילתה מתעדכנת.

  5. חוזרים על הפעולות עד ששאילתת הממצאים מכילה את כל המאפיינים הרצויים.
כדי לבדוק את תוצאות השאילתה, לוחצים על תצוגה מקדימה של הממצאים התואמים. בטבלה מוצגות הממצאים שתואמים לשאילתה.

אם השאילתה לא תואמת לממצאים הנכונים, צריך לשנות את השאילתה לפי הצורך ולצפות שוב בתצוגה המקדימה של הממצאים. חוזרים על השלב הזה עד שמרוצים מהתוצאות.

שמירת הכלל להשתקת ממצאים

לוחצים על Save. Google Cloud במסוף מוצגת רשימה של כללי ההשתקה.

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

    בחלק התחתון של Google Cloud המסוף יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  2. כדי ליצור כללי השתקה, מריצים את הפקודה gcloud scc muteconfigs create:

    gcloud scc muteconfigs create CONFIG_ID \
      --PARENT=PARENT_ID \
      --location=LOCATION \
      --description="RULE_DESCRIPTION" \
      --filter="FILTER" \
      --type=MUTE_TYPE \
      --expiry-time=TIMESTAMP

    מחליפים את מה שכתוב בשדות הבאים:

    • CONFIG_ID: השם של כלל ההשתקה. המזהה צריך להכיל תווים אלפאנומריים ומקפים, והאורך שלו צריך להיות בין תו אחד ל-63 תווים.
    • PARENT: ההיקף בהיררכיית המשאבים שאליו חל כלל להשתקת ממצאים, organization, folder או project.
    • PARENT_ID: המזהה המספרי של הארגון, התיקייה או הפרויקט ברמת ההורה, או המזהה האלפאנומרי של הפרויקט ברמת ההורה.
    • LOCATION: המיקום של Security Command Center שבו רוצים לנהל את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
    • RULE_DESCRIPTION: תיאור של כלל ההשתקה, באורך של עד 1,024 תווים.
    • FILTER: הביטוי שאתם מגדירים כדי לסנן את הממצאים. לדוגמה, כדי להשתיק ממצאים של OPEN_FIREWALL, המסנן יכול להיות FILTER="category=\"OPEN_FIREWALL\"".
    • MUTE_TYPE: סוג כלל ההשתקה שרוצים ליצור. סוגי כללים להשתקת ממצאים תקפים הם DYNAMIC ו-STATIC. סוג כלל להשתקת ממצאים מוגדר כ-STATIC כברירת מחדל. אי אפשר לשנות את הסוג של כלל להשתקת ממצאים אחרי שיוצרים אותו.
    • TIMESTAMP: רלוונטי רק אם יוצרים כלל להשתקת ממצאים דינמי. מחרוזת של תאריך ושעה שמציינת מתי פג התוקף של כלל להשתקת ממצאים הדינמי. הערך חייב להיות לפחות יום אחד בעתיד, אחרת הבקשה תידחה. מידע על פורמטים של שעות זמין במאמר gcloud topic datetimes. כשכלל השתקה דינמי פג תוקף, הוא מוסר מכל הממצאים שתואמים לו. כדי שכלל להשתקת ממצאים דינמי יפעל ללא הגבלת זמן על ממצאים תואמים, משמיטים את השדה הזה.

    התשובה כוללת את מזהה כלל להשתקת ממצאים, שבו אפשר להשתמש כדי להציג, לעדכן ולמחוק כללים להשתקת ממצאים, כמו שמתואר במאמר בנושא ניהול כללים להשתקת ממצאים.

Terraform

כדי ליצור כלל להשתקת משתמשים בארגון:

resource "google_scc_v2_organization_mute_config" "default" {
  mute_config_id    = "my-config"
  organization = "123456789"
  location     = "global"
  description  = "My custom Cloud Security Command Center Finding Organization mute Configuration"
  filter = "severity = \"HIGH\""
  type = "STATIC"
}

כדי ליצור כלל להשתקת ממצאים עבור תיקייה:

resource "google_folder" "folder" {
  parent       = "organizations/123456789"
  display_name = "folder-name"
}

resource "google_scc_v2_folder_mute_config" "default" {
  mute_config_id    = "my-config"
  folder = google_folder.folder.folder_id
  location     = "global"
  description  = "My custom Cloud Security Command Center Finding Folder mute Configuration"
  filter = "severity = \"HIGH\""
  type = "STATIC"
}

כדי ליצור כלל להשתקת ממצאים עבור פרויקט:

resource "google_scc_v2_project_mute_config" "default" {
  mute_config_id    = "my-config"
  project = "my-project-name"
  location     = "global"
  description  = "My custom Cloud Security Command Center Finding Project mute Configuration"
  filter = "severity = \"HIGH\""
  type = "STATIC"
}

המשך


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/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\"",
		Type: securitycenterpb.MuteConfig_STATIC,
	}

	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


import com.google.cloud.securitycenter.v2.LocationName;
import com.google.cloud.securitycenter.v2.MuteConfig;
import com.google.cloud.securitycenter.v2.MuteConfig.MuteConfigType;
import com.google.cloud.securitycenter.v2.SecurityCenterClient;
import java.io.IOException;
import java.util.UUID;

public class CreateMuteRule {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the following variables.
    // projectId: Google Cloud Project id.
    String projectId = "google-cloud-project-id";

    // Specify the location of the mute config.
    String location = "global";

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

    createMuteRule(projectId, location, muteConfigId);
  }

  // Creates a mute configuration in a project under a given location.
  public static void createMuteRule(String projectId, String location, String muteConfigId)
      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.
    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\"")
              .setType(MuteConfigType.STATIC)
              .build();

      // You can also create mute rules in an organization/ folder.
      // Construct the parameters according to the parent resource.
      //  * Organization -> client.createMuteConfig(OrganizationLocationName.of(...
      //  * Folder -> client.createMuteConfig(FolderLocationName.of(...
      MuteConfig response = client.createMuteConfig(
          LocationName.of(projectId, location), muteConfig, muteConfigId);
      System.out.println("Mute rule created successfully: " + response.getName());
    }
  }
}

Python

def create_mute_rule(parent_path: str, location_id: str, mute_config_id: str) -> Dict:
    """
    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}
        location_id: Gcp location id; example: 'global'
        mute_config_id: Set a unique id; max of 63 chars.
    Returns:
        Dict: returns the mute rule details
    """

    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    mute_config = securitycenter_v2.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"'
    )
    mute_config.type = "STATIC"

    request = securitycenter_v2.CreateMuteConfigRequest()
    request.parent = parent_path + "/locations/" + location_id
    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}")
    return mute_config

REST

ב-Security Command Center API, משתמשים ב-method‏ muteConfigs.create כדי ליצור כלל להשתקת ממצאים. גוף הבקשה הוא מופע של MuteConfig:

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

  {
    "description": "RULE_DESCRIPTION",
    "filter": "FILTER",
    "type": "MUTE_TYPE",
    "expiryTime": "TIMESTAMP"
  }

מחליפים את מה שכתוב בשדות הבאים:

  • PARENT: משאב האב של כלל להשתקת ממצאים (organizations,‏ folders או projects)
  • PARENT_ID: המזהה של ארגון האב, התיקייה או הפרויקט
  • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
  • MUTE_CONFIG_ID: השם של כלל להשתקת ממצאים (בין 1 ל-63 תווים)
  • RULE_DESCRIPTION: תיאור של כלל ההשתקה (מקסימום: 1,024 תווים)
  • FILTER: הביטוי שאתם מגדירים כדי לסנן את הממצאים

    לדוגמה, כדי להשתיק ממצאים של OPEN_FIREWALL, המסנן יכול להיות "category=\"OPEN_FIREWALL\"".

  • MUTE_TYPE: סוג כלל ההשתקה שרוצים ליצור. סוגי כללים להשתקת ממצאים תקפים הם DYNAMIC ו-STATIC. אי אפשר לשנות את הסוג של כלל להשתקת ממצאים אחרי שיוצרים אותו.

  • TIMESTAMP: רלוונטי רק אם יוצרים כלל להשתקת ממצאים דינמי. מחרוזת של תאריך ושעה שמציינת מתי פג התוקף של כלל להשתקת ממצאים הדינמי. הערך חייב להיות לפחות יום אחד בעתיד, אחרת הבקשה תידחה. מידע על פורמטים של שעות זמין במאמר gcloud topic datetimes. כשכלל השתקה דינמי פג תוקף, הוא מוסר מכל הממצאים שתואמים לו. אם רוצים שכלל להשתקת ממצאים דינמי יפעל ללא הגבלת זמן על ממצאים תואמים, צריך להשמיט את השדה הזה.

התשובה כוללת את מזהה ההגדרה של ההשתקה, שבו אפשר להשתמש כדי להציג, לעדכן ולמחוק כללי השתקה, כמו שמתואר במאמר ניהול כללי השתקה.

ממצאים חדשים שתואמים בדיוק למסנן מוסתרים, והמאפיין mute של הממצאים מוגדר לערך MUTED.

מאפייני ממצאים שלא נתמכים בכללי השתקה

כללי השתקה לא תומכים בכל מאפייני הממצאים במסננים. כדי לראות את רשימת המאפיינים שלא נתמכים במסננים של כללים להשתקת ממצאים, צריך להרחיב את הקטע הבא.

מאפייני ממצאים שלא נתמכים

  • caiResource
  • canonicalName
  • createTime
  • description
  • eventTime
  • externalUri
  • gcpMetadata.folders1
  • libraryPaths
  • mute
  • muteAnnotation
  • muteInfo
  • muteInitiator
  • muteUpdateTime
  • name
  • nextSteps
  • originalProviderId
  • parent
  • processes.binaryPath
  • processes.libraryPaths
  • propertyDataTypes
  • resource.tags
  • resourceName
  • securityMarks
  • sourceProperties
  • state
  • workflowState
  • ‫1המאפיין gcpMetadata.folders מכיל שדות משנה שנתמכים במסנני השתקה.

הצגת רשימת הכללים להשתקת ממצאים

אפשר לרשום את כללי ההשתקה בארגון, בתיקייה או בפרויקט באמצעות המסוף, ה-CLI של gcloud או Security Command Center API. Google Cloud

היכולת שלכם לראות את רשימת כללי ההשתקה בהיקף מסוים תלויה בהרשאות שניתנו לתפקידים שלכם ב-IAM.

אם הפעלתם את התכונה 'מיקום אחסון הנתונים' ב-Security Command Center, ההיקף של פקודת הרשימה מוגבל גם למיקום של Security Command Center שבחרתם.

דוגמאות קוד לרשימת כללי השתקה מופיעות במאמר בנושא רשימת כללי השתקה.

כדי להציג את כללי ההשתקה של ארגון, תיקייה או פרויקט, לוחצים על הכרטיסייה של ההליך שרוצים להשתמש בו:

המסוף

  1. במסוף Google Cloud , עוברים לכרטיסייה Mute rules בדף Settings של Security Command Center.

    לכללי השתקה

  2. אם צריך, בוחרים את Google Cloud הפרויקט או הארגון.

  3. בקטע Mute rules, מוצגים פרטים על כללי השתקה פעילים, כולל:

    • שם: מזהה כלל להשתקת ממצאים
    • משאב הורה: המשאב שבו נמצא כלל להשתקת ממצאים
    • תיאור: תיאור של כלל להשתקת ממצאים, אם זמין
    • העדכון האחרון בוצע על ידי: המשתמש הראשי שעדכן את הכלל לאחרונה
    • העדכון האחרון: התאריך והשעה שבהם עודכן הכלל לאחרונה

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

    בחלק התחתון של Google Cloud המסוף יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  2. כדי להציג רשימה של כללי השתקה, מריצים את הפקודה gcloud scc muteconfigs list:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • PARENT: organization,‏ folder או project של ההורה שלגביו רוצים להציג את כללי ההשתקה
    • PARENT_ID: המזהה של ארגון האב, התיקייה או הפרויקט
    • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.

המשך

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/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


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

public class ListMuteRules {

  public static void main(String[] args) throws IOException {
    // TODO: Replace variables enclosed within {}
    // projectId: Google Cloud Project id.
    String projectId = "google-cloud-project-id";

    // Specify the location to list mute configs.
    String location = "global";

    listMuteRules(projectId, location);
  }

  // Lists all mute rules present under the resource type in the given location.
  public static void listMuteRules(String projectId, String location) 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.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {

      // Parent can also be one of:
      //  * "organizations/{org_id}/locations/{location}"
      //  * "folders/{folder_id}/locations/{location}"
      ListMuteConfigsRequest listMuteConfigsRequest = ListMuteConfigsRequest.newBuilder()
          .setParent(String.format("projects/%s/locations/%s", projectId, location))
          .build();

      // List all mute configs present in the resource.
      for (MuteConfig muteConfig : client.listMuteConfigs(listMuteConfigsRequest).iterateAll()) {
        System.out.println(muteConfig.getName());
      }
    }
  }
}

Python

def list_mute_rules(parent: str, location_id: str) -> Dict:
    """
    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}
        location_id: Gcp location id; example: 'global'
    Returns:
         Dict: returns the mute rule details
    """
    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    request = securitycenter_v2.ListMuteConfigsRequest()
    request.parent = parent + "/locations/" + location_id
    response = client.list_mute_configs(request)
    # List all Mute Configs present in the resource.
    for mute_config in response:
        print(mute_config.name)
    return response

REST

ב-Security Command Center API, משתמשים בשיטה muteConfigs.list כדי להציג את רשימת כללי ההשתקה:

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

מחליפים את מה שכתוב בשדות הבאים:

  • PARENT: משאב האב של כלל להשתקת ממצאים (organizations,‏ folders או projects)
  • PARENT_ID: המזהה של ארגון האב, התיקייה או הפרויקט
  • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.

התשובה כוללת את השמות, התיאורים ומזהי ההגדרות של השתקת הכללים.

הצגת ההגדרה של כלל להשתקת ממצאים

אפשר לראות את ההגדרה של כלל להשתקת ממצאים באמצעות Google Cloud המסוף, ה-CLI של gcloud או Security Command Center API.

דוגמאות קוד לדוגמה לאחזור הגדרה של כלל להשתקת ממצאים מופיעות במאמר הצגת כלל להשתקה.

כדי לראות את ההגדרה של כלל להשתקת שיחות, לוחצים על הכרטיסייה של ההליך שרוצים להשתמש בו:

המסוף

  1. במסוף Google Cloud , עוברים לכרטיסייה Mute rules בדף Settings של Security Command Center.

    לכללי השתקה

  2. אם צריך, בוחרים את Google Cloud הפרויקט או הארגון.

  3. בקטע כללי השתקה מוצגת רשימה של כללי השתקה.

  4. לוחצים על שם הכלל שרוצים להציג.

    ייפתח דף עם ההגדרה של כלל ההשתקה.

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

    בחלק התחתון של Google Cloud המסוף יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  2. כדי להציג את ההגדרה של כלל השתקה, מריצים את הפקודה gcloud scc muteconfigs get:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • MUTE_CONFIG_ID: המזהה של כלל להשתקת ממצאים
    • PARENT: משאב האב של כלל להשתקת ממצאים (organization,‏ folder או project)
    • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט
    • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.

המשך

import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/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


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

public class GetMuteRule {

  public static void main(String[] args) throws IOException {
    // TODO(Developer): Replace the following variables
    // projectId: Google Cloud Project id.
    String projectId = "google-cloud-project-id";

    // Specify the location of the mute config. If the mute config was
    // created with v1 API, it can be accessed with "global".
    String location = "global";

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

    getMuteRule(projectId, location, muteConfigId);
  }

  // Retrieves a mute configuration given its resource name.
  public static MuteConfig getMuteRule(String projectId, String location, String muteConfigId)
      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.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Use appropriate `MuteConfigName` methods depending on the parent type.
      //  * organization -> MuteConfigName.ofOrganizationLocationMuteConfigName()
      //  * folder -> MuteConfigName.ofFolderLocationMuteConfigName()

      MuteConfigName muteConfigName = MuteConfigName.ofProjectLocationMuteConfigName(projectId,
          location, muteConfigId);
      return client.getMuteConfig(muteConfigName);
    }
  }
}

Python

def get_mute_rule(parent_path: str, location_id: str, mute_config_id: str) -> Dict:
    """
    Retrieves a mute configuration given its resource name.
    Args:
        parent_path: use any one of the following options:
                     - organizations/{organization_id}
                     - folders/{folder_id}
                     - projects/{project_id}
        location_id: Gcp location id; example: 'global'
        mute_config_id: Set a unique id; max of 63 chars.
    Returns:
         Dict: returns the mute rule details
    """
    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    request = securitycenter_v2.GetMuteConfigRequest()
    request.name = (
        parent_path + "/locations/" + location_id + "/muteConfigs/" + mute_config_id
    )

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

REST

ב-Security Command Center API, משתמשים בשיטה muteConfigs.get כדי להחזיר את ההגדרה של כלל להשתקת ממצאים:

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

מחליפים את מה שכתוב בשדות הבאים:

  • PARENT: משאב האב של כלל להשתקת ממצאים (organizations,‏ folders או projects)
  • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט
  • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
  • CONFIG_ID: המזהה המספרי של כלל להשתקת ממצאים

עדכון כללי ההשתקה

אפשר לעדכן את התיאור או את מסנן הממצאים של כלל להשתקת ממצאים באמצעות Google Cloud המסוף, ה-CLI של gcloud או Security Command Center API.

אי אפשר לשנות את המזהה, את הארגון, התיקייה או הפרויקט ברמת ההורה, או את המיקום של כלל להשתקת ממצאים. כדי לשנות את אחד מהערכים האלה, צריך ליצור כלל להשתקת ממצאים חדש.

אם ביטלתם בעבר את ההשתקה של ממצאים, הם יושתקו שוב אם הם תאמו לכלל להשתקת ממצאים שעודכן במסוף Google Cloud . מידע נוסף מופיע במאמר ביטול ההשתקה של ממצאים ספציפיים.

במאמר עדכון כלל להשתקת ממצאים מופיע קוד לדוגמה לעדכון כלל להשתקת ממצאים.

כדי לעדכן כלל להשתקה, לוחצים על הכרטיסייה של הפעולה שרוצים לבצע:

המסוף

  1. במסוף Google Cloud , עוברים לכרטיסייה Mute rules בדף Settings של Security Command Center.

    לכללי השתקה

  2. בוחרים את Google Cloud הפרויקט או הארגון שמהווים את משאב האב של כלל ההשתקה שרוצים לשנות.

  3. לוחצים על השם של כלל ההשתקה שרוצים לשנות.

    אם לא בחרתם את הפרויקט או הארגון המתאימים, יכול להיות שתופיע הערה שלפיה אין לכם הרשאה לשנות את כלל ההשתקה.

  4. מבצעים שינויים בכלל להשתקת ממצאים.

  5. אופציונלי: אחרי שמעדכנים את המסנן, לוחצים על תצוגה מקדימה של ממצאים תואמים כדי לראות את הממצאים שתואמים למסנן המעודכן. נטען טבלה עם ממצאים שתואמים לשאילתה החדשה.

  6. לוחצים על Save.

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

    בחלק התחתון של Google Cloud המסוף יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  2. כדי לעדכן את כללי ההשתקה, מריצים את הפקודה gcloud scc muteconfigs update:

    gcloud scc muteconfigs update MUTE_CONFIG_ID \
        --PARENT=PARENT_ID \
        --location=LOCATION \
        --description=RULE_DESCRIPTION \
        --filter=FILTER \
        --type=MUTE_TYPE \
        --expiry-time=TIMESTAMP
    

    מחליפים את מה שכתוב בשדות הבאים:

    • MUTE_CONFIG_ID: המזהה של כלל להשתקת ממצאים.
    • PARENT: משאב האב של כלל להשתקת ממצאים (organization,‏ folder או project).
    • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט.
    • LOCATION: המיקום של Security Command Center שבו רוצים לנהל את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
    • RULE_DESCRIPTION: תיאור של כלל ההשתקה (מקסימום 1,024 תווים).
    • FILTER: הביטוי שאתם מגדירים כדי לסנן את הממצאים.

      לדוגמה, כדי להשתיק ממצאים מסוג OPEN_FIREWALL, המסנן יכול להיות FILTER="category=\"OPEN_FIREWALL\"".

    • MUTE_TYPE: סוג כלל ההשתקה שרוצים לעדכן. סוגי כללים להשתקת ממצאים תקפים הם DYNAMIC ו-STATIC. אחרי שיוצרים כלל להשתקת ממצאים, אי אפשר לשנות את הסוג שלו.

    • TIMESTAMP: רלוונטי רק אם מעדכנים כלל להשתקת ממצאים דינמי. מחרוזת של תאריך ושעה שמציינת מתי פג התוקף של כלל להשתקת ממצאים הדינמי. הערך חייב להיות לפחות יום אחד בעתיד, אחרת הבקשה תידחה. מידע על פורמטים של שעות זמין במאמר gcloud topic datetimes. כשכלל השתקה דינמי פג תוקף, הוא מוסר מכל הממצאים שתואמים לו. אם רוצים שכלל להשתקת ממצאים דינמי יפעל ללא הגבלת זמן על ממצאים תואמים, צריך להשמיט את השדה הזה.

המשך


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/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! %w", err)
	}
	fmt.Fprintf(w, "Mute rule updated %s", response.Name)
	return nil
}

Java


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

public class UpdateMuteRule {

  public static void main(String[] args) throws IOException {
    // TODO: Replace the variables within {}
    // projectId: Google Cloud Project id.
    String projectId = "google-cloud-project-id";

    // Specify the location of the mute config to update. If the mute config was
    // created with v1 API, it can be accessed with "global".
    String location = "global";

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

    updateMuteRule(projectId, location, muteConfigId);
  }

  // Updates an existing mute configuration.
  // The following can be updated in a mute config: description and filter.
  public static void updateMuteRule(String projectId, String location, String muteConfigId)
      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.
    try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {

      MuteConfig updateMuteConfig =
          MuteConfig.newBuilder()
              // Construct the name according to the parent type of the mute rule.
              // Parent can also be one of:
              //  * "organizations/{org_id}/locations/{location}/muteConfigs/{muteConfig_id}"
              //  * "folders/{folder_id}/locations/{location}/muteConfigs/{muteConfig_id}"
              .setName(String.format("projects/%s/locations/%s/muteConfigs/%s", projectId, location,
                  muteConfigId))
              .setDescription("Updated mute config description")
              .build();

      UpdateMuteConfigRequest updateMuteConfigRequest =
          UpdateMuteConfigRequest.newBuilder()
              .setMuteConfig(updateMuteConfig)
              // Make sure that the mask fields match the properties changed in
              // 'updateMuteConfig' object.
              // For more info on constructing update mask path, see the proto or:
              // https://cloud.google.com/security-command-center/docs/reference/rest/v2/folders.muteConfigs/patch?hl=en#query-parameters
              .setUpdateMask(FieldMask.newBuilder().addPaths("description").build())
              .build();

      MuteConfig response = securityCenterClient.updateMuteConfig(updateMuteConfigRequest);
      System.out.println(response);
    }
  }
}

Python

def update_mute_rule(parent_path: str, location_id: str, mute_config_id: str) -> Dict:
    """
    Updates an existing mute configuration.
    The following can be updated in a mute config: description, and filter/ mute rule.
    Args:
        parent: Use any one of the following resource paths to list mute configurations:
                - organizations/{organization_id}
                - folders/{folder_id}
                - projects/{project_id}
        location_id: Gcp location id; example: 'global'
        mute_config_id: Set a unique id; max of 63 chars.
    Returns:
         Dict: returns the mute rule details
    """
    from google.cloud import securitycenter_v2
    from google.protobuf import field_mask_pb2

    client = securitycenter_v2.SecurityCenterClient()

    update_mute_config = securitycenter_v2.MuteConfig()
    update_mute_config.name = (
        parent_path + "/locations/" + location_id + "/muteConfigs/" + mute_config_id
    )
    update_mute_config.description = "Updated mute config description"

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

    request = securitycenter_v2.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}")
    return mute_config

REST

ב-Security Command Center API, משתמשים ב-method ‏muteConfigs.patch כדי לעדכן כלל להשתקת התראות. גוף הבקשה הוא מופע של MuteConfig:

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

  {
    "description": "RULE_DESCRIPTION",
    "filter": "FILTER",
    "type": "MUTE_TYPE",
    "expiryTime": "TIMESTAMP"
  }

מחליפים את מה שכתוב בשדות הבאים:

  • PARENT: משאב האב של כלל להשתקת ממצאים (organizations,‏ folders או projects)
  • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט
  • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
  • CONFIG_ID: המזהה המספרי של כלל להשתקת ממצאים
  • RULE_DESCRIPTION: תיאור של כלל להשתקת ממצאים (עד 1,024 תווים)
  • FILTER: הביטוי שמגדירים כדי לסנן את הממצאים
  • MUTE_TYPE: סוג כלל ההשתקה שרוצים לעדכן. סוגי כללים להשתקת ממצאים תקפים הם DYNAMIC ו-STATIC. אחרי שיוצרים כלל להשתקת ממצאים, אי אפשר לשנות את הסוג שלו.
  • TIMESTAMP: רלוונטי רק אם מעדכנים כלל להשתקת ממצאים דינמי. מחרוזת של תאריך ושעה שמציינת מתי פג התוקף של כלל להשתקת ממצאים הדינמי. הערך חייב להיות לפחות יום אחד בעתיד, אחרת הבקשה תידחה. מידע על פורמטים של שעות זמין במאמר gcloud topic datetimes. כשכלל השתקה דינמי פג תוקף, הוא מוסר מכל הממצאים שתואמים לו. אם רוצים שכלל להשתקת ממצאים דינמי יפעל ללא הגבלת זמן על ממצאים תואמים, צריך להשמיט את השדה הזה.

מחיקת כללים להשתקת ממצאים

אפשר למחוק כלל להשתקת ממצאים באמצעות Google Cloud המסוף,‏ ה-CLI של gcloud או Security Command Center API.

לפני שמוחקים כללי השתקה, חשוב להבין את הנקודות הבאות:

  • אי אפשר לשחזר כללי השתקה שנמחקו.
  • מחיקה של כללי השתקה סטטיים לא מבטלת אוטומטית את ההשתקה של ממצאים מושתקים. צריך לבטל את ההשתקה של הממצאים באופן ידני או באמצעות תוכנה.
  • מחיקה של כללי השתקה דינמיים מסירה אוטומטית את הכלל מכל הממצאים שתאמו לו בעבר, ומבטלת את ההשתקה שלהם אם הם לא תואמים לכללים נוספים.
  • ממצאים עתידיים שתואמים למסננים בכללים להשתקה שנמחקו לא מושתקים.

קוד לדוגמה למחיקת כלל להשתקת ממצאים זמין במאמר בנושא מחיקת כלל השתקה.

כדי למחוק כלל השתקה, לוחצים על הכרטיסייה של ההליך שרוצים להשתמש בו:

המסוף

  1. במסוף Google Cloud , עוברים לכרטיסייה Mute rules בדף Settings של Security Command Center.

    לכללי השתקה

  2. אם צריך, בוחרים את Google Cloud הפרויקט או הארגון.

  3. לוחצים על השם של כלל ההשתקה שרוצים למחוק.

  4. לוחצים על מחיקה.

  5. קוראים את ההודעה בתיבת הדו-שיח, ואם היא מקובלת עליכם, לוחצים על מחיקה.

gcloud

  1. במסוף Google Cloud , מפעילים את Cloud Shell.

    הפעלת Cloud Shell

    בחלק התחתון של Google Cloud המסוף יתחיל סשן של Cloud Shell ותופיע הודעה של שורת הפקודה. Cloud Shell היא סביבת מעטפת שבה ה-CLI של Google Cloud מותקן ומוגדרים ערכים לפרויקט הקיים. הסשן יופעל תוך כמה שניות.

  2. כדי למחוק כללי השתקה, מריצים את הפקודה gcloud scc muteconfigs delete:

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

    מחליפים את מה שכתוב בשדות הבאים:

    • MUTE_CONFIG_ID: המזהה של הגדרת ההשתקה
    • PARENT: משאב האב של כלל להשתקת ממצאים (organization,‏ folder או project)
    • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט
    • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
  3. מאשרים את הבקשה למחיקת כלל ההשתקה.

המשך


import (
	"context"
	"fmt"
	"io"

	securitycenter "cloud.google.com/go/securitycenter/apiv2"
	"cloud.google.com/go/securitycenter/apiv2/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


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

public class DeleteMuteRule {

  public static void main(String[] args) throws IOException {
    // TODO(Developer): Replace the following variables
    // projectId: Google Cloud Project id.
    String projectId = "google-cloud-project-id";

    // Specify the location of the mute config. If the mute config was
    // created with v1 API, it can be accessed with "global".
    String location = "global";

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

    deleteMuteRule(projectId, location, 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 location, String muteConfigId)
      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.
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Use appropriate `MuteConfigName` methods depending on the parent type.
      // folder -> MuteConfigName.ofFolderLocationMuteConfigName()
      // organization -> MuteConfigName.ofOrganizationLocationMuteConfigName()
      client.deleteMuteConfig(
          MuteConfigName.ofProjectLocationMuteConfigName(projectId, location, muteConfigId));

      System.out.println("Mute rule deleted successfully: " + muteConfigId);
    }
  }
}

Python

def delete_mute_rule(parent_path: str, location_id: str, mute_config_id: str) -> None:
    """
    Deletes a mute configuration given its resource name.
    Note: Previously muted findings are not affected when a mute config is deleted.
    Args:
         parent_path: use any one of the following options:
                     - organizations/{organization_id}
                     - folders/{folder_id}
                     - projects/{project_id}
        location_id: Gcp location id; example: 'global'
        mute_config_id: Set a unique id; max of 63 chars.
    Returns:
         None: returns none mute rule is deleted
    """
    from google.cloud import securitycenter_v2

    client = securitycenter_v2.SecurityCenterClient()

    request = securitycenter_v2.DeleteMuteConfigRequest()
    request.name = (
        parent_path + "/locations/" + location_id + "/muteConfigs/" + mute_config_id
    )

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

REST

ב-Security Command Center API, משתמשים ב-method ‏muteConfigs.delete כדי למחוק כלל להשתקת ממצאים:

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

מחליפים את מה שכתוב בשדות הבאים:

  • PARENT: משאב האב של כלל להשתקת ממצאים (organizations,‏ folders או projects)
  • PARENT_ID: המזהה של הארגון, התיקייה או הפרויקט
  • LOCATION: המיקום של Security Command Center שבו מנהלים את כללי ההשתקה. אם מופעל מיקום אחסון הנתונים, צריך להשתמש בערך eu, sa או us. אחרת, צריך להשתמש בערך global.
  • CONFIG_ID: המזהה המספרי של כלל להשתקת ממצאים