eBPF-based security platform
docs: explain the operator image scripts
KP Singh7d3d670b9ad5
diff --git a/AGENTS.md b/AGENTS.mdindex 9756dfd0..341e7434 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -170,8 +170,9 @@ one usually still compiles and passes tests.- **No target subprocesses, no daemons.** Target operations in the core`shirudo` binary use linked libraries and kernel APIs. Operator commandsdispatch to the separate `shirudo-build` helper. That helper signs- in-process, executes `clang` for BPF compilation and executes the standard- `veritysetup` tool for image formatting and offline verification. Those+ in-process, executes `clang` for BPF compilation and delegates image+ generation to Bash scripts using standard `veritysetup`. Offline verification+ authenticates the root in the helper before invoking `veritysetup verify`. Thoseexternal tools are operator-only dependencies. Target image preflightchecks the standard verity superblock and root. The kernel verifies configsignatures through its dm-verity trust path; runtime acceptance requiresdiff --git a/Documentation/config-images.rst b/Documentation/config-images.rstindex fb50b1d6..75c4922b 100644--- a/Documentation/config-images.rst+++ b/Documentation/config-images.rst@@ -122,7 +122,8 @@ separate object and payload protections.3) Build and verify images---------------------------Run image generation on the operator. It requires ``mkfs.ext4`` from+Run image generation on the operator. The Bash scripts require GNU coreutils,+``mkfs.ext4`` from``e2fsprogs``, the standard ``veritysetup`` executable (``cryptsetup-bin``on Debian/Ubuntu, ``cryptsetup`` on Fedora/RHEL) and the operator-onlybuild helper::@@ -154,12 +155,17 @@ Generate the runtime image with its library closure and public assets::Use a trusted native input binary: the operator's library inspection runsits ELF interpreter. Never put private keys in either image.-The helper runs standard ``veritysetup format`` with format version 1,+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 standardsuperblock starts at offset zero and the hash tree starts at block one.-It signs the root's exact ASCII representation. ``--kind config|runtime``+The C helper signs the root's exact ASCII representation. ``--kind config|runtime``is a packaging hint, not a signed format field or an authority decision.Shirudo has no custom hash-tree builder.+The scripts share argument and output checks in ``common.sh`` and keep the+systemd service template in a separate file. ``make install-operator`` installs+them under ``libexec/shirudo/gen-image/``. Generation happens in a temporary+directory beside the requested output. The builder verifies the image before+publishing any files and refuses to replace existing output files.Verify a staged bundle offline on the operator without activating it::diff --git a/Documentation/requirements.rst b/Documentation/requirements.rstindex 476ba3b3..9c3598e9 100644--- a/Documentation/requirements.rst+++ b/Documentation/requirements.rst@@ -318,6 +318,7 @@ since the libguestfs appliance resolves names through DNS alone.committed), so neither a submodule nor bpftool is needed. ``makebpf-deps`` refreshes the vendored copy from a kernel tree ondemand.+* Bash and GNU coreutils for operator image generation.* ``veritysetup`` for image formatting and offline verification, providedby ``cryptsetup-bin`` on Debian/Ubuntu or ``cryptsetup`` on Fedora/RHEL.Directory-to-image generators additionally require ``mkfs.ext4`` fromdiff --git a/tools/gen-image/README.md b/tools/gen-image/README.mdindex ac493999..29a86d52 100644--- a/tools/gen-image/README.md+++ b/tools/gen-image/README.md@@ -1,14 +1,25 @@# Building Shirudo images-`shirudo-gen-image` runs on the operator. It uses `mkfs.ext4` from-`e2fsprogs`, then calls the operator-only `shirudo-build` helper to construct-and sign the dm-verity tree. The helper invokes `veritysetup format` from-`cryptsetup-bin` (Debian/Ubuntu) or `cryptsetup` (Fedora/RHEL), and the-generator verifies the result with `veritysetup verify`. Targets use kernel-APIs and do not need these programs. Offline `shirudo image verify` also-requires the operator helper and `veritysetup`; it checks the signed-root signature and exact file sizes before verifying the retained data and-hash files.+The operator scripts use Bash and standard Linux tools:++* `shirudo-gen-image` builds an ext4 filesystem from a source directory.+* `shirudo-gen-runtime` collects the trusted binary, libraries and public assets,+ then calls `shirudo-gen-image`.+* `shirudo-gen-verity` copies a prepared filesystem image, runs `veritysetup+ format`, asks `shirudo-build` to sign the root, and verifies the result before+ publishing the four output files. `shirudo image build` uses this script too.+* `common.sh` holds shared argument and output checks.++Install `mkfs.ext4` from `e2fsprogs` and `veritysetup` from `cryptsetup-bin`+(Debian/Ubuntu) or `cryptsetup` (Fedora/RHEL). The scripts use GNU coreutils.+`make install-operator` installs the scripts beside the operator helper under+`libexec/shirudo/gen-image/`.++Signing stays in the operator-only C helper and reuses Shirudo's ML-DSA-87 CMS+implementation. Offline `shirudo image verify` checks the signed root and exact+file sizes, then runs `veritysetup verify` on the retained data and hash files.+Target operations keep the C metadata reader and use kernel APIs. They need+none of these external tools.The source directory becomes the image root. A config source contains`etc/shirudo/` and additional `keys/trusted/` and `keys/revoked/` directories;@@ -68,7 +79,7 @@ BPF 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 with the scripts when copying this directory.+the scripts. Keep that template and `common.sh` with the scripts when copying this directory.The generator substitutes only the interpreter and library paths.Pass `--unit-output runtime-service.conf` to generate a systemd drop-in for