Skip to content

eBPF-based security platform

infra: Optionally include an additional config certificate

Michi Mutsuzakid67eacfb7cda
diff --git a/.github/scripts/build-image-assets.sh b/.github/scripts/build-image-assets.sh
index ff55fab1..95e30208 100755
--- a/.github/scripts/build-image-assets.sh
+++ b/.github/scripts/build-image-assets.sh
@@ -30,6 +30,15 @@ test -x "${SHIRUDO_DIR}/tools/gen-image/shirudo-gen-runtime"
install -d -m 0700 "$config_keys_dir" "$image_dir" "$asset_dir" "$OUTPUT_DIR"
+additional_config_cert_args=()
+if [[ -n "${SHIRUDO_ADDITIONAL_CONFIG_CERT_B64:-}" ]]; then
+ additional_config_cert="${work_dir}/additional-config-cert.der"
+ printf '%s' "$SHIRUDO_ADDITIONAL_CONFIG_CERT_B64" |
+ base64 --decode > "$additional_config_cert"
+ openssl x509 -inform DER -in "$additional_config_cert" -noout >/dev/null
+ additional_config_cert_args+=(--config-cert "$additional_config_cert")
+fi
+
target_deb="$(find "$SHIRUDO_PACKAGE_DIR" -type f -name 'shirudo-target_*_amd64.deb' -print -quit)"
operator_deb="$(find "$SHIRUDO_PACKAGE_DIR" -type f -name 'shirudo-operator_*_amd64.deb' -print -quit)"
if [[ -z "$target_deb" || -z "$operator_deb" ]]; then
@@ -64,6 +73,7 @@ shirudo genkey --keys-dir "$config_keys_dir"
--bootstrap-conf "$runtime_conf" \
--cert "$bpf_cert" \
--config-cert "${config_keys_dir}/cert.der" \
+ "${additional_config_cert_args[@]}" \
--output "$runtime_prefix" \
--keys-dir "$config_keys_dir" \
--builder "$builder" \
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index 2a20e388..2273a934 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -7,6 +7,12 @@ on:
tags:
- '*'
pull_request:
+ workflow_dispatch:
+ inputs:
+ additional_config_cert:
+ description: Base64-encoded DER X.509 config verification certificate; public data only
+ required: false
+ type: string
permissions:
contents: read
@@ -207,6 +213,7 @@ jobs:
SHIRUDO_DIR: ${{ github.workspace }}
SHIRUDO_PACKAGE_DIR: ${{ runner.temp }}/shirudo-packages
OUTPUT_DIR: ${{ runner.temp }}/shirudo-image-assets
+ SHIRUDO_ADDITIONAL_CONFIG_CERT_B64: ${{ github.event.inputs.additional_config_cert }}
run: .github/scripts/build-image-assets.sh
- name: Upload image assets
diff --git a/infra/aws/packer/README.md b/infra/aws/packer/README.md
index fdf0eca0..a7792a4c 100644
--- a/infra/aws/packer/README.md
+++ b/infra/aws/packer/README.md
@@ -23,6 +23,42 @@ The wrapper uses the latest successful kernel package run from
and image-assets runs from `shirudo-dev/shirudo:main`. Start those workflows
before building if you need them to publish new artifacts.
+## Embed an additional config verification certificate
+
+Target image builds can embed an additional config verification certificate.
+This lets a downstream operator sign live config updates with a private key
+that stays outside upstream CI and the AMI.
+
+1. Generate a config signing key once on the downstream operator host and keep
+ its private key secure:
+
+ ```bash
+ shirudo genkey --keys-dir /secure/path/config-signing
+ ```
+
+2. Base64-encode the public DER certificate:
+
+ ```bash
+ base64 -i /secure/path/config-signing/cert.der | tr -d '\n'
+ ```
+
+3. Dispatch the **Build packages** workflow on `main` with the
+ `additional_config_cert` input set to that base64 value. The input is the
+ public certificate; never submit `signing_key.pem`.
+
+4. After the workflow succeeds, build the AMI using that workflow run's ID:
+
+ ```bash
+ ./scripts/build-with-temporary-instance-profile.sh \
+ --shirudo-image-assets-run-id IMAGE_ASSETS_RUN_ID \
+ .
+ ```
+
+The workflow signs the initial config with its temporary key and embeds the
+downstream certificate in the runtime. Keep the matching downstream
+`signing_key.pem` to sign future config images, then activate them with
+`shirudo image update`.
+
## Build
From the Shirudo repository root: