-
For some context, I'm trying to use Podman as an alternative to lxc/lxd/Incus in Debian's automated testing framework, to test proposed OS-level packages (including daemons, etc.), without the performance overhead and portability issues of qemu/kvm or the "containers don't contain" issues of a rootful container. To be able to run automated tests against system services, we want the container to be running a full Debian system from init upwards, so that if the package under test has a missing/broken systemd unit, we can reproduce and report that bug. By default, rootless podman runs the container payload (systemd and our packages under test) without CAP_SYS_ADMIN, which is ideal for security hardening of the boundary between the user and their container, but prevents some systemd unit options (hardening the boundary between systemd and individual system services) from working as intended. Depending on the option, either systemd ignores the option with a warning (which is very convenient, but makes our test container a less realistic example of a "normal" Debian system), or it refuses to start the service (systemd/systemd#29860, it's not currently clear to me whether this is considered to be a bug or whether it's working-as-intended). As documented, we can get access to CAP_SYS_ADMIN in the container by adding I am aware that Podman has several overlapping mechanisms intended to prevent the code inside a container from compromising confidentiality/integrity/availability on the host system, including dropping capabilities, entering a user namespace, entering a pid namespace, applying seccomp filters, and so on. My question is: if we run a rootless podman container with
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Tough to say. CAP_SYS_ADMIN is the most powerful Linux Capability, although far less capable in a Rootless Container. You do get the power over the usernamespace and most powerfully over the mount namespace. We mount lots of file systems to block access to the host, which can be unmounted with CAP_SYS_ADMIN. So there is a chance of exposure for kernel file system attacks. You might be able to break out and do not have SELinux controls, on Debian. Not sure if AppArmor can be modified with CAP_SYS_ADMIN, but probably. Bottom line it would still be difficult for malicious code to attack the users processes, but less so with CAP_SYS_ADMIN. If you trust the code you are testing, I think this is a reasonable tradeoff. |
Beta Was this translation helpful? Give feedback.
-
By the way, I'm looking at possible options to add autopkgtests for passt, which would surely need to include tests with Podman... which might run on top of Podman itself if this is implemented, so it's quite interesting. :)
One consideration I would like to add is that stuff like CVE-2022-0492 is definitely more likely to happen. I wonder how much it matters, though. You have Debian Developers and Debian Maintainers developing and triggering tests. If they had malicious intents, they could readily find ways to at least compromise the availability of the test runners, I suppose. If there's no malicious intent, though, it's difficult to have container escapes happening by accident. All the related weaknesses and vulnerabilities I've seen in the past years are generally based on doing something rather particular with CAP_SYS_ADMIN. If you can trust the user to a given extent, I think that you're unlikely to compromise stability. |
Beta Was this translation helpful? Give feedback.
Tough to say. CAP_SYS_ADMIN is the most powerful Linux Capability, although far less capable in a Rootless Container. You do get the power over the usernamespace and most powerfully over the mount namespace.
We mount lots of file systems to block access to the host, which can be unmounted with CAP_SYS_ADMIN. So there is a chance of exposure for kernel file system attacks. You might be able to break out and do not have SELinux controls, on Debian. Not sure if AppArmor can be modified with CAP_SYS_ADMIN, but probably.
Bottom line it would still be difficult for malicious code to attack the users processes, but less so with CAP_SYS_ADMIN.
If you trust the code you are testing, I think this i…