Yup, if your threat model is ‘friends who aren’t actively attacking your infrastructure and will do at least a bit of checking before they hit approve on PRs from other people’ that’s probably fine. I don’t think I’d trust any of those mechanisms for a high-profile project though, given how often privilege-elevation bugs in the Linux kernel are found.
I wouldn’t have thought any of these were easier for management than simply booting a VM with a bunch of preinstalled tools and a CoW base image, and the CI job settings exposed via something like qemufwcfg or a tiny FS on another virtual device.
@whitequark I've been able to do this just now:
podman run --rm -it --security-opt label=disable --user podman quay.io/podman/stable podman run -it --rm --user root registry.fedoraproject.org/fedora-toolbox
that's an image specifically built to use podman inside podman (or docker I guess?) and I'm running it as user and without --privileged and inside of it is a fedora toolbox and inside the fedora toolbox itself I was able to curl codeberg.org
This might be a good place to start from. Not sure what exactly makes the error about tun/tap not happen with this image, however
@c0dec0dec0de @david_chisnall here is how I think this works (ignore my earlier posts, I had some invalid assumptions I've since corrected)
forgejo-action-runner
L podman
L stuff inside job 1...
L malware?
L podman
L stuff inside job 2...
so let's say the malware breaks out of podman. now it runs with fjar permissions. which means that touching job 2's stuff is not a violation of any kind, from the kernel's and systemd's perspective
It's worth noting that most cloud container systems are also isolated VMs. This is partly for software compatibility (the guest can be a shiny new kernel, the host can be a LTS or CIP release), but mostly because cloud providers don't regard anything other than a VM as a defensible boundary.
Azure did a bunch of things with nested virtualisation, but they've now, I believe, upstreamed something to Linux that exposes a device compatible with KVM that lets one VM delegate pages to another and gives the abstraction of nested virtualisation where the 'child' is a child in the 'administration is delegated to the parent' sense and not in the 'recursive nested paging' sense.
I’d have thought a system using VMs would be less effort to implement because you start with a full-featured environment inside and a default-deny policy outside. But I haven’t looked at their code.
We set up a cluster of Morello machines that booted from an NFS image (with the local disk available, encrypted with a random key so the next user didn’t see anything you put on it) and ran the GitHub action runner in single-job-accept mode with the next job in the queue to run. Almost all of the complexity came from:
Most of this complexity goes away if you own the dispatcher and you’re not using weird prototype hardware.
I’m mostly curious why they seem to have done the thing I’d expect to be harder before the thing I’d expect to be easier. My worry is that it’s because designing for security was not part of their objective (if you don’t care about properly restricting rights and having a defensible security boundary, containers are probably slightly easier to implement), which makes me nervous about the rest of their stack.
@ratsnakegames @david_chisnall @ignaloidas I think complex software like this should offer a secure configuration as a default that is sufficient for almost anyone, rather than an extremely difficult to configure correctly environment paired with a bunch of opt-outs
(though now that I think more about it, the host mode is kind of necessary on Windows and macOS that don't have useful container replacements)
Well, that’s horrifying. I really hope that this is scoped to their actions reimplementation and the rest of their system isn’t such an absolute train wreck.