eBPF-based security platform
testing: add make xtop, which reads the local stack
John Fastabendbd91f9ebb218
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rstindex 85f5d0ca..b7466434 100644--- a/Documentation/contribute/testing/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -702,7 +702,11 @@ the keepalives. The VM then shows in ``shirudo.node_status``, and$ make quote-check$ make stack-up$ make vm- $ CLICKHOUSE_URL=http://127.0.0.1:18124/ tools/xtop/dist/xtop+ $ make xtop++``make xtop`` builds :src:`tools/xtop/` and runs it with+``CLICKHOUSE_URL`` set to the stack's ClickHouse, unless the environment+names another.Every ``make vm`` acts as the builder of :doc:`/operate/run/attest`:before the guest first boots, :src:`testing/vm/tpm-builder.sh` createsdiff --git a/Documentation/operate/backend/xtop.rst b/Documentation/operate/backend/xtop.rstindex 3f4f9923..82d6f93c 100644--- a/Documentation/operate/backend/xtop.rst+++ b/Documentation/operate/backend/xtop.rst@@ -41,7 +41,8 @@ Build and run``bun run src/index.tsx`` in :src:`tools/xtop/` runs it withoutbuilding. Against the local development stack, whose ClickHouse holdsthe backend once ``make quote-check`` has built the checker, the URL is-``http://127.0.0.1:18124/`` (:ref:`local-dev-stack`). A user that can only ``SELECT`` from the ``shirudo`` database+``http://127.0.0.1:18124/``, which ``make xtop`` from the checkout root+sets (:ref:`local-dev-stack`). A user that can only ``SELECT`` from the ``shirudo`` databaseis enough... list-table::diff --git a/Makefile b/Makefileindex db7719d9..222513f4 100644--- a/Makefile+++ b/Makefile@@ -89,7 +89,7 @@ help:'shirudo make targets:' \' Build: make, make target, make target-deps, make bpf-deps, make install' \' Operator tools: make shirudo-build, make quote-check' \- ' Local stack: make stack-up, make oci, make telemetry, make vm, make vm-enroll, make stack-down' \+ ' Local stack: make stack-up, make oci, make telemetry, make vm, make vm-enroll, make xtop, make stack-down' \' Checks: make sparse' \' Source index: make tags (ctags), make cscope' \' Install roles: make install-target, make install-operator' \@@ -196,6 +196,6 @@ distclean: clean$(Q)rm -rf build/quote-check-deps "$(QUOTE_CHECK_OPENSSL_PREFIX)"$(Q)$(MAKE) -f Makefile.shirudo distclean-.PHONY: vm vm-console vm-ssh vm-enroll vm-stop vm-clean oci telemetry stack-up stack-down-vm vm-console vm-ssh vm-enroll vm-stop vm-clean oci telemetry stack-up stack-down:+.PHONY: vm vm-console vm-ssh vm-enroll vm-stop vm-clean oci telemetry stack-up stack-down xtop+vm vm-console vm-ssh vm-enroll vm-stop vm-clean oci telemetry stack-up stack-down xtop:+$(Q)$(MAKE) -C testing $@diff --git a/testing/Makefile b/testing/Makefileindex f1036d88..24a0a983 100644--- a/testing/Makefile+++ b/testing/Makefile@@ -215,6 +215,10 @@ vm-enroll:$(Q)VM_NAME="$(VM_NAME)" \TEST_VM_WORK_DIR="$(TEST_VM_WORK_DIR)" $(ROOT)/testing/vm/run.sh --enroll+xtop:+ +$(Q)$(MAKE) -s -C $(ROOT)/tools/xtop+ $(Q)$(ROOT)/testing/vm/stack.sh xtop+define run-target-vmVM_MODE=$(or $(4),$(if $(filter $(1),$(VM_SERVE_SUITES)),serve,test)) \TEST_VM_SUITE="$(1)" VM_VERBOSE="$(TEST_VM_VERBOSE)" VM_NAME="$(2)" VM_TENANT="$(VM_TENANT)" \@@ -400,7 +404,7 @@ help:' make -C testing vm, vm-console, vm-ssh, vm-enroll, vm-stop, or vm-clean' \' VM_KERNEL=bpf-next (default) selects the shirudo-dev/kernel artifact' \' make -C testing bundle or test-helpers' \- ' make -C testing stack-up, oci, telemetry or stack-down' \+ ' make -C testing stack-up, oci, telemetry, xtop or stack-down' \' make -C testing clean'clean:@@ -413,7 +417,7 @@ clean:"$(abspath $(TEST_VM_HOST_PRIVATE_DIR))/operator-keys" \$(ROOT)/build/test-vm/end2end-.PHONY: oci telemetry stack-up stack-down+.PHONY: oci telemetry stack-up stack-down xtopstack-up: oci telemetryoci telemetry:diff --git a/testing/vm/stack.sh b/testing/vm/stack.shindex 2601dc17..fdfe804d 100755--- a/testing/vm/stack.sh+++ b/testing/vm/stack.sh@@ -22,7 +22,7 @@ fiexec 9>"$W/.lock"flock 9case "$TLS_DIR/" in "$REPO/"*) echo 'stack private keys must be outside the checkout' >&2; exit 1 ;; esac-command=${1:?usage: stack.sh prepare|oci|telemetry|down|enroll|vm}+command=${1:?usage: stack.sh prepare|oci|telemetry|down|enroll|xtop|vm}shiftprepare(){@@ -75,5 +75,12 @@ vm)exec 9>&-exec "$@";;+xtop)+ # Not under the lock: xtop runs until it is quit, while make vm-enroll+ # and the others still have to get it.+ flock -u 9+ exec 9>&-+ CLICKHOUSE_URL=${CLICKHOUSE_URL:-http://$CLICKHOUSE/} exec "$REPO/tools/xtop/dist/xtop"+ ;;*) echo "unknown stack command: $command" >&2; exit 2 ;;esac