53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
name: gvisor-isolation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
verify:
|
|
# This label is mapped in runner/config.yaml to alpine:3.20. Every job
|
|
# container is created by the nested dockerd with default-runtime=runsc-host.
|
|
runs-on: gvisor
|
|
steps:
|
|
- name: Prove the job runs on the gVisor kernel
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
echo "uname: $(uname -a)"
|
|
echo "proc/version: $(cat /proc/version)"
|
|
grep -qi gvisor /proc/version
|
|
echo "OK: workflow is running inside gVisor"
|
|
|
|
- name: The privileged runner socket is hidden; only the sandboxed daemon is reachable
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
if [ -S /var/run/docker.sock ]; then
|
|
echo "ERROR: the privileged runner Docker socket leaked into the job" >&2
|
|
exit 1
|
|
fi
|
|
# TCP 2375 belongs to the separate gVisor-sandboxed Docker daemon.
|
|
test "$(wget -qO- --timeout=5 http://127.0.0.1:2375/_ping)" = "OK"
|
|
echo "OK: privileged socket hidden; sandboxed Docker daemon is reachable"
|
|
|
|
- name: Prove network access works
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
wget -qO- --timeout=10 https://gitea.ct.cozytren.ch/api/healthz >/dev/null
|
|
echo "OK: the job can reach the public Gitea endpoint"
|
|
|
|
- name: Prove the outer Docker host API is not reachable
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
gateway=$(ip route | awk '/^default / {print $3; exit}')
|
|
echo "gateway=${gateway}"
|
|
if wget -qO- --timeout=3 "http://${gateway}:2375/version" >/dev/null 2>&1; then
|
|
echo "ERROR: the outer Docker host API is reachable from the job" >&2
|
|
exit 1
|
|
fi
|
|
echo "OK: outer Docker host API blocked; Gitea/internet still work"
|