From a1e16ff6e0f926c6c69c5d5f9333ebfe36df69a9 Mon Sep 17 00:00:00 2001 From: Georgina Kinge Date: Wed, 25 May 2022 15:33:37 +0100 Subject: [PATCH] CCv0: Refactor signature verification PoC changes Removes signature verficiation files and related code Fixes: #4111 Signed-off-by: Georgina Kinge Co-authored-by: Megan Wright --- docs/how-to/ccv0.sh | 8 +++++ docs/how-to/how-to-build-and-test-ccv0.md | 9 ++++-- tools/osbuilder/rootfs-builder/README.md | 5 ++- tools/osbuilder/rootfs-builder/rootfs.sh | 17 ---------- .../signed-container-artifacts/README.md | 14 -------- .../signed-container-artifacts/public.gpg | 30 ------------------ .../quay_policy.json | 18 ----------- .../signed-container-artifacts/signatures.tar | Bin 2157 -> 0 bytes 8 files changed, 17 insertions(+), 84 deletions(-) delete mode 100644 tools/osbuilder/rootfs-builder/signed-container-artifacts/README.md delete mode 100644 tools/osbuilder/rootfs-builder/signed-container-artifacts/public.gpg delete mode 100644 tools/osbuilder/rootfs-builder/signed-container-artifacts/quay_policy.json delete mode 100644 tools/osbuilder/rootfs-builder/signed-container-artifacts/signatures.tar diff --git a/docs/how-to/ccv0.sh b/docs/how-to/ccv0.sh index 60f8db4d84..6d5ade9c0e 100755 --- a/docs/how-to/ccv0.sh +++ b/docs/how-to/ccv0.sh @@ -86,6 +86,7 @@ Commands: - build_qemu: Checkout, patch, build and install QEMU - configure: Configure Kata to use rootfs and enable debug - connect_to_ssh_demo_pod: Ssh into the ssh demo pod, showing that the decryption succeeded +- copy_files_to_guest Copies signature verification files to guest - create_rootfs: Create a local rootfs - crictl_create_cc_container Use crictl to create a new busybox container in the kata cc pod - crictl_create_cc_pod Use crictl to create a new kata cc pod @@ -532,6 +533,10 @@ shim_pull_image() { ${ctr_shim_command} } +call_copy_files_to_guest() { + copy_files_to_guest +} + main() { while getopts "dh" opt; do case "$opt" in @@ -641,6 +646,9 @@ main() { agent_create_container) agent_create_container ;; + copy_files_to_guest) + call_copy_files_to_guest + ;; *) usage 1 ;; diff --git a/docs/how-to/how-to-build-and-test-ccv0.md b/docs/how-to/how-to-build-and-test-ccv0.md index fc06b4b14f..038b47d508 100644 --- a/docs/how-to/how-to-build-and-test-ccv0.md +++ b/docs/how-to/how-to-build-and-test-ccv0.md @@ -312,9 +312,9 @@ In our test repository there are three tagged images: | Test Image | Base Image used | Signature status | GPG key status | | --- | --- | --- | --- | -| `quay.io/kata-containers/confidential-containers:signed` | `busybox:1.33.1` | [signature](./../../tools/osbuilder/rootfs-builder/signed-container-artifacts/signatures.tar) embedded in kata rootfs | [public key](./../../tools/osbuilder/rootfs-builder/signed-container-artifacts/public.gpg) embedded in kata rootfs | +| `quay.io/kata-containers/confidential-containers:signed` | `busybox:1.33.1` | [signature](https://github.com/kata-containers/tests/tree/CCv0/integration/confidential/fixtures/quay_verification/signatures.tar) embedded in kata rootfs | [public key](https://github.com/kata-containers/tests/tree/CCv0/integration/confidential/fixtures/quay_verification/public.gpg) embedded in kata rootfs | | `quay.io/kata-containers/confidential-containers:unsigned` | `busybox:1.33.1` | not signed | not signed | -| `quay.io/kata-containers/confidential-containers:other_signed` | `nginx:1.21.3` | [signature](./../../tools/osbuilder/rootfs-builder/signed-container-artifacts/signatures.tar) embedded in kata rootfs | GPG key not kept | +| `quay.io/kata-containers/confidential-containers:other_signed` | `nginx:1.21.3` | [signature](https://github.com/kata-containers/tests/tree/CCv0/integration/confidential/fixtures/quay_verification/signatures.tar) embedded in kata rootfs | GPG key not kept | Using a standard unsigned `busybox` image that can be pulled from another, *unprotected*, `quay.io` repository we can test a few scenarios. @@ -333,9 +333,14 @@ to create containers from these images using `crictl`: the guest agent code has been implemented, the Kata confidential-containers build needs to be run with `export SKOPEO=yes` as documented [above](#basic-script-set-up-and-optional-environment-variables) in order to use the image signature verification function. + - If you don't already have a Kata sandbox pod created with `crictl`, then follow the [instructions above](#using-crictl-for-end-to-end-provisioning-of-a-kata-confidential-containers-pod-with-an-unencrypted-image) up to, and including, the `~/ccv0.sh crictl_create_cc_pod` command. + +- In order to enable the guest image, you will need to copy over the policy and signature files needed by running +`~/ccv0.sh copy_files_to_guest`and then re-running `~/ccv0.sh crictl_create_cc_pod` which will delete and recreate +your pod - adding in the new files. - To test the fallback behaviour works using an unsigned image from an *unprotected* registry we can pull the `busybox` image by running: diff --git a/tools/osbuilder/rootfs-builder/README.md b/tools/osbuilder/rootfs-builder/README.md index 130181abd4..361bcb3609 100644 --- a/tools/osbuilder/rootfs-builder/README.md +++ b/tools/osbuilder/rootfs-builder/README.md @@ -191,6 +191,5 @@ needed. Changes affect the files included in the final guest image. #### Confidential containers support When building the rootfs for confidential containers if `SKOPEO=yes` is set then the `skopeo` -package is built and added into the rootfs. It also adds the signature verification proof of concept files. -If `UMOCI=yes` is set then the `umoci` package is built and added into the rootfs. -For more info on these, see [the documentation](signed-container-artifacts/README.md). +package is built and added into the rootfs. +If `UMOCI=yes` is set then the `umoci` package is built and added into the rootfs. \ No newline at end of file diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index fa2dfad496..5d6cd1fd4e 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -639,23 +639,6 @@ EOF make bin/skopeo install -o root -g root -m 0755 bin/skopeo "${ROOTFS_DIR}/usr/bin/" popd - - # Temp PoC code: Add image signature verification artifacts into rootfs - rootfs_quay_verification_directory="/etc/containers/quay_verification" - dev_verification_directory="${script_dir}/signed-container-artifacts" - mkdir -p "${ROOTFS_DIR}${rootfs_quay_verification_directory}/signatures" - install -o root -g root -m 0644 "${dev_verification_directory}/public.gpg" "${ROOTFS_DIR}${rootfs_quay_verification_directory}/public.gpg" - install -o root -g root -m 0644 "${dev_verification_directory}/quay_policy.json" "${ROOTFS_DIR}${rootfs_quay_verification_directory}/quay_policy.json" - tar -zvxf "${dev_verification_directory}/signatures.tar" -C "${ROOTFS_DIR}${rootfs_quay_verification_directory}/signatures" - - container_registries_dir="${ROOTFS_DIR}/etc/containers/registries.d" - mkdir -p ${container_registries_dir} - cat << EOF | tee ${container_registries_dir}/quay.io.yaml -docker: - quay.io/kata-containers/confidential-containers: - sigstore: file://${rootfs_quay_verification_directory}/signatures - sigstore-staging: file://${rootfs_quay_verification_directory}/signatures -EOF fi if [ -n "${AA_KBC}" ]; then diff --git a/tools/osbuilder/rootfs-builder/signed-container-artifacts/README.md b/tools/osbuilder/rootfs-builder/signed-container-artifacts/README.md deleted file mode 100644 index 0446f78534..0000000000 --- a/tools/osbuilder/rootfs-builder/signed-container-artifacts/README.md +++ /dev/null @@ -1,14 +0,0 @@ -### Description - -This directory provides some artifacts required for implementing and testing the kata-agent's ability to verify the signatures of container images pulled from the test `quay.io/kata-containers/confidential-containers` repository. - -### Contents - -It consists of: -- `signatures.tar` - a tar archive containing the signatures of `quay.io/kata-containers/confidential-containers:signed` and `quay.io/kata-containers/confidential-containers:other_signed` -- `public.gpg` - the public GPG key, paired to the private key pair that was used to sign `quay.io/kata-containers/confidential-containers:signed` -- `quay_policy.json` - a container policy file that allows insecure access to all repos except `quay.io/kata-containers`, in which it enforced signatures by the above key - -### Usage - -As part of the Confidential Containers v0 proof of concept these files will be built into the kata image and used for the purposes of testing verification of signed images see [Issue #2682](https://github.com/kata-containers/kata-containers/issues/2682). They are intended to be temporary whilst a better solution is found to pass them in, probably based on the attestation agent. \ No newline at end of file diff --git a/tools/osbuilder/rootfs-builder/signed-container-artifacts/public.gpg b/tools/osbuilder/rootfs-builder/signed-container-artifacts/public.gpg deleted file mode 100644 index c85f2b166a..0000000000 --- a/tools/osbuilder/rootfs-builder/signed-container-artifacts/public.gpg +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQINBGFMVEgBEACzd/HJz6nq8GAjFoWt20PhAy4Rp8q4qeFE3JJ+lwhPzkJdbL3Z -QJ31TECrbKUyo3LIQ31B75AYw3vnEIUOcutSE1i8o557IoxxlG4SwtkRVdUPeE7e -tIN2mZ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/enGrXzJ/umgihu/G/b5alefzSOq -xt0r6z7RnO99rUtKCam+5EDkKzUvhjgR3j2LkGZC1fqANt6LKO+C0Oqm0JT2mTda -ta/x7Btj36KIb3uNSRt2bDrFYxOj6sFyPVTUlzNgitnK3TqIxnmyiGdhOUG2sZy8 -0I1Z4vZOBFw23XOjc4TTdVSoAmLRfHNyfmayGm/ckleN5vOlbW9O9tDkC4jZ6ZFM -1qg12RLoKWqEthvis9XsWLbxAAhm1nFJWEiNXsumMP74SW0//jbdEOLNo0WDnSNb -gu6khUarHGGiPBsxW8qDFusHXZe0JCIQQQ0CeXwOZ0iqH4/mCIJByHwgDtLgnsTM -6khgSea1y5ktQBvRuMP889ebPHJ261jyIy9uy+nhiKypoO+yj1f/Rnj5kKKv72nK -5uESpJBT -=B7vQ ------END PGP PUBLIC KEY BLOCK----- diff --git a/tools/osbuilder/rootfs-builder/signed-container-artifacts/quay_policy.json b/tools/osbuilder/rootfs-builder/signed-container-artifacts/quay_policy.json deleted file mode 100644 index 744520c81f..0000000000 --- a/tools/osbuilder/rootfs-builder/signed-container-artifacts/quay_policy.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "default": [ - { - "type": "insecureAcceptAnything" - } - ], - "transports": { - "docker": { - "quay.io/kata-containers": [ - { - "type": "signedBy", - "keyType": "GPGKeys", - "keyPath": "/etc/containers/quay_verification/public.gpg" - } - ] - } - } -} \ No newline at end of file diff --git a/tools/osbuilder/rootfs-builder/signed-container-artifacts/signatures.tar b/tools/osbuilder/rootfs-builder/signed-container-artifacts/signatures.tar deleted file mode 100644 index 90000f2770cd192626bba154c44775903a5a45cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2157 zcmV-z2$J_7iwFP!000001MQf5P*Z0bhfyk);uJ>^R76=pXt?HFav~ziE}#NYglO;r zI=LN)2q+1t$fd|ixhPt03W8XWU{+Bff+9jd0SP2k3?K-~2$&QzNaZRL$i_~0)@obZ zoi(y+o`24nBy)1k`F-#6eed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