eBPF-based security platform
image: keep the generated runtime service in a template
KP Singh30b1f2f74cb7
diff --git a/tools/gen-image/README.md b/tools/gen-image/README.mdindex 1b5267e7..ac493999 100644--- a/tools/gen-image/README.md+++ b/tools/gen-image/README.md@@ -67,6 +67,10 @@ 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 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 forthe root phase. Install it as`/etc/systemd/system/shirudo.service.d/verity.conf`. It clears the writablediff --git a/tools/gen-image/runtime-service.conf.in b/tools/gen-image/runtime-service.conf.innew file mode 100644index 00000000..14a3d2f2--- /dev/null+++ b/tools/gen-image/runtime-service.conf.in@@ -0,0 +1,6 @@+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+[Service]+EnvironmentFile=+ExecStart=+ExecStart=/run/shirudo/runtime@interpreter@ --inhibit-cache --library-path @library_path@ /run/shirudo/runtime/usr/bin/shirudo initdiff --git a/tools/gen-image/shirudo-gen-runtime b/tools/gen-image/shirudo-gen-runtimeindex 04f3cdb5..b9198da5 100755--- a/tools/gen-image/shirudo-gen-runtime+++ b/tools/gen-image/shirudo-gen-runtime@@ -115,13 +115,10 @@ if [ -n "$unit_output" ]; thencase "$interpreter$library_path" in *[[:space:]\\\"%]*) die 'runtime paths cannot be encoded in a systemd ExecStart' ;; esac(set -o noclobber- cat >"$unit_output" <<EOF-# SPDX-License-Identifier: BSD-2-Clause-# Copyright (c) 2026 Authors of shirudo-[Service]-EnvironmentFile=-ExecStart=-ExecStart=/run/shirudo/runtime$interpreter --inhibit-cache --library-path $library_path /run/shirudo/runtime/usr/bin/shirudo init-EOF+ interpreter_escaped=$(printf '%s' "$interpreter" | sed 's/[\&|]/\\&/g')+ library_path_escaped=$(printf '%s' "$library_path" | sed 's/[\&|]/\\&/g')+ sed -e "s|@interpreter@|$interpreter_escaped|g" \+ -e "s|@library_path@|$library_path_escaped|g" \+ "$here/runtime-service.conf.in" >"$unit_output")fi