이그레스 프록시를 구성하기 전에 curl과 같은 도구를 사용하여 조직 액세스 제한 헤더를 직접 테스트할 수 있습니다.
이러한 테스트를 통해 승인된Cloud de Confiance by S3NS 조직에 대한 요청이 성공하고 승인되지 않은 조직에 대한 요청이 차단되는지 확인할 수 있습니다.
조직 액세스 제한 헤더 테스트
조직 액세스 제한 헤더를 만들고 테스트하려면 다음 안내를 따르세요.
조직의 Cloud de Confiance by S3NS 조직 ID를 가져오려면
gcloud organizations list명령어를 사용합니다.gcloud organizations list출력 예시는 다음과 같습니다.
DISPLAY_NAME: Organization A ID: 123456789 DIRECTORY_CUSTOMER_ID: a1b2c3d4조직 ID를 가져온 후 헤더 값에 대한 JSON 표현을 다음 형식으로 작성합니다.
{ "resources": ["organizations/123456789"], "options": "strict" }RFC 4648 섹션 5 사양에 따라 요청 헤더의 값을 인코딩합니다.
예를 들어 헤더 값의 JSON 표현이
authorized_orgs.json파일에 저장되는 경우 basenc를 통한 인코딩은 다음과 같습니다.$ OR_HEADER=`cat authorized_orgs.json | basenc --base64url -w0` $ echo $OR_HEADER ewogInJlc291cmNlcyI6IFsib3JnYW5pemF0aW9ucy8xMjM0NTY3ODkiXQogIm9wdGlvbnMiOiAic3RyaWN0Igp9Cgo=헤더 구성에 따라 작성된Cloud de Confiance by S3NS 조직 내에 있는 리소스에 대해 액세스가 허용되는지 테스트하려면 작성된Cloud de Confiance by S3NS 조직 내에서 리소스에 대해 curl 요청을 만듭니다. 다음은 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 조직 외부의 리소스에 대한 액세스를 거부하는지 테스트하려면 승인된Cloud de Confiance by S3NS 조직 외부의 리소스에 대한 curl 요청을 만듭니다. 다음은 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" } } ] } }액세스 거부 오류 메시지는 리소스 요청이 거부되었음을 나타냅니다.
다음 단계
- 조직 액세스 제한 사용 알아보기
- 조직 액세스 제한에서 지원하는 서비스 알아보기