Skip to content

eBPF-based security platform

testing: rebuild the bundle when the private key is not its own

Daniel Borkmann2fce5899614e
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 971021a2..e5056de0 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -357,10 +357,12 @@ target, the test helpers, the upatch fixtures signed with keys
generated for the bundle, the dm-verity runtime image and the signed
config images. :src:`testing/vm/build-bundle.sh` builds the bpf-next
bundle into ``build/test-vm/host-bundle-bpf-next-verity/`` and keeps
-the signing key in
-``build/test-vm/host-bundle-bpf-next-verity.operator/keys/``.
-Every target that boots a VM rebuilds the bundle when one of its inputs
-changed. Build it alone with:
+the signing key outside the checkout, which every guest can read, in
+``/tmp/shirudo-test-vm-private-<uid>/operator-keys/keys/``.
+``TEST_VM_HOST_PRIVATE_DIR`` names another directory, which must lie
+outside the repository. Every target that boots a VM rebuilds the bundle
+when one of its inputs changed, or when that directory does not hold the
+key the bundle's fixtures are signed with. Build it alone with:
.. code-block:: console
diff --git a/testing/vm/build-bundle.sh b/testing/vm/build-bundle.sh
index 96c1c290..0e3da9b3 100755
--- a/testing/vm/build-bundle.sh
+++ b/testing/vm/build-bundle.sh
@@ -288,6 +288,8 @@ bundle_is_current()
[[ -x "$BUNDLE_DIR/root/usr/local/bin/shirudo" ]] || return 1
[[ -s "$BUNDLE_DIR/runtime-image-key" ]] || return 1
[[ -s "$OPERATOR_KEYS_DIR/keys/signing_key.pem" ]] || return 1
+ cmp -s "$OPERATOR_KEYS_DIR/keys/cert.der" \
+ "$BUNDLE_DIR/fixtures/cert.der" || return 1
[[ "$(<"$BUNDLE_DIR/runtime-image-key")" == "$RUNTIME_KEY" ]] || return 1
[[ -s "$RUNTIME_IMAGE" ]] || return 1
for input in $STAMP_INPUTS; do