Information
Binary Authorization helps to protect supply-chain security by only allowing images with verifiable cryptographically signed metadata into the cluster.
Binary Authorization provides software supply-chain security for images that are deployed to GKE from Google Container Registry (GCR) or another container image registry.
Binary Authorization requires images to be signed by trusted authorities during the development process. These signatures are then validated at deployment time. By enforcing validation, tighter control over the container environment can be gained by ensuring only verified images are integrated into the build-and-release process.
Solution
Using Google Cloud Console
- Go to Binary Authorization by visiting:
https://console.cloud.google.com/security/binary-authorization
- Enable the Binary Authorization API (if disabled).
- Create an appropriate policy for use with the cluster. See
https://cloud.google.com/binary-authorization/docs/policy-yaml-reference
for guidance.
- Go to Kubernetes Engine by visiting:
https://console.cloud.google.com/kubernetes/list
- Select the cluster for which Binary Authorization is disabled.
- Under the details pane, within the Security section, click on the pencil icon named Edit Binary Authorization
- Check the box next to Enable Binary Authorization
- Choose Enforce policy and provide a directory for the policy to be used.
- Click SAVE CHANGES
Using Command Line:
Update the cluster to enable Binary Authorization:
gcloud container cluster update <cluster_name> --zone <compute_zone> --binauthz-evaluation-mode=<evaluation_mode>
Example:
gcloud container clusters update $CLUSTER_NAME --zone $COMPUTE_ZONE --binauthz-evaluation-mode=PROJECT_SINGLETON_POLICY_ENFORCE
See:
https://cloud.google.com/sdk/gcloud/reference/container/clusters/update#--binauthz-evaluation-mode
for more details around the evaluation modes available.
Create a Binary Authorization Policy using the Binary Authorization Policy Reference:
https://cloud.google.com/binary-authorization/docs/policy-yaml-reference
for guidance.
Import the policy file into Binary Authorization:
gcloud container binauthz policy import <yaml_policy>
Impact:
Care must be taken when defining policy in order to prevent inadvertent denial of container image deployments. Depending on policy, attestations for existing container images running within the cluster may need to be created before those images are redeployed or pulled as part of the pod churn.
To prevent key system images from being denied deployment, consider the use of global policy evaluation mode, which uses a global policy provided by Google and exempts a list of Google-provided system images from further policy evaluation.