Container Registry supports image signing. This feature prevents man-in-the-middle (MITM) attacks, and prevents unauthorized image updates or deployment. This way, image consistency can be ensured from distribution to deployment. Container Registry supports automatic image signing by namespace. Every time an image is pushed to Container Registry, Container Registry automatically signs the image based on the matched signature rule. This ensures that your container images are trustworthy.
Prerequisites
- A Container Registry Enterprise Edition instance of Advanced Edition is created. For more information, see Create a Container Registry Enterprise Edition instance.
- Key Management Service (KMS) is activated. For more information, see Activate KMS.
Create asymmetric keys
Authorize Container Registry to use KMS keys
To allow Container Registry to read asymmetric keys within your account, configure a policy in Resource Access Management (RAM).
- Log on to the RAM console.
- In the left-side navigation pane, click RAM Roles.
- On the RAM Roles page, create a RAM role named AliyunContainerRegistryKMSRole.
- On the RAM Roles page, click Create RAM Role.
- In the Select Role Type step, select a trusted entity type and click Next.
- In the Configure Role step, set the RAM Role Name parameter to AliyunContainerRegistryKMSRole and select an Alibaba Cloud account. Then, click OK.
- Modify the trust policy.
- Create a policy named AliyunContainerRegistryKMSRolePolicy.
- In the left-side navigation pane, click RAM Roles. In the role list, find the
AliyunContainerRegistryKMSRole
role. - Click Add Permissions in the Actions column.
- Click Custom Policy below Select Policy, find and click the
AliyunContainerRegistryKMSRolePolicy
policy, and then click OK.
Configure an authenticator and a verification policy
- Log on to the Security Center console.
- In the left-side navigation page, choose . On the Container Signature page, create an authenticator and associate it with the KMS key for image signing.
- Optional:Optional. Create a verification policy to associate the authenticator with your Container Service for Kubernetes (ACK) cluster. For more information, see Use the container signature feature.
Configure a signature rule for automatic image signing
Verify image signatures
Use kritis-validation-hook to verify signatures of container images. For more information, see kritis-validation-hook introduction.
- You can use kritis-validation-hook to automatically verify image signatures in ACK clusters. You can set a policy to block image deployment if image signatures fail the verification. We recommend that you use this method.
- You can also verify image signatures in Container Registry by using the signature verification feature of KMS.