diff --git a/docker/Dockerfile b/docker/Dockerfile index 237735e..5affd81 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,7 +10,12 @@ RUN dotnet publish src/Heimdall.Web/Heimdall.Web.csproj -c Release --no-restore FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble@sha256:de0ee358cdd672f7017a003bed21e9ac9ed48a27c922a59b18175b6e82fa7fee WORKDIR /app -RUN apt-get update -qq && apt-get install -y --no-install-recommends wget tzdata && rm -rf /var/lib/apt/lists/* +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --only-upgrade apt libapt-pkg6.0t64 \ + && apt_version="$(dpkg-query -W -f='${Version}' apt)" \ + && dpkg --compare-versions "$apt_version" ge 2.8.4ubuntu0.1 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget tzdata \ + && rm -rf /var/lib/apt/lists/* ENV ASPNETCORE_URLS=http://+:8080 COPY --from=build /out/ ./ EXPOSE 8080 diff --git a/docker/Dockerfile.agent b/docker/Dockerfile.agent index ca19f13..40179db 100644 --- a/docker/Dockerfile.agent +++ b/docker/Dockerfile.agent @@ -12,7 +12,12 @@ RUN dotnet publish src/Heimdall.Agent/Heimdall.Agent.csproj -c Release --no-rest FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble@sha256:de0ee358cdd672f7017a003bed21e9ac9ed48a27c922a59b18175b6e82fa7fee WORKDIR /app -RUN apt-get update -qq && apt-get install -y --no-install-recommends ffmpeg wget libgomp1 tzdata && rm -rf /var/lib/apt/lists/* +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --only-upgrade apt libapt-pkg6.0t64 \ + && apt_version="$(dpkg-query -W -f='${Version}' apt)" \ + && dpkg --compare-versions "$apt_version" ge 2.8.4ubuntu0.1 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ffmpeg wget libgomp1 tzdata \ + && rm -rf /var/lib/apt/lists/* RUN install -d -m 0700 -o 1654 -g 1654 /var/lib/heimdall ENV ASPNETCORE_URLS=http://127.0.0.1:8080 COPY --from=build /out/ ./ diff --git a/skills/agent-install-assets/SKILL.md b/skills/agent-install-assets/SKILL.md new file mode 100644 index 0000000..ef69f72 --- /dev/null +++ b/skills/agent-install-assets/SKILL.md @@ -0,0 +1,14 @@ +--- +name: heimdall-agent-install-assets +description: Serve and validate native Heimdall Agent installer assets from Central. +--- + +# Native Agent installer assets + +Read `AGENTS.md`, the `AGENT-INSTALL-ASSETS` entry in `todo.md`, and `skills/compose-disposable-recipe/SKILL.md` before changing Central asset delivery. + +`Heimdall.Web.csproj` publishes the Linux/Windows installers and supervisors under `wwwroot/install/`; `Program.ConfigureMiddleware` serves them through ASP.NET Core static files. The default MIME table does not recognize `.py`, so explicitly map `.py` with `FileExtensionContentTypeProvider`; otherwise the supervisor returns 404 even when the file exists in the publish output. + +For acceptance, build Central from the changed source in a disposable Compose project. Require `/healthz` healthy and GET `/install/install-agent.sh` plus `/install/agent-supervisor.py`; both must return HTTP 200 and byte-for-byte match `install/` sources. Use generated credentials, isolated ports/project volumes/network, a unique local image tag, and an EXIT cleanup trap installed before build. Verify no project containers, volumes, or networks remain and remove/verify absence of the exact built tag. Keep shared base images. + +This proves only source-built Central behavior. Verify the deployed Central after its image has been published and restarted before considering a field incident resolved. diff --git a/skills/central-auto-updates/SKILL.md b/skills/central-auto-updates/SKILL.md index 76d49be..a715103 100644 --- a/skills/central-auto-updates/SKILL.md +++ b/skills/central-auto-updates/SKILL.md @@ -25,6 +25,11 @@ Use this skill when changing the Linux or Windows Central installer, its generat - Apply `pull_policy: always` to published Docker images in deployment Compose files so a manual `docker compose up` checks the registry. Leave local development-only images alone and keep the updater itself version-pinned. - The Docker socket mount grants Watchtower broad control of the host. Document this risk and the lack of staged rollout/rollback; do not describe automatic updates as a production-safe rollback system. +## Runtime image package security + +- The server and CPU Agent runtime images inherit Ubuntu 24.04 from the pinned ASP.NET image. When Trivy identifies a fixed Ubuntu package in the shared base, remediate both Dockerfiles and enforce the minimum patched version at build time. The NVIDIA Agent runtime already runs an OS package upgrade during build. +- Run Central + PostgreSQL from source in a disposable Compose project, verify health and native Agent asset URLs, then scan the built Central and CPU Agent images with the same pinned Trivy scanner and HIGH/CRITICAL policy used by CI. Require no findings and perform exact-tag cleanup. See `skills/container-image-security/SKILL.md`. + ## Re-running the installer - A complete existing install can regenerate its Compose after validating the candidate. Keep a timestamped backup of the previous Compose before atomic replacement. diff --git a/skills/container-image-security/SKILL.md b/skills/container-image-security/SKILL.md new file mode 100644 index 0000000..6e87a95 --- /dev/null +++ b/skills/container-image-security/SKILL.md @@ -0,0 +1,14 @@ +--- +name: heimdall-container-image-security +description: Diagnose and repair vulnerabilities in Heimdall Central and Agent container images. +--- + +# Container image security updates + +Read `AGENTS.md`, the image-scan result in `todo.md`, `skills/compose-disposable-recipe/SKILL.md`, and `skills/central-auto-updates/SKILL.md` before changing runtime images or their publication path. + +Heimdall server, CPU Agent, and NVIDIA Agent images use Ubuntu 24.04 runtime layers. When Trivy reports a fixed Ubuntu package, update only the affected package unless the project already establishes a broader OS-upgrade policy. For `CVE-2026-109518`, upgrade `apt` and `libapt-pkg6.0t64` after `apt-get update` and assert the `apt` version is at least `2.8.4ubuntu0.1` before installing runtime tools. Keep Trivy severity and exit thresholds unchanged. Apply the remediation to each affected runtime image; the NVIDIA image already upgrades its base OS packages. + +For acceptance, build Central and CPU Agent from the changed checkout under unique Compose image tags with synthetic credentials, loopback ports, project-scoped volumes/network, and an EXIT cleanup trap. Verify Central health and the native Agent installer and supervisor URLs. Scan each built image with the same pinned Trivy version, vulnerability DB repositories, and HIGH/CRITICAL exit policy used by `scripts/ci/security.sh`. A passing acceptance requires zero HIGH/CRITICAL findings, successful teardown, no project containers/volumes/networks, and removal plus absence checks for every exact local tag. Retain upstream base and scanner images. + +The CI image scan is a merge gate. Do not publish or merge around a failed scan; inspect the report and correct the affected package, then rerun the complete workflow. Keep `todo.md` evidence split between disposable local acceptance and the actual CI publication run. diff --git a/src/Heimdall.Web/Heimdall.Web.csproj b/src/Heimdall.Web/Heimdall.Web.csproj index feb0bc7..b7b0df0 100644 --- a/src/Heimdall.Web/Heimdall.Web.csproj +++ b/src/Heimdall.Web/Heimdall.Web.csproj @@ -15,6 +15,7 @@ +