Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

CC: Add image signature tests for SEV #5578

Open
wants to merge 1 commit into
base: CCv0
Choose a base branch
from

Conversation

Alex-Carter01
Copy link
Contributor

Inserts resource information to kbs for signing
adds example cosign and policy files to be used along with signing tests

Add currently one test for:
signed imagage with no required measurement

Will switch from draft PR to normal with the other three tests:
signed image with no required measurement, but wrong key (failure)
signed image with requirement measurement
signed image with required measurement (failure) eg. tamper with kernel_params,

Fixes: #5412

@katacontainersbot katacontainersbot added the size/medium Average sized task label Mar 31, 2023
@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/medium Average sized task labels Mar 31, 2023
@Alex-Carter01 Alex-Carter01 force-pushed the signing-test branch 3 times, most recently from e2438d8 to 3b714a6 Compare March 31, 2023 17:15
@katacontainersbot katacontainersbot added size/tiny Smallest and simplest task and removed size/large Task of significant size labels Mar 31, 2023
@Alex-Carter01 Alex-Carter01 force-pushed the signing-test branch 3 times, most recently from 8e2bc33 to af9870b Compare March 31, 2023 17:37
@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/tiny Smallest and simplest task labels Mar 31, 2023
@Alex-Carter01 Alex-Carter01 force-pushed the signing-test branch 7 times, most recently from 3201c7b to a21cb3e Compare April 6, 2023 16:35
@katacontainersbot katacontainersbot added size/tiny Smallest and simplest task and removed size/large Task of significant size labels Apr 6, 2023
@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/tiny Smallest and simplest task labels Apr 6, 2023
@Alex-Carter01 Alex-Carter01 force-pushed the signing-test branch 4 times, most recently from 7cc7829 to 1db0f64 Compare April 7, 2023 17:19
@katacontainersbot katacontainersbot added size/tiny Smallest and simplest task and removed size/large Task of significant size labels Apr 7, 2023
@Alex-Carter01 Alex-Carter01 force-pushed the signing-test branch 3 times, most recently from 2796f6f to e68a37f Compare April 13, 2023 01:53
@Alex-Carter01 Alex-Carter01 marked this pull request as ready for review April 14, 2023 17:02
Copy link

@fitzthum fitzthum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments. Note that this will need a lot of changes on rebase if #5594 is merged.

#copy resources
cp ${TESTS_REPO_DIR}/integration/kubernetes/confidential/fixtures/policy.json resources/
cp ${TESTS_REPO_DIR}/integration/kubernetes/confidential/fixtures/cosign.pub resources/
#cp ${TESTS_REPO_DIR}/integration/kubernetes/confidential/fixtures/cosignWrong.pub resources/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment. Don't we need this resource, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We ended up decing to do the wrong key test by switching the image (quay.io/kata-containers/confidential-containers:cosign-signed-key2). So I am removing the wrong cosign key and all mentions to it.

if [ -n "${measurement}" ]; then
mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${KBS_DB_HOST} -D ${KBS_DB} <<EOF
INSERT INTO resources SET resource_type="Policy", resource_path="policy.json", polid=10;
INSERT INTO resources SET resource_type="Cosign Key", resource_path="cosign.pub", polid=10;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These resource names will need to be updated using the new resource names. See #5577 for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update to the URI versions

@@ -514,7 +552,110 @@ EOF
fi
}

@test "$test_tag Test signed image with no required measurement" {
# Add resource files to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to what?


@test "$test_tag Test signed image with no required measurement, but wrong key (failure)" {
# Add resource files to
setup_cosign_signatures_files #"cosignWrong.pub"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment

@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/tiny Smallest and simplest task labels Apr 18, 2023
@katacontainersbot katacontainersbot added size/tiny Smallest and simplest task and removed size/large Task of significant size labels Apr 18, 2023
Inserts resource information to  kbs for signing
adds example cosign and policy files to be used along with signing tests

Adds tests for:
signed image with no required measurement
signed image with no required measurement, but wrong key
signed image with required measurement
signed image with invalid measurement

Fixes: kata-containers#5412
@katacontainersbot katacontainersbot added size/large Task of significant size and removed size/tiny Smallest and simplest task labels Apr 18, 2023
@Alex-Carter01
Copy link
Contributor Author

updated resource paths

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/large Task of significant size
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants