Google Cloud์์๋ ์กฐ์ง ์ ์ฒด์์ ํค ๋ฒ์ ํ๊ธฐ ์ ์ฑ ์ ์ค์ ํ๊ธฐ ์ํด ๋ ๊ฐ์ง ์กฐ์ง ์ ์ฑ ์ ์ฝ์กฐ๊ฑด์ด ์ฌ์ฉ๋ฉ๋๋ค.
constraints/cloudkms.minimumDestroyScheduledDuration
์ ์กฐ์ง ๋ด ์ ํค์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ์ ๋ํ ์ต์ ๊ธธ์ด๋ฅผ ์ค์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.constraints/cloudkms.disableBeforeDestroy
๋ ํค ๋ฒ์ ํ๊ธฐ๋ฅผ ์์ฝํ๊ธฐ ์ ์ ๋จผ์ ํค ๋ฒ์ ์ ์ฌ์ฉ ์ค์งํ๋๋ก ์๊ตฌํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
์์ํ๊ธฐ ์ ์
์ด ํ์ด์ง์ ์๋ด์์๋ ์ฌ์ฉ์๊ฐ ์ ์ฝ์กฐ๊ฑด ์ฌ์ฉ์ ์ต์ํ๋ฉฐ ํ์ํ ๋ฆฌ์์ค์ ์ญํ ์ด ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
ํ์ํ ๋ฆฌ์์ค
์ด ํ์ด์ง์ ๋จ๊ณ๋ฅผ ์๋ฃํ๋ ค๋ฉด ๋ค์ ๋ฆฌ์์ค๊ฐ ์์ด์ผ ํฉ๋๋ค.
- ์กฐ์ง
- ์ ํ์ฌํญ: ์กฐ์ง ๋ด ํด๋ ๋๋ ํ๋ก์ ํธ ๋ฆฌ์์ค
ํ์ํ ์ญํ
์กฐ์ง ์ ์ฑ
์ ๊ด๋ฆฌํ๋ ๋ฐ ํ์ํ ๊ถํ์ ์ป์ผ๋ ค๋ฉด ๊ด๋ฆฌ์์๊ฒ ์กฐ์ง์ ์กฐ์ง ์ ์ฑ
๊ด๋ฆฌ์(roles/orgpolicy.policyAdmin
) IAM ์ญํ ์ ์์ฒญํ์ธ์.
์ญํ ๋ถ์ฌ์ ๋ํ ์์ธํ ๋ด์ฉ์ ํ๋ก์ ํธ, ํด๋, ์กฐ์ง์ ๋ํ ์ก์ธ์ค ๊ด๋ฆฌ๋ฅผ ์ฐธ์กฐํ์ธ์.
์ด ์ฌ์ ์ ์๋ ์ญํ ์๋ ์กฐ์ง ์ ์ฑ ์ ๊ด๋ฆฌํ๋ ๋ฐ ํ์ํ ๊ถํ์ด ํฌํจ๋์ด ์์ต๋๋ค. ํ์ํ ์ ํํ ๊ถํ์ ๋ณด๋ ค๋ฉด ํ์ ๊ถํ ์น์ ์ ํผ์น์ธ์.
ํ์ ๊ถํ
์กฐ์ง ์ ์ฑ ์ ๊ด๋ฆฌํ๋ ค๋ฉด ๋ค์ ๊ถํ์ด ํ์ํฉ๋๋ค.
-
orgpolicy.constraints.list
-
orgpolicy.policies.create
-
orgpolicy.policies.delete
-
orgpolicy.policies.list
-
orgpolicy.policies.update
-
orgpolicy.policy.get
-
orgpolicy.policy.set
์ปค์คํ ์ญํ ์ด๋ ๋ค๋ฅธ ์ฌ์ ์ ์๋ ์ญํ ์ ์ฌ์ฉํ์ฌ ์ด ๊ถํ์ ๋ถ์ฌ๋ฐ์ ์๋ ์์ต๋๋ค.
์ต์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ ํ์
ํค๋น ์ต์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ ์ ์ฝ์กฐ๊ฑด(constraints/cloudkms.minimumDestroyScheduledDuration
)์ ์ ํค์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ์ ๋ํ ์ต์ ๊ธธ์ด๋ฅผ ์ค์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ์ ์ฝ์กฐ๊ฑด์ ํ๋ก์ ํธ, ํด๋ ๋๋ ์กฐ์ง ์์ค์์ ์ต์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ์ ์ฌ์ ์ํฉ๋๋ค. ์ด ์ ์ฝ์กฐ๊ฑด์ ์ฌ์ ํ ํ์ํ ํค๋ฅผ ์ค์๋ก ํ๊ธฐํ ๊ฐ๋ฅ์ฑ์ ์ค์
๋๋ค. ์ด ์ ์ฝ์กฐ๊ฑด์ ๋ ๋์ ๊ฐ์ผ๋ก ์ค์ ํ๋ฉด ์ทจ์๊ฐ ๋ถ๊ฐ๋ฅํด์ง๊ธฐ ์ ์ ํค ํ๊ธฐ๋ฅผ ๋ฐฉ์งํ ์๊ฐ์ ํ๋ณดํ ์ ์์ต๋๋ค.
๋ฐ์ดํฐ ๋ณด๊ด ์๊ตฌ์ฌํญ์ด ์ ์ฉ๋๋ ํ๋ก๋์ ๋ฐ์ดํฐ์ ๊ฐ์ด ์์น ์๋ ํค ํ๊ธฐ๊ฐ ๋ ์ ํดํ ๊ฒฝ์ฐ ์ด ์ ์ฝ์กฐ๊ฑด์ ๋ ๋์ ๊ฐ์ ์ฌ์ฉํฉ๋๋ค. ๊ฐ๋ฐ ๋๋ ํ ์คํธ ํ๊ฒฝ๊ณผ ๊ฐ์ด ์์น ์๋ ํค ํ๊ธฐ๊ฐ ๋ ์ ํดํ ๊ฒฝ์ฐ ์ด ์ ์ฝ์กฐ๊ฑด์ ๋ ๋ฎ์ ๊ฐ์ ์ฌ์ฉํฉ๋๋ค. ๋ ๋ฎ์ ๊ฐ์ ์ฌ์ฉํ์ฌ ์์์ ์ ํ ์ํธํ ํ์๋ฅผ ํ์ฉํ ์๋ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด ์ ์ฝ์กฐ๊ฑด์ ์ต์๊ฐ์ผ๋ก ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ์ด ์งง์ ์๋ก์ด ํค๊ฐ ์์ฑ๋๊ฒ ํ ์ ์์ต๋๋ค.
์ต์ ํ๊ธฐ ์์ฝ ๊ธฐ๊ฐ์ด ํ์ํ ๊ฒฝ์ฐ ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์.
describe
๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ์กฐ์ง ๋ฆฌ์์ค์ ํ์ฌ ์ ์ฑ ์ ๊ฐ์ ธ์ต๋๋ค. ์ด ๋ช ๋ น์ด๋ ์ด ๋ฆฌ์์ค์ ์ง์ ์ ์ฉ๋๋ ์ ์ฑ ์ ๋ฐํํฉ๋๋ค.gcloud org-policies describe \ constraints/cloudkms.minimumDestroyScheduledDuration \ --organization=ORGANIZATION_ID
ORGANIZATION_ID
๋ฅผ ์กฐ์ง ๋ฆฌ์์ค์ ๊ณ ์ ์๋ณ์๋ก ๋ฐ๊ฟ๋๋ค. ์กฐ์ง ID๋ ์ญ์ง์ ํ์์ด๋ฉฐ ์์ 0์ด ์ฌ ์ ์์ต๋๋ค.--folder
๋๋--project
ํ๋๊ทธ์ ํด๋ ID ๋๋ ํ๋ก์ ํธ ID๋ฅผ ๊ฐ๊ฐ ์ฌ์ฉํ์ฌ ํด๋ ๋๋ ํ๋ก์ ํธ์ ์กฐ์ง ์ ์ฑ ์ ๋ณผ ์๋ ์์ต๋๋ค.ํ์ฌ ์กฐ์ง ์ ์ฑ ์ด ์๋ ๊ฒฝ์ฐ ํด๋น ์ ์ฑ ์ด ์๋ต์ ๋ฐํ๋ฉ๋๋ค. ์ถ๋ ฅ์ ๋ค์๊ณผ ๋น์ทํฉ๋๋ค.
name: organizations/ORGANIZATION_ID/policies/cloudkms.minimumDestroyScheduledDuration spec: etag: COTP+KYGELiCmsoB inheritFromParent: true rules: - values: allowedValues: - in:7d updateTime: '2023-08-17T14:00:04.424051Z'
์ ์ฑ ์ด ์ค์ ๋์ง ์์ ๊ฒฝ์ฐ
describe
๋ช ๋ น์ด๋NOT_FOUND
์ค๋ฅ๋ฅผ ๋ฐํํฉ๋๋ค.ERROR: (gcloud.org-policies.describe) NOT_FOUND: Requested entity was not found.
set-policy
๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ์กฐ์ง์ ์ ์ฑ ์ ์ค์ ํฉ๋๋ค. ์ด ๋ช ๋ น์ด๋ ํ์ฌ ๋ฆฌ์์ค์ ์ฐ๊ฒฐ๋ ์ ์ฑ ์ ๋ฎ์ด์๋๋ค.์ ์ฑ ์ ์ ์ฅํ
/tmp/policy.yaml
์์ ํ์ผ์ ๋ง๋ญ๋๋ค.name: organizations/ORGANIZATION_ID/policies/cloudkms.minimumDestroyScheduledDuration spec: rules: - values: allowedValues: - in:MINIMUM_DURATION
๋ค์์ ๋ฐ๊ฟ๋๋ค.
ORGANIZATION_ID
: ์กฐ์ง์ ์ซ์ IDMINIMUM_DURATION
: ์ด ์กฐ์ง์ ํค์ ๋ํด ํ๊ธฐ ์์ฝ๋จ ์ํ๋ก ์ ์ง๋๋ ์ต์ ๊ธฐ๊ฐ(์ผ)์ ๋๋ค.7d
,15d
,30d
,60d
,90d
,120d
์ค ํ๋์ฌ์ผ ํฉ๋๋ค.
set-policy
๋ช ๋ น์ด๋ฅผ ์คํํฉ๋๋ค.gcloud org-policies set-policy /tmp/policy.yaml
describe --effective
๋ฅผ ์ฌ์ฉํ์ฌ ํ์ฌ์ ์ ํจ ์ ์ฑ ์ ํ์ธํฉ๋๋ค. ์ด ๋ช ๋ น์ด๋ ์์์ด ํฌํจ๋ ๋ฆฌ์์ค ๊ณ์ธต ๊ตฌ์กฐ์์ ์ด ์์ ์ ํ๊ฐ๋ ๊ฒ์ ํด๋นํ๋ ์กฐ์ง ์ ์ฑ ์ ๋ฐํํฉ๋๋ค.gcloud org-policies describe \ constraints/cloudkms.minimumDestroyScheduledDuration --effective \ --organization=ORGANIZATION_ID
์ถ๋ ฅ์ ๋ค์๊ณผ ๋น์ทํฉ๋๋ค.
name: organizations/ORGANIZATION_ID/policies/cloudkms.minimumDestroyScheduledDuration spec: rules: - values: allowedValues: - 30d - 15d - 90d - 60d - 7d - 120d
์ด ์กฐ์ง ์ ์ฑ ์ ์กฐ์ง ์์ค์์ ์ค์ ๋์์ผ๋ฏ๋ก ์์์ ํ์ฉํ๋ ๋ชจ๋ ํ์ ๋ฆฌ์์ค์ ์์๋ฉ๋๋ค.
ํ๊ธฐ ์ ํค ์ฌ์ฉ ์ค์ง ํ์
ํค ํ๊ธฐ ์ฌ์ฉ ์ค์ง ํค ์ ํ ์ ์ฝ์กฐ๊ฑด(constraints/cloudkms.disableBeforeDestroy
)์ ์ฌ์ฉํ๋ฉด ํค ํ๊ธฐ๋ฅผ ์์ฝํ๊ธฐ ์ ์ ํค๊ฐ ์ฌ์ฉ ์ค์ง๋๋๋ก ์๊ตฌํ ์ ์์ต๋๋ค.
ํค๋ฅผ ํ๊ธฐํ๊ธฐ ์ ์ ์ฌ์ฉ ์ค์งํ๋ ๊ฒ์ ํค๊ฐ ์ฌ์ฉ ์ค์ด ์๋์ง ํ์ธํ๋ ๋ฐ ๋์์ด ๋๊ธฐ ๋๋ฌธ์ ๊ถ์ฅ๋ฉ๋๋ค. ์ด ์ ์ฝ์กฐ๊ฑด์ ์ ์คํ Identity and Access Management ์ ์ฑ
๊ณผ ๊ฒฐํฉํ์ฌ ์ฌ๋ฌ ์ญํ ์ ํ๋ ฅ์ด ํ์ํ ๋ค๋จ๊ณ ํ๊ธฐ ํ๋ก์ธ์ค๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
์ด ์ ์ฝ์กฐ๊ฑด์ ์ฌ์ฉํ์ฌ ๋ค๋จ๊ณ ํ๊ธฐ ํ๋ก์ธ์ค๋ฅผ ๋ง๋ค๋ ค๋ฉด cloudkms.cryptoKeyVersions.update
๊ถํ๊ณผ cloudkms.cryptoKeyVersions.destroy
๊ถํ์ ๋ชจ๋ ๊ฐ์ง ์ฌ์ฉ์๊ฐ ์์ด์ผ ํฉ๋๋ค. ์ด ์ฌ์ฉ ์ฌ๋ก์๋ ์ปค์คํ
์ญํ ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
ํค ํ๊ธฐ๋ฅผ ์์ฝํ๊ธฐ ์ ์ ํค๊ฐ ์ฌ์ฉ ์ค์ง ์ํ๊ฐ ๋๋๋ก ํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์.
gcloud
describe
๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ์กฐ์ง ๋ฆฌ์์ค์ ํ์ฌ ์ ์ฑ ์ ๊ฐ์ ธ์ต๋๋ค. ์ด ๋ช ๋ น์ด๋ ์ด ๋ฆฌ์์ค์ ์ง์ ์ ์ฉ๋๋ ์ ์ฑ ์ ๋ฐํํฉ๋๋ค.gcloud org-policies describe \ constraints/cloudkms.disableBeforeDestroy \ --organization=ORGANIZATION_ID
ORGANIZATION_ID
๋ฅผ ์กฐ์ง ๋ฆฌ์์ค์ ๊ณ ์ ์๋ณ์๋ก ๋ฐ๊ฟ๋๋ค. ์กฐ์ง ID๋ ์ญ์ง์ ํ์์ด๋ฉฐ ์์ 0์ด ์ฌ ์ ์์ต๋๋ค.--folder
๋๋--project
ํ๋๊ทธ์ ํด๋ ID ๋๋ ํ๋ก์ ํธ ID๋ฅผ ๊ฐ๊ฐ ์ฌ์ฉํ์ฌ ํด๋ ๋๋ ํ๋ก์ ํธ์ ์กฐ์ง ์ ์ฑ ์ ๋ณผ ์๋ ์์ต๋๋ค.ํ์ฌ ์กฐ์ง ์ ์ฑ ์ด ์๋ ๊ฒฝ์ฐ ํด๋น ์ ์ฑ ์ด ์๋ต์ ๋ฐํ๋ฉ๋๋ค. ์ถ๋ ฅ์ ๋ค์๊ณผ ๋น์ทํฉ๋๋ค.
name: organizations/ORGANIZATION_ID/policies/cloudkms.disableBeforeDestroy spec: etag: CPvY+KYGENDwgxA= rules: - enforce: true updateTime: '2023-08-17T14:19:39.033618Z'
์ ์ฑ ์ด ์ค์ ๋์ง ์์ ๊ฒฝ์ฐ
describe
๋ช ๋ น์ด๋NOT_FOUND
์ค๋ฅ๋ฅผ ๋ฐํํฉ๋๋ค.ERROR: (gcloud.org-policies.describe) NOT_FOUND: Requested entity was not found.
set-policy
๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ์กฐ์ง์ ์ ์ฑ ์ ์ค์ ํฉ๋๋ค. ์ด ๋ช ๋ น์ด๋ ์ด๋ฏธ ๋ฆฌ์์ค์ ์ฐ๊ฒฐ๋ ์ ์ฑ ์ ๋ฎ์ด์๋๋ค.์ ์ฑ ์ ์ ์ฅํ
/tmp/policy.yaml
์์ ํ์ผ์ ๋ง๋ญ๋๋ค.name: organizations/ORGANIZATION_ID/policies/cloudkms.disableBeforeDestroy spec: rules: - enforce: true
ORGANIZATION_ID
๋ฅผ ์กฐ์ง ๋ฆฌ์์ค์ ๊ณ ์ ์๋ณ์๋ก ๋ฐ๊ฟ๋๋ค.set-policy
๋ช ๋ น์ด๋ฅผ ์คํํฉ๋๋ค.gcloud org-policies set-policy /tmp/policy.yaml
describe --effective
๋ฅผ ์ฌ์ฉํ์ฌ ํ์ฌ์ ์ ํจ ์ ์ฑ ์ ํ์ธํฉ๋๋ค. ์ด ๋ช ๋ น์ด๋ ์์์ด ํฌํจ๋ ๋ฆฌ์์ค ๊ณ์ธต ๊ตฌ์กฐ์์ ์ด ์์ ์ ํ๊ฐ๋ ๊ฒ์ ํด๋นํ๋ ์กฐ์ง ์ ์ฑ ์ ๋ฐํํฉ๋๋ค.gcloud org-policies describe \ constraints/cloudkms.disableBeforeDestroy --effective \ --organization=ORGANIZATION_ID
์ถ๋ ฅ์ ๋ค์๊ณผ ๋น์ทํฉ๋๋ค.
name: organizations/ORGANIZATION_ID/policies/cloudkms.minimumDestroyScheduledDuration spec: rules: - enforce: true
์ด ์กฐ์ง ์ ์ฑ ์ ์กฐ์ง ์์ค์์ ์ค์ ๋์์ผ๋ฏ๋ก ์์์ ํ์ฉํ๋ ๋ชจ๋ ํ์ ๋ฆฌ์์ค์ ์์๋ฉ๋๋ค.
๋ค์ ๋จ๊ณ
- ํค ๋ฒ์ ์ํ์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
- ํค ๋ฒ์ ํ๊ธฐ ๋ฐ ๋ณต์