Skip to content

eBPF-based security platform

testing: group root tamper resistance tests

John Fastabend6d43e7e54eb5
diff --git a/testing/run-target-tests.sh b/testing/run-target-tests.sh
index abab6917..b404bc43 100755
--- a/testing/run-target-tests.sh
+++ b/testing/run-target-tests.sh
@@ -9,7 +9,8 @@ set -eu
cd "$(dirname "$0")"
-# t1106 deliberately destroys the keyring trust anchor and must run last.
+# The keyring substitution test deliberately destroys the trust anchor.
+# It runs last.
fail=0
: "${SHIRUDO_TEST_SUITE_FAILURES_FILE:=}"
for t in \
@@ -17,28 +18,28 @@ for t in \
t1118-bpm-tree.sh \
t1119-bpm-tree-sequential.sh \
t1120-bpm-tree-delete.sh \
- t1101-seal.sh \
t1102-eventlog-full.sh \
t1103-version-gate.sh \
t1104-payload-mismatch.sh \
- t1105-siggate.sh \
t1107-load-unload.sh \
t1108-tpm-chain.sh \
- t1110-lsm-deny.sh \
t1111-upatch-get.sh \
- t1112-prog-load-keyring-gate.sh \
- t1113-mount-lockdown.sh \
t1114-uprobe-multi.sh \
t1115-map-export-all.sh \
t1116-otel-backend.sh \
t1117-otel-serialized-metric.sh \
- t1121-bpf-keyring.sh \
t1122-initrd.sh \
t1123-keys.sh \
t1124-keys-add.sh \
- t1125-key-permission.sh \
t1126-keys-revoke.sh \
- t1106-keyring-swap.sh
+ tamperproof/t1101-seal.sh \
+ tamperproof/t1105-siggate.sh \
+ tamperproof/t1110-lsm-deny.sh \
+ tamperproof/t1112-prog-load-keyring-gate.sh \
+ tamperproof/t1113-mount-lockdown.sh \
+ tamperproof/t1121-bpf-keyring.sh \
+ tamperproof/t1125-key-permission.sh \
+ tamperproof/t1106-keyring-swap.sh
do
if sh "$t"; then
:
diff --git a/testing/t0015-test-vm-cli.sh b/testing/t0015-test-vm-cli.sh
index e2591b1a..ef09ddc5 100755
--- a/testing/t0015-test-vm-cli.sh
+++ b/testing/t0015-test-vm-cli.sh
@@ -550,14 +550,32 @@ test_expect_success 'operator and target runners have disjoint explicit scopes'
grep -q "for t in t0\[0-9\]\[0-9\]\[0-9\]-\*.sh" ../testing/run-tests.sh &&
! grep -q "t1101" ../testing/run-tests.sh &&
for test_name in \
- t1101-seal.sh t1102-eventlog-full.sh t1103-version-gate.sh \
- t1104-payload-mismatch.sh t1105-siggate.sh t1106-keyring-swap.sh \
- t1107-load-unload.sh t1108-tpm-chain.sh \
- t1110-lsm-deny.sh t1111-upatch-get.sh \
- t1112-prog-load-keyring-gate.sh t1113-mount-lockdown.sh \
- t1114-uprobe-multi.sh t1115-map-export-all.sh \
- t1116-otel-backend.sh t1117-otel-serialized-metric.sh \
- t1200-target-fixtures.sh
+ t1200-target-fixtures.sh \
+ t1118-bpm-tree.sh \
+ t1119-bpm-tree-sequential.sh \
+ t1120-bpm-tree-delete.sh \
+ t1102-eventlog-full.sh \
+ t1103-version-gate.sh \
+ t1104-payload-mismatch.sh \
+ t1107-load-unload.sh \
+ t1108-tpm-chain.sh \
+ t1111-upatch-get.sh \
+ t1114-uprobe-multi.sh \
+ t1115-map-export-all.sh \
+ t1116-otel-backend.sh \
+ t1117-otel-serialized-metric.sh \
+ t1122-initrd.sh \
+ t1123-keys.sh \
+ t1124-keys-add.sh \
+ t1126-keys-revoke.sh \
+ tamperproof/t1101-seal.sh \
+ tamperproof/t1105-siggate.sh \
+ tamperproof/t1110-lsm-deny.sh \
+ tamperproof/t1112-prog-load-keyring-gate.sh \
+ tamperproof/t1113-mount-lockdown.sh \
+ tamperproof/t1121-bpf-keyring.sh \
+ tamperproof/t1125-key-permission.sh \
+ tamperproof/t1106-keyring-swap.sh
do
grep -q "$test_name" ../testing/run-target-tests.sh || return 1
done &&
diff --git a/testing/t1101-seal.sh b/testing/tamperproof/t1101-seal.sh
similarity index 97%
rename from testing/t1101-seal.sh
rename to testing/tamperproof/t1101-seal.sh
index 029ffccc..cf972953 100644
--- a/testing/t1101-seal.sh
+++ b/testing/tamperproof/t1101-seal.sh
@@ -6,7 +6,7 @@
# cannot modify a labelled file under /var/lib/shirudo, even as root.
# Non-destructive: the seal denies the tamper, so the file survives.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1105-siggate.sh b/testing/tamperproof/t1105-siggate.sh
similarity index 97%
rename from testing/t1105-siggate.sh
rename to testing/tamperproof/t1105-siggate.sh
index 58f62319..6a38fff5 100644
--- a/testing/t1105-siggate.sh
+++ b/testing/tamperproof/t1105-siggate.sh
@@ -8,7 +8,7 @@
# which would clobber the operator key), builds a foreign-signed upatch,
# and confirms the load fails. Non-destructive (the load is refused).
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1106-keyring-swap.sh b/testing/tamperproof/t1106-keyring-swap.sh
similarity index 99%
rename from testing/t1106-keyring-swap.sh
rename to testing/tamperproof/t1106-keyring-swap.sh
index 54e22b40..64fcae5e 100644
--- a/testing/t1106-keyring-swap.sh
+++ b/testing/tamperproof/t1106-keyring-swap.sh
@@ -17,7 +17,7 @@
# trust anchor has been destroyed -- so this test should be run on a host
# that will be rebooted, or last.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1110-lsm-deny.sh b/testing/tamperproof/t1110-lsm-deny.sh
similarity index 96%
rename from testing/t1110-lsm-deny.sh
rename to testing/tamperproof/t1110-lsm-deny.sh
index f05fa2c6..1ac44eee 100644
--- a/testing/t1110-lsm-deny.sh
+++ b/testing/tamperproof/t1110-lsm-deny.sh
@@ -8,7 +8,7 @@
# reports the errno; the LSM rejects it with EACCES. Non-mutating: the
# load never succeeds, so nothing enters the kernel.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1112-prog-load-keyring-gate.sh b/testing/tamperproof/t1112-prog-load-keyring-gate.sh
similarity index 98%
rename from testing/t1112-prog-load-keyring-gate.sh
rename to testing/tamperproof/t1112-prog-load-keyring-gate.sh
index 761d9358..001e5687 100644
--- a/testing/t1112-prog-load-keyring-gate.sh
+++ b/testing/tamperproof/t1112-prog-load-keyring-gate.sh
@@ -16,7 +16,7 @@
# process's own session keyring, and never touches shirudo's keyring or
# any pinned state.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1113-mount-lockdown.sh b/testing/tamperproof/t1113-mount-lockdown.sh
similarity index 98%
rename from testing/t1113-mount-lockdown.sh
rename to testing/tamperproof/t1113-mount-lockdown.sh
index 6502f934..8ded47fd 100755
--- a/testing/t1113-mount-lockdown.sh
+++ b/testing/tamperproof/t1113-mount-lockdown.sh
@@ -15,7 +15,7 @@
# unmounted, the trap re-inits to restore the host rather than leave it
# unprotected.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1121-bpf-keyring.sh b/testing/tamperproof/t1121-bpf-keyring.sh
similarity index 99%
rename from testing/t1121-bpf-keyring.sh
rename to testing/tamperproof/t1121-bpf-keyring.sh
index 1ece3c4f..80f0e8f2 100644
--- a/testing/t1121-bpf-keyring.sh
+++ b/testing/tamperproof/t1121-bpf-keyring.sh
@@ -7,7 +7,7 @@
# re-run of init leaves it alone, and nothing can be linked into it any
# more.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard
diff --git a/testing/t1125-key-permission.sh b/testing/tamperproof/t1125-key-permission.sh
similarity index 99%
rename from testing/t1125-key-permission.sh
rename to testing/tamperproof/t1125-key-permission.sh
index 4dfc2c77..6e95acab 100755
--- a/testing/t1125-key-permission.sh
+++ b/testing/tamperproof/t1125-key-permission.sh
@@ -8,7 +8,7 @@
# the certificate keys it holds, while viewing and listing them and
# loading against them keep working.
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/.."
. ./integration-lib.sh
target_guard