Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit 8eda613

Browse files
author
Mathieu Benoit
authored
Update README.md
Signed-off-by: Mathieu Benoit <mabenoit@google.com>
1 parent 11ed281 commit 8eda613

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

examples/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,45 @@ Next sign your container using the KMS key and `cosign`
124124
cosign sign --key "awskms:///<< arn of kms key >>" "${IMAGE}"
125125
```
126126

127+
### signed-by-gcp-kms-key
128+
129+
Source: [policies/signed-by-gcp-kms.yaml](./policies/signed-by-gcp-kms.yaml)
130+
131+
Asserts that images have been signed by a specific GCP KMS key.
132+
133+
```
134+
POLICY="policies/signed-by-gcp-kms.yaml"
135+
```
136+
137+
#### How to satisfy this policy
138+
139+
Create the GCP KMS keyring and key to sign your container images.
140+
141+
```sh
142+
gcloud kms keyrings create ${KEY_RING} \
143+
--location ${REGION}
144+
gcloud kms keys create ${KEY_NAME} \
145+
--keyring ${KEY_RING} \
146+
--location ${REGION} \
147+
--purpose asymmetric-signing \
148+
--default-algorithm ec-sign-p256-sha256
149+
```
150+
151+
Next sign your container using the KMS key and `cosign`.
152+
153+
```sh
154+
gcloud auth application-default login
155+
cosign generate-key-pair \
156+
--kms gcpkms://projects/${PROJECT_ID}/locations/${REGION}/keyRings/${KEY_RING}/cryptoKeys/${KEY_NAME}
157+
cosign sign \
158+
--key gcpkms://projects/${PROJECT_ID}/locations/${REGION}/keyRings/${KEY_RING}/cryptoKeys/${KEY_NAME} \
159+
${IMAGE}
160+
```
161+
162+
To satisfy the policy, ensure that the policy controller must have `roles/cloudkms.viewer`
163+
and `roles/cloudkms.verifier` IAM permissions on the relevant service account. Also,
164+
the GKE cluster should have the `https://www.googleapis.com/auth/cloudkms` scope.
165+
127166
### signed-by-github-actions
128167

129168
Source: [policies/signed-by-github-actions.yaml](./policies/signed-by-github-actions.yaml)

0 commit comments

Comments
 (0)