1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Verify signatures with Cosign to improve container reliability 📐

Last updated at Posted at 2023-02-08

こんにちは。Enabling team の山本です。

今回は Container Image の信頼性向上について書きます。

弊社では、この数年で、サービスが増え、機能が増え、Developer が増え、deploy される Container が日々増えています。

気をつけるのは、

  • Base Image に何を使っているか?
  • Image は、サービスの正式な CI Pipeline で build/scan されたものか?

Supply Chain を Secure に保つことに気を使うようになりました。

TL;DR

  • Cosign を使えば、本番サービスにデプロイするイメージを検証して、信頼性を向上させることができます。

Cosign

1.24 からCosign で署名され、Image を検証できるようになるそうです。
署名を検証することにより、Software Supply Chain の Security を向上できます。
今でも、出自がわからない Image を base に build されることはよくあります、、

今回の構成

  • Cosign
  • Policy Controller(policy-controller)
  • Cloud KMS(KMS)
  • Google Artifact Registry(GAR)
  • Google Kubernetes Engine(GKE): 1.24.8-gke.2000

署名を確認してみる

失敗

yamamoto_daisuke@cloudshell:~ (linkerd-sandbox)$ kubectl create deployment nginx \
    --image=nginx \
    -n test
error: failed to create deployment: admission webhook "policy.sigstore.dev" denied the request: validation failed: failed policy: private-signed-images-cip: spec.template.spec.containers[0].image
index.docker.io/library/nginx@sha256:c54fb26749e49dc2df77c6155e8b5f0f78b781b7f0eadd96ecfabdcdfa5b1ec4 signature key validation failed for authority authority-0 for index.docker.io/library/nginx@sha256:c54fb26749e49dc2df77c6155e8b5f0f78b781b7f0eadd96ecfabdcdfa5b1ec4: no matching signatures:

成功

yamamoto_daisuke@cloudshell:~ (linkerd-sandbox)$ kubectl create deployment nginx \
    --image=${REGION}-docker.pkg.dev/${PROJECT_ID}/${REGISTRY_NAME}/nginx@${SHA} \
    -n test
deployment.apps/nginx created    # Success!!
yamamoto_daisuke@cloudshell:~ (linkerd-sandbox)$

まとめ

署名を検証する方法について書きました。
Software Supply Chain への攻撃が増えている中で、Image の署名検証は重要な要素になってきています。
Cosign に興味がある方は、ぜひ試してみてください。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?