Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ runner-vm-ci:
trap 'sudo apparmor_parser --remove "$profile"' EXIT
just gh runner-vm

# Install the persistent host profile that lets Nix store unshare map user namespaces.
runner-userns:
#!/usr/bin/env bash
set -euo pipefail
if [[ "${GITHUB_ACTIONS:-}" == true ]]; then
echo "runner-userns is persistent host policy; a hosted runner uses runner-vm-ci" >&2
exit 1
fi
sudo install -m 0644 nix/runner/nix-builder-unshare /etc/apparmor.d/nix-builder-unshare
sudo apparmor_parser --replace /etc/apparmor.d/nix-builder-unshare

# Build and test the persistent NixOS runner VM on x86_64 Linux.
runner-vm:
bash sh/local.sh nix build --no-link .#checks.x86_64-linux.github-runner-vm .#checks.x86_64-linux.github-runner-vm-image .#checks.x86_64-linux.github-runner-vm-config --print-build-logs
Expand Down
7 changes: 7 additions & 0 deletions nix/runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ refuses local and self-hosted runners, and unloads the profile on exit,
including build failure. `just gh runner-vm` does not change host policy;
its build host must already support rootless user namespaces.

Ubuntu denies that map when `kernel.apparmor_restrict_unprivileged_userns` is
set, unless the binary has a profile. `just gh runner-userns` installs
`nix/runner/nix-builder-unshare` into `/etc/apparmor.d/` and loads it. The
profile allows user namespaces only for `/nix/store/*util-linux*/bin/unshare`,
so a nixpkgs bump still matches, and `/usr/bin/unshare` stays denied. AppArmor
stays enabled. Run it again only after the host profile is removed.

`just gh runner-vm` builds a guest image and runs NixOS integration tests for
startup without carrier, public egress for multiple guests, private-network and
sibling-guest isolation including spoofed established replies, compatible host NAT
Expand Down
12 changes: 12 additions & 0 deletions nix/runner/nix-builder-unshare
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Nix image builds run the store copy of util-linux unshare
# (`unshare --map-root-user fakeroot systemd-repart`). Ubuntu denies the
# uid map unless that binary has a userns profile. /usr/bin/unshare stays denied.
abi <abi/4.0>,
include <tunables/global>

profile nix-builder-unshare /nix/store/*util-linux*/bin/unshare flags=(unconfined) {
userns,

# Site-specific additions and overrides. See local/README for details.
include if exists <local/nix-builder-unshare>
}
1 change: 0 additions & 1 deletion quest/m0/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,3 @@ The historical samples locate candidates; they are not controlled benchmarks.
- [A release merge opens no stale release PR](/quest/m0/ci/release-pr-after-release.md) - `just rs release` publishes before it proposes, so a merged release isn't re-proposed
- [Build two queue entries at once if it helps](/quest/m0/ci/queue-concurrency.md) - a measured trial of `maximumEntriesToBuild: 2` against the serial lane's burst latency
- [macOS CI runs kio's tests](/quest/m0/ci/macos-kio.md) - `just rs macos-test` includes kio
- [The desktop host's Nix builders may map user namespaces](/quest/m0/ci/nix-builder-userns.md) - agents' local `just ci` builds the runner image instead of failing `check flake`
39 changes: 0 additions & 39 deletions quest/m0/ci/nix-builder-userns.md

This file was deleted.

Loading