Score:0

podman: disconnect rootless container from network

ca flag

Podman containers can be started with --network=none to deny any network access. Running containers can be denied network access by disconnecting all networks according to podman-network-disconnect(1). However, for rootless containers this fails due to slirp4netns not being supported. This article says the podman network commands are for rootful containers only. (podman-network(1) does not.)

How can a running rootless container be denied network access?

A.B avatar
cl flag
A.B
Bearing in mind that there is no root access, if slirp4netns is ptrace(2)-able, one could use gdb to make it create a new user + network namespace and switch to it: all new sockets would fail (existing ones would continue to work). Probably irreversible. This is not a really reasonable approach, but can't think of anything else without privileges.
pt flag
Just killing the `slirp4netns` process seems to be sufficient. That removes the `tap0` interface from the container. Seems better to just start with `--network=None`.
raywib avatar
ca flag
While I agree that killing the process is not generally the optimal solution I'd actually accept it as a working solution.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.