בדף הזה מוסבר איך אדמינים יכולים לבדוק הגבלות על הארגון בלי להגדיר שרת proxy ליציאה. Cloud de Confiance by S3NS
כדי ליצור ולבדוק את כותרת ההגבלות על ארגון, בצע את הפעולות הבאות:
כדי לקבל את מזהה הארגון Cloud de Confiance by S3NS , משתמשים בפקודה
gcloud organizations list:gcloud organizations listהפלט לדוגמה:
DISPLAY_NAME: Organization A ID: 123456789 DIRECTORY_CUSTOMER_ID: a1b2c3d4אחרי שמקבלים את מזהה הארגון, יוצרים את ייצוג ה-JSON של ערך הכותרת בפורמט הבא:
{ "resources": ["organizations/123456789"], "options": "strict" }מקודדים את הערך של כותרת הבקשה בהתאם למפרט של סעיף 5 ב-RFC 4648.
לדוגמה, אם הייצוג ב-JSON של ערך הכותרת מאוחסן בקובץ
authorized_orgs.json, הקידוד באמצעות basenc הוא:$ OR_HEADER=`cat authorized_orgs.json | basenc --base64url -w0` $ echo $OR_HEADER ewogInJlc291cmNlcyI6IFsib3JnYW5pemF0aW9ucy8xMjM0NTY3ODkiXQogIm9wdGlvbnMiOiAic3RyaWN0Igp9Cgo=כדי לבדוק אם הגדרת הכותרת מאפשרת גישה למשאב בארגון מורשהCloud de Confiance by S3NS , יוצרים בקשת curl למשאב בארגון מורשהCloud de Confiance by S3NS . הנה דוגמה לבקשת curl:
# Get auth token $ TOKEN=$(gcloud auth print-access-token) # Make a request that includes the organization restriction header; this call makes a request to the logging API for a project within the same organization listed in the header $ curl -H "X-Goog-Allowed-Resources: ${OR_HEADER}" -X POST -d '{"projectIds": ["my-project-123"]}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${TOKEN}" "https://logging.googleapis.com/v2/entries:list" # A successful request returns log entries in this projectכדי לבדוק אם הגדרת הכותרת חוסמת גישה למשאב שנמצא מחוץ לארגון המורשהCloud de Confiance by S3NS , יוצרים בקשת curl למשאב שנמצא מחוץ לארגון המורשהCloud de Confiance by S3NS . הנה דוגמה לבקשת curl:
# Get auth token $ TOKEN=$(gcloud auth print-access-token) # Make a request that includes the organization restriction header; this call makes a request to the logging API for a project not within the same organization listed in the header $ curl -H "X-Goog-Allowed-Resources: ${OR_HEADER}" -X POST -d '{"projectIds": ["other-project-123"]}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${TOKEN}" "https://logging.googleapis.com/v2/entries:list" { "error": { "code": 403, "message": "Access denied by organization restriction. Contact your administrator for additional information.", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "ORG_RESTRICTION_VIOLATION", "domain": "googleapis.com", "metadata": { "service": "logging.googleapis.com", "consumer": "other-project-123" } } ] } }הודעת השגיאה 'הגישה נדחתה' מציינת שהבקשה למשאב נדחתה.