Skip to content

eBPF-based security platform

testing: let a local-stack guest reach the registry at the host's address

John Fastabendcd283920c451
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 8c928ff7..353ae711 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -831,7 +831,10 @@ stack started before the checker was built keeps its collector: run
After initialization, it activates the signed ``config-local-stack``
image. That image points telemetry at ``https://10.0.2.2:14319`` and the
BPM tree at ``oci://10.0.2.2:15444/shirudo/local-tree``, reference
-``stable``. The existing timers retry exports and tree sync when services
+``stable``. The guest also forwards its own ``127.0.0.1:15444`` to
+``10.0.2.2:15444``, with ``systemd-socket-proxyd``: the host publishes at
+``127.0.0.1:15444``, a tree operation names its package by the address
+it was appended through, and the registry's certificate covers both. The existing timers retry exports and tree sync when services
are unavailable; starting the containers later needs no VM reboot.
The registry starts empty. Publish a signed tree at that reference using
the VM bundle's operator key under ``TEST_VM_HOST_PRIVATE_DIR`` to load
diff --git a/testing/vm/guest.sh b/testing/vm/guest.sh
index cb9da018..b51fcec2 100755
--- a/testing/vm/guest.sh
+++ b/testing/vm/guest.sh
@@ -271,6 +271,26 @@ configure_image_identity()
# Target tests run from this script in test mode and from an SSH session
# otherwise, which inherits nothing from it.
+# The host publishes to the stack's registry at 127.0.0.1:15444, and a
+# tree operation names its package by that address, which in the guest is
+# the guest: forward it to the host, whose certificate covers both.
+forward_stack_registry()
+{
+ cat >/etc/systemd/system/shirudo-stack-registry.socket <<-'EOF'
+ [Socket]
+ ListenStream=127.0.0.1:15444
+
+ [Install]
+ WantedBy=sockets.target
+ EOF
+ cat >/etc/systemd/system/shirudo-stack-registry.service <<-'EOF'
+ [Service]
+ ExecStart=/usr/lib/systemd/systemd-socket-proxyd 10.0.2.2:15444
+ EOF
+ systemctl daemon-reload
+ systemctl enable --now shirudo-stack-registry.socket
+}
+
write_target_test_env()
{
{
@@ -524,6 +544,7 @@ if [[ "${TEST_VM_LOCAL_STACK:-0}" == 1 ]]; then
install -d /etc/shirudo/bpm
printf '%s\n' 'BPM_OCI_CA_FILE=/usr/local/share/ca-certificates/shirudo-oci-ca.crt' \
>/etc/shirudo/bpm/environment
+ forward_stack_registry
fi
if [[ -n "${TEST_VM_BPM_TREE_INPUT:-}" ]]; then