הוספת מדיניות ארגונית שהוגדרה מראש

בדף הזה מוסבר איך להוסיף כללי מדיניות של הארגון למכונות Cloud SQL, כדי להגביל את Cloud SQL ברמת הפרויקט, התיקייה או הארגון. לסקירה כללית, ראו מדיניות הארגון ב-Cloud SQL.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אנחנו ממליצים למשתמשים חדשים ב- Google Cloudליצור חשבון כדי שיוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Install the gcloud CLI.

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

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

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

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Verify that billing is enabled for your Google Cloud project.

  9. Install the gcloud CLI.

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

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

    gcloud init
  12. מוסיפים את התפקיד אדמין של מדיניות הארגון (roles/orgpolicy.policyAdmin) לחשבון המשתמש או לחשבון השירות בדף IAM וניהול.

    כניסה לדף IAM accounts

  13. לפני ביצוע התהליך, קראו את המגבלות.

הוספת מדיניות הארגון של החיבור

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

כדי להוסיף מדיניות ארגון לחיבור:

  1. נכנסים לדף Organization policies.

    כניסה לדף Organization policies

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

  3. מסננים לפי המגבלה name או display_name.

    • כדי להשבית את הגישה לאינטרנט או ממנו:

      name: "constraints/sql.restrictPublicIp"
      display_name: "Restrict Public IP access on Cloud SQL instances"
      
    • כדי להשבית את הגישה מהאינטרנט כשאין אימות IAM (זה לא משפיע על הגישה באמצעות כתובת IP פרטית):

      name: "constraints/sql.restrictAuthorizedNetworks"
      display_name: "Restrict Authorized Networks on Cloud SQL instances"
      
  4. בוחרים את שם המדיניות מהרשימה.

  5. לוחצים על Edit.

  6. לוחצים על התאמה אישית.

  7. לוחצים על הוספת כלל.

  8. בקטע אכיפה, לוחצים על מופעל.

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

הוספת מדיניות הארגון של CMEK

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

כדי להוסיף מדיניות ארגון לגבי CMEK:

  1. נכנסים לדף Organization policies.

    כניסה לדף Organization policies

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

  3. מסננים לפי המגבלה name או display_name.

    • כדי להוסיף שמות של שירותים לרשימת דחייה, כדי לוודא שנעשה שימוש ב-CMEK במשאבים של השירות הזה:

      name: "constraints/gcp.restrictNonCmekServices"
      display_name: "Restrict which services may create resources without CMEK"
      

      צריך להוסיף את sqladmin.googleapis.com לרשימת השירותים המוגבלים עם Deny.

    • כדי להוסיף מזהי פרויקטים לרשימת היתרים, כדי לוודא שרק מפתחות ממכונה של Cloud KMS באותו פרויקט ישמשו ל-CMEK.

      name: "constraints/gcp.restrictCmekCryptoKeyProjects"
      display_name: "Restrict which projects may supply KMS CryptoKeys for CMEK"
      
  4. בוחרים את שם המדיניות מהרשימה.

  5. לוחצים על Edit.

  6. לוחצים על התאמה אישית.

  7. לוחצים על הוספת כלל.

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

  9. בconstraints/gcp.restrictNonCmekServices: א. בקטע Policy types, בוחרים באפשרות Deny. ב. בקטע ערכים בהתאמה אישית, מזינים את sqladmin.googleapis.com.

    בconstraints/gcp.restrictCmekCryptoKeyProjects: א. בקטע סוגי מדיניות, בוחרים באפשרות אישור. ב. בקטע Custom values, מזינים את המשאב בפורמט הבא: under:organizations/ORGANIZATION_ID,‏ under:folders/FOLDER_ID או projects/PROJECT_ID.

  10. לוחצים על סיום.

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

המאמרים הבאים