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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,33 @@ jobs:
export DBUS_SESSION_BUS_ADDRESS="unix:path=$runtime_dir/bus"
TINYBOX_REQUIRE_NATIVE_RESOURCE_TESTS=1 cargo test -j1 -p tinybox-module native_
TINYBOX_REQUIRE_NATIVE_RESOURCE_TESTS=1 cargo test -j1 -p tinybox-module resource_aware_bus_exec_cancellation_reports_events_and_reaps_descendants
# The real-bubblewrap suites. They skip when bwrap cannot run (Ubuntu 24.04
# blocks unprivileged user namespaces by default), so this job makes bwrap
# usable and requires it: a skip here is a failure, not a pass.
bwrap-live:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249
- name: Make unprivileged bubblewrap usable
run: |
source scripts/ci/prepare-bwrap.sh
# The image ships passt (a podman Recommends). Without it this job keeps
# the default shared-network path covered; the pasta job covers the other.
- name: Remove pasta so the shared-network path is the one tested
run: |
if dpkg -s passt >/dev/null 2>&1; then sudo apt-get remove --yes passt; fi
if command -v pasta >/dev/null 2>&1; then echo "pasta still present" >&2; exit 1; fi
- name: Run the real-bubblewrap suites, refusing to skip
shell: bash
env:
TINYBOX_REQUIRE_BWRAP: "1"
run: |
set -euo pipefail
cargo test --locked -p tinybox-jail --test bwrap_isolation --test bwrap_fd_leak -- --nocapture
cargo test --locked -p tinybox-jail --lib bwrap
docker-network-live:
name: Docker Egress and denied network connectivity
runs-on: ubuntu-22.04
Expand Down
14 changes: 14 additions & 0 deletions scripts/ci/prepare-bwrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Make unprivileged bubblewrap usable on a GitHub Linux runner: install it and
# lift Ubuntu 24.04's AppArmor restriction on unprivileged user namespaces,
# which otherwise makes every bwrap jail fail (and its tests skip).
set -euo pipefail

if ! command -v bwrap >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install --yes bubblewrap
fi
if sysctl -n kernel.apparmor_restrict_unprivileged_userns >/dev/null 2>&1; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
bwrap --version
4 changes: 1 addition & 3 deletions scripts/ci/prepare-rootless-native-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ sudo systemctl start "user@${uid}.service"
runtime_dir="/run/user/${uid}"
export XDG_RUNTIME_DIR="$runtime_dir"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$runtime_dir/bus"
if sysctl -n kernel.apparmor_restrict_unprivileged_userns >/dev/null 2>&1; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
source "$(dirname "${BASH_SOURCE[0]}")/prepare-bwrap.sh"

systemctl --user show-environment >/dev/null
systemd-run --user --scope --quiet --property=CPUQuota=10% -- /bin/true
Loading