eBPF-based security platform
docs: describe static runtime startup
KP Singh5416694533df
diff --git a/Documentation/config-images.rst b/Documentation/config-images.rstindex f134d319..47596501 100644--- a/Documentation/config-images.rst+++ b/Documentation/config-images.rst@@ -29,8 +29,8 @@ The target uses these mounts and directories::/run/shirudo/bpffs protected BPF objects/var/lib/shirudo protected writable state-The runtime image contains the target binary, its ELF interpreter and-libraries, bootstrap ``shirudo.conf``, initial BPF trust anchors and the+The runtime image contains the fully static target binary, bootstrap+``shirudo.conf``, initial BPF trust anchors and theconfig verification certificate. Every executable on this image has thesame eligibility for Shirudo authority. Do not include shells, debuggersor general-purpose interpreters unless that authority is intended.@@ -45,11 +45,10 @@ certificate, initial BPF trust anchors, executable authority or TPMsettings. Rotating the config verification certificate requires a newruntime image and UKI followed by reboot.-The generator packages the ELF interpreter and complete library closure.-The runtime invocation names that interpreter explicitly, disables its-host cache and supplies library paths inside the runtime image. Executable-mappings from elsewhere are denied. A missing runtime library fails the-operation instead of falling back to a host library.+The static target runs directly from the runtime image. It needs no ELF+interpreter or shared libraries at startup. Additional dynamic executables+supplied by the operator bring their interpreter and libraries into the+image. Executable mappings from outside the image are denied.The authenticated bootstrap configuration selects the initial cached configprefix, the verification certificate and a reserved static TPM PCR. For@@ -145,7 +144,7 @@ operator can also sign an already prepared 4096-byte-aligned ext4 image::shirudo image build filesystem.img -o config --keys-dir operator-keys-Generate the runtime image with its library closure and public assets::+Generate the runtime image with its static executable and public assets::tools/gen-image/shirudo-gen-runtime --binary ./shirudo-target \--bootstrap-conf bootstrap.conf --cert initial-bpf-cert.der \@@ -153,8 +152,8 @@ Generate the runtime image with its library closure and public assets::--keys-dir operator-keys \--builder tools/shirudo-build/shirudo-build-Use a trusted native input binary: the operator's library inspection runs-its ELF interpreter. Never put private keys in either image.+Use trusted native input binaries. Dynamic executable inspection runs+their ELF interpreter on the operator. Never put private keys in either image.The Bash builder runs standard ``veritysetup format`` with format version 1,SHA-256, 4096-byte data and hash blocks and a 32-byte salt. The standard@@ -205,12 +204,12 @@ of config-root verification. The initrd also enrolls and seals the BPFkeyring, attaches the guards, mountsthe runtime under guard protection and completes measured config activation.The runtime bootstrap settings select the config verification key and PCR.-After switch-root, services and CLI commands execute the runtime binary-through its packaged interpreter and library paths. The generator prints+After switch-root, services and CLI commands execute the static binary at+``/run/shirudo/runtime/usr/bin/shirudo`` directly. The generator printsthat invocation and can write a service override with ``--unit-output``.The ``shirudo`` commands below denote that configured runtime invocation;substitute the command and arguments for its final ``init`` when invoking-the generated loader command directly.+the generated command directly.Image mode needs writable ``/var/lib/shirudo`` available during the initrdrun: the image cache and pending activation record must be durable before a@@ -506,9 +505,9 @@ public fixture set and cache every config bundle under``contrib/verity-vm-config-fixtures.sh --keys-dir <operator-keys>--output <new-directory>`` builds the signed config and revocation fixtures;only its ``public/`` directory belongs on the target. The standard host-bundle also packages the runtime, library closure and test helper. The-``image-shirudo`` test wrapper executes the image interpreter explicitly,-with the host loader cache disabled. Production services use the invocation+bundle also packages the runtime and static test helpers. The+``image-shirudo`` test wrapper executes the runtime binary directly.+Production services use the invocationemitted by ``shirudo-gen-runtime``.For built-in kernel trust coverage, the operator may supplydiff --git a/Documentation/initrd.rst b/Documentation/initrd.rstindex 262912aa..826aaea5 100644--- a/Documentation/initrd.rst+++ b/Documentation/initrd.rst@@ -18,7 +18,7 @@ commands, `architecture <architecture.rst>`__ for the LSM flow and* An authenticated UKI containing the bootstrap binary and configuration.``runtime.image`` names the cached runtime bundle and ``runtime.root_hash``gives its exact expected SHA-256 root. Missing image settings are an error.-* The runtime image contains Shirudo, its ELF interpreter and libraries,+* The runtime image contains the fully static Shirudo executable,initial BPF certificate, config-verification certificate and bootstrap TPMsettings. The initial config bundle is signed by an accepted config key.* Boot parameters ``bpf.keyring_unsealed=1 dm_verity.keyring_unsealed=1``.@@ -66,9 +66,8 @@ waits in ``/run/shirudo/eventlog.pending`` for the root service to adopt.Generate a systemd drop-in with ``shirudo-gen-runtime --unit-output`` andinstall it at ``/etc/systemd/system/shirudo.service.d/verity.conf``. It invokes-the runtime's ELF interpreter with its host cache disabled and library paths-inside the image, then starts the runtime binary. The loader and executable-both come from the verified runtime, not from the host root filesystem.+the fully static binary at ``/run/shirudo/runtime/usr/bin/shirudo`` directly.+The executable comes from the verified runtime image.The service re-runs ``init``, checks the existing guards and measurements,and adopts the initrd eventlog record without another extension. Successfuldiff --git a/tools/gen-image/README.md b/tools/gen-image/README.mdindex bf434223..a5e3bea6 100644--- a/tools/gen-image/README.md+++ b/tools/gen-image/README.md@@ -57,13 +57,12 @@ updates and attestation while the node keeps running. The operator chooseswhen to reboot; Shirudo never reboots automatically and has no same-bootrecovery command.-For a target binary linked against glibc, `shirudo-gen-runtime` packages the-ELF interpreter and its complete library closure without modifying the-binary. Use a trusted, native target binary on the operator. It prints the-explicit loader invocation to use after mounting the runtime image. The-invocation disables the host loader cache and supplies only library paths-inside the image. The LSM also denies executable mappings from outside the-approved image, so missing libraries fail instead of falling back to the host.+`shirudo-gen-runtime` packages the fully static target from `make target`.+The generated service runs `/run/shirudo/runtime/usr/bin/shirudo` directly,+without an ELF interpreter or shared libraries. For dynamic executables+supplied by the operator, the generator also packages their interpreter and+libraries. Use trusted native inputs: dynamic library inspection runs their+loader on the operator. Executable mappings outside the image are denied.```shtools/gen-image/shirudo-gen-runtime --binary ./shirudo-target \@@ -78,14 +77,14 @@ for `config.verification_key` in the bootstrap configuration. The initialBPF certificate is `keys/cert.der` inside the image. Runtime images have noshell or debugger unless the operator explicitly supplies one.-The generated service content is kept in `runtime-service.conf.in` beside-the scripts. Keep that template and `common.sh` with the scripts when copying this directory.-The generator substitutes only the interpreter and library paths.+The generated service content is kept in `runtime-service-static.conf.in`+and `runtime-service.conf.in` beside the scripts. Keep both templates and+`common.sh` with the scripts when copying this directory.Pass `--unit-output runtime-service.conf` to generate a systemd drop-in forthe root phase. Install it as`/etc/systemd/system/shirudo.service.d/verity.conf`. It clears the writable-`init.env` file and starts the loader and Shirudo binary from the runtime+`init.env` file and starts the Shirudo binary from the runtimeimage. Generate the initrd with `shirudo-gen-initrd --bootstrap-conf <file>`;this bootstrap file carries `runtime.image` and `runtime.root_hash`, whilethe file inside the runtime image carries config verification settings.diff --git a/tools/gen-image/shirudo-gen-runtime b/tools/gen-image/shirudo-gen-runtimeindex 09300a20..da77f63a 100755--- a/tools/gen-image/shirudo-gen-runtime+++ b/tools/gen-image/shirudo-gen-runtime@@ -15,9 +15,9 @@ usage: shirudo-gen-runtime --binary <shirudo-target> --bootstrap-conf <file>[--size <MiB>] [--builder <shirudo-build>] [--unit-output <file>][--extra-binary <trusted-ELF>]-Package the trusted executable, its complete dynamic-library closure,-authenticated bootstrap settings and public certificates into a runtime image.-The input binary must be trusted: ldd invokes its dynamic loader on the operator.+Package the trusted executable, bootstrap settings and public certificates.+Static targets run directly. Dynamic executables bring their loader and libraries.+Use trusted inputs: ldd invokes dynamic loaders on the operator.EOF}