Skip to content

internal: new microvm observability hook package#78532

Open
antitree wants to merge 7 commits intowolfi-dev:mainfrom
antitree:add-microvm-observability-hook
Open

internal: new microvm observability hook package#78532
antitree wants to merge 7 commits intowolfi-dev:mainfrom
antitree:add-microvm-observability-hook

Conversation

@antitree
Copy link
Contributor

This adds an additional observability package to the Melange QEMU runner allowing additional telemetry if desired. It is mostly an internal improvement to help support Melange and not a package that others would normally consume directly. It specifically is designed around the custom way that the Melange QEMU runner's linux init process works today so that it can collect observability information with a background process and send it to STDOUT. It's not expected to work for any other environments.

For new package PRs only

  • REQUIRED - The package is available under an OSI-approved or FSF-approved license
  • REQUIRED - The version of the package is still receiving security updates
  • This PR links to the upstream project's support policy (e.g. endoflife.date)

antitree and others added 5 commits December 5, 2025 18:23
This test configuration validates tetragon integration in melange QEMU
builds and is used to verify that tetragon event streaming works
correctly.

The test-tetragon.yaml file:
- Builds a minimal package to test tetragon
- Requires TETRAGON_TEST=1 environment variable
- Requires QEMU_KERNEL_IMAGE to point to kernel with BTF support
- Tests that tetragon daemon starts successfully
- Verifies that events are captured and streamed to logs

Usage:
  export TETRAGON_TEST=1
  export QEMU_KERNEL_IMAGE=$(pwd)/kernel/x86_64/vmlinuz
  melange build test-tetragon.yaml --arch x86_64 --runner qemu \
    --signing-key local-melange.rsa \
    --keyring-append local-melange.rsa.pub \
    --repository-append https://packages.wolfi.dev/os \
    --keyring-append https://packages.wolfi.dev/os/wolfi-signing.rsa.pub \
    --cache-dir ./melange-cache/

Expected output:
- Log lines with [TETRAGON] prefix showing captured events
- Events appear in real-time during build
- Tetragon daemon runs successfully in VM
Changes:
- Add tetragon to runtime dependencies in microvm-init.yaml
- Mount eBPF filesystems (debugfs, tracefs, bpf) in both host and chroot environments
- Start tetragon daemon with event streaming to console
- Add V6 implementation documentation

Technical details:
- eBPF mounts at /sys/kernel/debug, /sys/kernel/tracing, /sys/fs/bpf (host)
- eBPF mounts at /mount/sys/kernel/debug, /mount/sys/kernel/tracing, /mount/sys/fs/bpf (chroot)
- Tetragon events exported to /tmp/tetragon/events.log and streamed to console
- All process execution events visible during package builds

Generated with Claude Code
This version successfully generates TETRAGON process_exec and process_exit events
during package builds. Verified with hello-wolfi build showing 14 events.

Key working configuration:
- Tetragon starts WITHOUT --tracing-policy flag
- Default process event collection enabled
- While loop streaming method works correctly
- Events stream to console throughout build phase

Test results: /tmp/phase3-test.log (14 TETRAGON events captured)

Note: Custom egress policy (tcp_connect kprobe) currently breaks event
generation. This version uses default tetragon behavior only.

🤖 Generated with Claude Code
This package provides an init.d hook for microvm-init that starts
eBPF-based observability during VM boot. Events are streamed to
console with [OBSERVABILITY] prefix.

The hook mounts required eBPF filesystems (debugfs, tracefs, bpf)
and starts the observability framework with JSON event export.

Package includes:
- Runtime dependency on tetragon
- Init script: /opt/melange/init.d/50-observability.sh
- Event streaming to /tmp/observability/events.log
- Console output prefixed with [OBSERVABILITY]

Use case: Enables security observability in isolated QEMU build
environments for audit, forensics, and supply chain security.

Signed-off-by: Mark Manning <mark.manning@chainguard.dev>
Signed-off-by: antitree <antitree@users.noreply.github.com>
@antitree antitree requested a review from 89luca89 January 20, 2026 16:06
Signed-off-by: antitree <antitree@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments