Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawning certain child processes outside the network namespace? #282

Closed
097115 opened this issue Oct 21, 2024 · 2 comments
Closed

Spawning certain child processes outside the network namespace? #282

097115 opened this issue Oct 21, 2024 · 2 comments

Comments

@097115
Copy link

097115 commented Oct 21, 2024

Is it possible to tell certain child processes to launch outside the current namespace?

I understand, that would sound more like a bug than a feature but maybe a user can somehow force an escape from the jail? :)

@jamesmcm
Copy link
Owner

One thing to clarify is that there is no jail per se (unless you use it to run with firejail - https://github.com/jamesmcm/vopono/blob/master/USERGUIDE.md#creating-only-network-namespace), it's just that by default any process's children will share the same network namespace.

At a low level, the processes are forking, and changing the network namespace is done via unshare.

https://man7.org/linux/man-pages/man2/unshare.2.html

But I can't think of an easy way of doing this for a specific process that is already running, unless you are writing the code that is doing the spawning.

Maybe it could be done with ptrace - https://stackoverflow.com/questions/41253216/is-there-a-linux-system-call-that-lets-me-make-system-calls-in-the-context-of-an

But what is the use-case btw?

@097115
Copy link
Author

097115 commented Oct 21, 2024

@jamesmcm , thanks a lot once again :)

But what is the use-case btw?

Let's say we have a browser running in one network namespace, then a user clicks, e.g., an irc:// or a magnet: link, which -- via a wrapper script -- spawns a third party app, like a chat or a torrent client, in another network namespace.

Probably, not the most clever scheme but sometimes it may prove handy to to keep things separate :)

@097115 097115 closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants